Skip to content

Commit

Permalink
Fix wallet sync not finding coins of addresses which are not cached
Browse files Browse the repository at this point in the history
Previously, electrum-based blockchain implementations only synced for
`scriptPubKey`s that are already cached in `Database`.

This PR introduces a feedback mechanism, that uses `stop_gap` and the
difference between "current index" and "last active index" to determine
whether we need to cache more `scriptPubKeys`.

The `WalletSync::wallet_setup` trait now may return an
`Error::MissingCachedScripts` error which contains the number of extra
`scriptPubKey`s to cache, in order to satisfy `stop_gap` for the next call.

`Wallet::sync` now calls `WalletSync` in a loop, cacheing inbetween
subsequent calls (if needed).
  • Loading branch information
evanlinjin committed Jul 20, 2022
1 parent 6bf7878 commit 7e2ad9b
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/blockchain/esplora/reqwest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ impl WalletSync for EsploraBlockchain {
};

database.commit_batch(batch_update)?;

Ok(())
}
}
Expand Down

0 comments on commit 7e2ad9b

Please sign in to comment.