-
Notifications
You must be signed in to change notification settings - Fork 29
test multiple coinbase outputs round-trip #325
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,3 +23,69 @@ async fn tp_high_diff() { | |
| assert_eq!(blockchain_info.difficulty, 77761.1123986095); | ||
| assert_eq!(blockchain_info.chain, "signet"); | ||
| } | ||
|
|
||
| // This test verifies that coinbase outputs survive the full round-trip through the mining stack. | ||
| // A mempool transaction triggers a witness commitment output, which must be preserved through | ||
| // TP -> Pool -> Translator -> Minerd and back to Bitcoin Core via block submission. | ||
| #[tokio::test] | ||
| async fn tp_coinbase_outputs_round_trip() { | ||
| start_tracing(); | ||
| let sv2_interval = Some(5); | ||
| let (tp, tp_addr) = start_template_provider(sv2_interval, DifficultyLevel::Low); | ||
| tp.fund_wallet().unwrap(); | ||
| let current_block_hash = tp.get_best_block_hash().unwrap(); | ||
|
|
||
| let (pool, pool_addr, _) = start_pool(sv2_tp_config(tp_addr), vec![], vec![], false).await; | ||
|
|
||
| // Create a mempool transaction to trigger witness commitment output | ||
| tp.create_mempool_transaction().unwrap(); | ||
|
|
||
| let (translator, tproxy_addr, _) = | ||
| start_sv2_translator(&[pool_addr], false, vec![], vec![], None, false).await; | ||
| let (_minerd, _) = start_minerd(tproxy_addr, None, None, false).await; | ||
|
|
||
| wait_for_new_block( | ||
| ¤t_block_hash, | ||
| || tp.get_best_block_hash().unwrap(), | ||
| "Block should have been mined and accepted within 60 seconds, \ | ||
| confirming coinbase outputs survived the round-trip", | ||
| ) | ||
| .await; | ||
| shutdown_all!(pool, translator); | ||
| } | ||
|
|
||
| // This test verifies that multiple coinbase outputs survive the full round-trip. | ||
| // Requires a custom Bitcoin Core build with -testmulticoinbase support, which adds extra | ||
| // OP_RETURN outputs to the coinbase. Set BITCOIN_NODE_BIN to the custom binary path. | ||
| #[tokio::test] | ||
| #[ignore = "requires custom Bitcoin Core build with -testmulticoinbase; set BITCOIN_NODE_BIN"] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the strategy behind this
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does one need to do to get and if it's not readily available on official Bitcoin Core distribution, why should it be covered by SRI CI? |
||
| async fn tp_multiple_coinbase_outputs_round_trip() { | ||
| start_tracing(); | ||
|
|
||
| let sv2_interval = Some(5); | ||
| let (tp, tp_addr) = start_template_provider_with_args( | ||
| sv2_interval, | ||
| DifficultyLevel::Low, | ||
| vec!["-testmulticoinbase"], | ||
| ); | ||
| tp.fund_wallet().unwrap(); | ||
| let current_block_hash = tp.get_best_block_hash().unwrap(); | ||
|
|
||
| let (pool, pool_addr, _) = start_pool(sv2_tp_config(tp_addr), vec![], vec![], false).await; | ||
|
|
||
| // Create a mempool transaction to add a witness commitment OP_RETURN | ||
| tp.create_mempool_transaction().unwrap(); | ||
|
|
||
| let (translator, tproxy_addr, _) = | ||
| start_sv2_translator(&[pool_addr], false, vec![], vec![], None, false).await; | ||
| let (_minerd, _) = start_minerd(tproxy_addr, None, None, false).await; | ||
|
|
||
| wait_for_new_block( | ||
| ¤t_block_hash, | ||
| || tp.get_best_block_hash().unwrap(), | ||
| "Block should have been mined and accepted within 60 seconds, \ | ||
| confirming all coinbase outputs survived the round-trip", | ||
| ) | ||
| .await; | ||
| shutdown_all!(pool, translator); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how the tests on this file are asserting what this PR aims to achieve.
we simply assert that some block was mined, while there's no assertion with regards to how many outputs there are in the coinbase tx