Fix: Hang when ElectrumBlockchainConfig::stop_gap == 0#652
Fix: Hang when ElectrumBlockchainConfig::stop_gap == 0#652afilini merged 2 commits intobitcoindevkit:masterfrom
ElectrumBlockchainConfig::stop_gap == 0#652Conversation
ElectrumBlockchainConfig::stop_gap == 0ElectrumBlockchainConfig::stop_gap == 0
ElectrumBlockchainConfig::stop_gap == 0ElectrumBlockchainConfig::stop_gap == 0
This comment was marked as resolved.
This comment was marked as resolved.
|
Interesting bug. I'm not sure about the semantics of |
|
ACK. See #652 (comment)
|
629604f to
475b005
Compare
afilini
left a comment
There was a problem hiding this comment.
Concept ACK, a couple of things:
- did you check if this happens with esplora as well? The two blockchains are very similar in terms of architecture and code
- once you are done fixing the various comments, could you squash the commits into the first one?
| // [1] actual_gap: Range size of address indexes without a balance | ||
| // [2] addrs_before: Range size of address indexes (before gap) which contains a balance | ||
| // [3] addrs_after: Range size of address indexes (after gap) which contains a balance | ||
| let test_vectors: Vec<[u64; 4]> = vec![ |
There was a problem hiding this comment.
Wouldn't it be better to use usize here? I see that you have to cast these values in a few places
There was a problem hiding this comment.
It seems that if we do this, other variables will need casting... Should we leave it as is?
There was a problem hiding this comment.
Yeah at a quick glance I thought using usize would be fine, but if you need to cast anyway there's no reason to change it
@afilini I've made a trait that can be reused for testing both esplora and electrum. I've also made it expandable, so in the future we can implement more tests in it. Let me know whether these changes make sense! |
924b320 to
35a49fd
Compare
* Ensure chunk_size is > 0 during wallet sync. * Slight refactoring for better readability. * Add test: test_electrum_blockchain_factory_sync_with_stop_gaps
35a49fd to
3533afa
Compare
@afilini I feel like it's better to keep it to two commits. One if for the actual fix, the other is introducing a new testing trait that can be shared between different blockchain implementations. What do you think? |
3533afa to
a884a63
Compare
This is a continuation of the bitcoindevkit#651 fix. We should also check whether the same bug affects esplora as noted by @afilini. To achieve this, I've introduced a `ConfigurableBlockchainTester` trait that can test multiple blockchain implementations. * Introduce `ConfigurableBlockchainTester` trait. * Use the aforementioned trait to also test esplora. * Change the electrum test to also use the new trait. * Fix some complaints by clippy in ureq.rs file (why is CI not seeing this?). * Refactor some code.
a884a63 to
612da16
Compare
|
@afilini Should this fix also be part of Release 0.20.0 Feature Freeze? Ensuring that the The test I have included checks for this. bdk/src/testutils/configurable_blockchain_tests.rs Lines 131 to 135 in 612da16 |
Yeah two commits works for me, as long as they are self-contained (they should both compile and run
I don't think this is as critical as that other one, but if this is ready in time yes, this is also important |
Ensure
chunk_sizeis > 0 during wallet sync.Slight refactoring for better readability.
Add test:
test_electrum_blockchain_factory_sync_with_stop_gapsDescription
Wallet::synchangs indefinitely when syncing with Electrum withstop_gapset as 0.The culprit is having
chunk_sizeset asstop_gap. A zero value results in syncing not being able to progress.Fixes #651
Checklists
All Submissions:
cargo fmtandcargo clippybefore committingBugfixes:
* [ ] This pull request breaks the existing API