Skip to content

Setting electrum client's stop_gap as 0 results in hang #651

@evanlinjin

Description

@evanlinjin

Describe the bug

Setting ElectrumBlockchainConfig::stop_gap as 0 results in infinite loop during wallet setup/sync.

pub stop_gap: usize,

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();

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions