Skip to content

Commit

Permalink
waddrmgr: Put client request first in recovery.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeGruffins committed Feb 27, 2025
1 parent 311812f commit 0646372
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,16 +790,25 @@ func (w *Wallet) recovery(chainClient chain.Interface,
if len(recoveryBatch) == recoveryBatchSize || height == bestHeight {
err := walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) error {
ns := tx.ReadWriteBucket(waddrmgrNamespaceKey)
err := w.recoverScopedAddresses(
chainClient, tx, ns, recoveryBatch,
recoveryMgr.State(), scopedMgrs,
)
if err != nil {
return err
}
// TODO: Any error here will roll back this
// entire tx. This may cause the in memory sync
// point to become desyncronized. Refactor so
// that this cannot happen.
for _, block := range blocks {
err := w.Manager.SetSyncedTo(ns, block)
if err != nil {
return err
}
}
return w.recoverScopedAddresses(
chainClient, tx, ns, recoveryBatch,
recoveryMgr.State(), scopedMgrs,
)

return nil
})
if err != nil {
return err
Expand Down

0 comments on commit 0646372

Please sign in to comment.