diff --git a/bus/infrastructure.go b/bus/infrastructure.go index a4c656f..398a8b4 100644 --- a/bus/infrastructure.go +++ b/bus/infrastructure.go @@ -218,7 +218,11 @@ func (b *Bus) Close(ctx context.Context) { b.mainClient.Shutdown() b.secondaryClient.Shutdown() - b.UnloadWallet() + // Only unload wallet if we are not in a pending scan + // otherwise the nuclear timeout corrupts the wallet state + if !b.IsPendingScan { + b.UnloadWallet() + } done <- true }() diff --git a/bus/wallet.go b/bus/wallet.go index 4c182a8..8150c14 100644 --- a/bus/wallet.go +++ b/bus/wallet.go @@ -320,6 +320,8 @@ func (b *Bus) AbortRescan() error { "prefix": "AbortRescan", }).Infof("Abort rescan successful: %t", abortRescan) + b.IsPendingScan = false + return nil }