Skip to content

test: Verify the node tracks Bitcoin Core's chain - #86

Merged
rustaceanrob merged 1 commit into
kernel-node:masterfrom
pzafonte:itest-chain-tracking
Jul 20, 2026
Merged

test: Verify the node tracks Bitcoin Core's chain#86
rustaceanrob merged 1 commit into
kernel-node:masterfrom
pzafonte:itest-chain-tracking

Conversation

@pzafonte

@pzafonte pzafonte commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Add two tests that drive the node against a regtest bitcoind through getTip. One mines blocks and waits for the node to reach the same tip. The other invalidates a block on Core and mines a longer competing branch, then waits for the node to reorg to it. The competing branch is mined to a fresh address so its blocks differ from the invalidated ones.

Depends on #85

@rustaceanrob

Copy link
Copy Markdown
Contributor

Needs rebase

@pzafonte
pzafonte force-pushed the itest-chain-tracking branch from 8fc85d9 to 9f259ce Compare July 20, 2026 17:24
@pzafonte pzafonte changed the title test: Verify the node tracks Bitcoin Core's chainItest chain tracking test: Verify the node tracks Bitcoin Core's chain tracking Jul 20, 2026
@pzafonte pzafonte changed the title test: Verify the node tracks Bitcoin Core's chain tracking test: Verify the node tracks Bitcoin Core's chain Jul 20, 2026
@pzafonte
pzafonte force-pushed the itest-chain-tracking branch from 9f259ce to bcddd00 Compare July 20, 2026 17:27
@pzafonte

pzafonte commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Needs rebase

Rebased and changed some .expect to .unwrap()

Temporarily stacking a commit to test the macOS runner. Will remove it later.

@pzafonte
pzafonte force-pushed the itest-chain-tracking branch from fb26e6a to bcddd00 Compare July 20, 2026 18:18
@pzafonte

Copy link
Copy Markdown
Contributor Author

The intermittent macOS CI failure might be a shutdown race in the node.

Comment thread tests/common/mod.rs Outdated

pub fn tip(&self) -> (u32, bitcoin::BlockHash) {
let socket = self.socket_path();
let rt = tokio::runtime::Builder::new_current_thread()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we hold this runtime and initialize it once at TestNode startup? Seems like a non-negligible cost that might be avoidable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, looks like it.

@rustaceanrob

Copy link
Copy Markdown
Contributor

The intermittent macOS CI failure might be a shutdown race in the node.

Please open an issue whenever you are available with the debug details. Otherwise things are looking good here.

Add two tests that drive the node against a regtest bitcoind through
getTip. One mines blocks and waits for the node to reach the same tip.
The other invalidates a block on Core and mines a longer competing
branch, then waits for the node to reorg to it. The competing branch
is mined to a fresh address so its blocks differ from the invalidated
ones.
@pzafonte
pzafonte force-pushed the itest-chain-tracking branch from bcddd00 to ecf57a4 Compare July 20, 2026 20:36
@pzafonte
pzafonte marked this pull request as ready for review July 20, 2026 20:37

@rustaceanrob rustaceanrob left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested a handful of times locally

@rustaceanrob
rustaceanrob merged commit 023e048 into kernel-node:master Jul 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants