Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

electrum: make sure chain updates connect on rescan #1315

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ task:
EXECUTOR_WORKERS: 3
VERBOSE: 0
LOG_LEVEL: debug
TIMEOUT: 300
TIMEOUT: 120
matrix:
- name: 'Misc functional tests'
env:
Expand Down
7 changes: 4 additions & 3 deletions src/bitcoin/electrum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,7 @@ impl Electrum {
} else {
log::info!("Performing full scan.");
// Either local_chain has height 0 or we want to trigger a full scan.
// In both cases, the scan should be from the genesis block.
let genesis_block = local_chain_tip.get(0).expect("must contain genesis block");
let mut request = FullScanRequest::from_chain_tip(genesis_block)
let mut request = FullScanRequest::from_chain_tip(local_chain_tip.clone())
.cache_graph_txs(self.bdk_wallet.graph());

for (k, spks) in self.bdk_wallet.index().all_unbounded_spk_iters() {
Expand Down Expand Up @@ -193,6 +191,9 @@ impl Electrum {
chain_update.height()
);

log::debug!("Full local chain: {:?}", self.local_chain());
log::debug!("Full chain update: {:?}", chain_update);

// Increment the sync count and apply changes.
self.sync_count = self.sync_count.checked_add(1).expect("must fit");
if let Some(keychain_update) = keychain_update {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def reorg_shift(height, txs):
"""Remine the chain from given height, shifting the txs by one block."""
delta = bitcoind.rpc.getblockcount() - height + 1
assert delta > 2
h = bitcoind.rpc.getblockhash(initial_tip["height"])
h = bitcoind.rpc.getblockhash(height)
bitcoind.rpc.invalidateblock(h)
bitcoind.generate_block(1)
for tx in txs:
Expand Down
Loading