File tree 1 file changed +16
-4
lines changed
1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -1103,17 +1103,29 @@ func (n *node) archiveClosedWallets() error {
1103
1103
for _ , walletPublicKey := range walletPublicKeys {
1104
1104
walletPublicKeyHash := bitcoin .PublicKeyHash (walletPublicKey )
1105
1105
1106
- walletChainData , err := n .chain .GetWallet ( walletPublicKeyHash )
1106
+ walletID , err := n .chain .CalculateWalletID ( walletPublicKey )
1107
1107
if err != nil {
1108
1108
return fmt .Errorf (
1109
- "could not get wallet data for wallet [0x%x]: [%v]" ,
1109
+ "could not calculate wallet ID for wallet with public key " +
1110
+ "hash [0x%x]: [%v]" ,
1110
1111
walletPublicKeyHash ,
1111
1112
err ,
1112
1113
)
1113
1114
}
1114
1115
1115
- if walletChainData .State == StateClosed ||
1116
- walletChainData .State == StateTerminated {
1116
+ isRegistered , err := n .chain .IsWalletRegistered (walletID )
1117
+ if err != nil {
1118
+ return fmt .Errorf (
1119
+ "could not check if wallet is registered for wallet with ID " +
1120
+ "[0x%x]: [%v]" ,
1121
+ walletPublicKeyHash ,
1122
+ err ,
1123
+ )
1124
+ }
1125
+
1126
+ if ! isRegistered {
1127
+ // If the wallet is no longer registered it means the wallet has
1128
+ // been closed or terminated.
1117
1129
err := n .walletRegistry .archiveWallet (walletPublicKeyHash )
1118
1130
if err != nil {
1119
1131
return fmt .Errorf (
You can’t perform that action at this time.
0 commit comments