Describe the bug
Setting ElectrumBlockchainConfig::stop_gap as 0 results in infinite loop during wallet setup/sync.
To Reproduce
- Create wallet with
ElectrumBlockchainConfig::stop_gap set as 0
- Call
Wallet::sync
Expected behavior
- Electrum blockchain should still be functional with
stop_gap == 0
Build environment
- BDK tag/commit:
v0.19.0 063d51f
- OS+version: Fedora Linux 5.18.5-200.fc36.x86_64
- Rust/Cargo version: cargo 1.62.0 (a748cf5a3 2022-06-08)
- Rust/Cargo target: x86_64-unknown-linux-gnu
Additional context
Example code:
let mut test_client = TestClient::default();
let factory = Arc::new(
ElectrumBlockchain::from_config(&ElectrumBlockchainConfig {
url: test_client.electrsd.electrum_url.clone(),
socks5: None,
retry: 0,
timeout: None,
stop_gap: 0, // STOP_GAP IS ZERO
})
.unwrap(),
);
let wallet = Wallet::new(
"wpkh(L5EZftvrYaSudiozVRzTqLcHLNDoVn7H5HSfM9BAN6tMJX8oTWz6)",
None,
bitcoin::Network::Regtest,
MemoryDatabase::new(),
)
.unwrap();
// HANGS HERE INDEFINITELY!!!
factory
.sync_wallet(&wallet, None, Default::default())
.unwrap();
Describe the bug
Setting
ElectrumBlockchainConfig::stop_gapas0results in infinite loop during wallet setup/sync.bdk/src/blockchain/electrum.rs
Line 302 in 063d51f
To Reproduce
ElectrumBlockchainConfig::stop_gapset as0Wallet::syncExpected behavior
stop_gap == 0Build environment
v0.19.0063d51fAdditional context
Example code: