From b3db9fa6c658d0963f6f69701729ce6e686d5f5e Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Thu, 5 Mar 2026 15:36:16 -0300 Subject: [PATCH 1/2] ci: switch to bitcoin/bitcoin#34644 (DO NOT MERGE) --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2985a39..371cc31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,12 @@ jobs: key: ccache-${{ runner.os }}-${{ github.sha }} restore-keys: ccache-${{ runner.os }}- - name: Checkout Bitcoin Core - run: git clone --depth 1 --branch master https://github.com/bitcoin/bitcoin.git + run: | + git clone --depth 1 https://github.com/bitcoin/bitcoin.git + # DO NOT MERGE: switch to bitcoin/bitcoin#34644 PR branch + cd bitcoin + git fetch --depth 1 origin pull/34644/head:pr-34644 + git checkout pr-34644 - name: Build Bitcoin Core run: | cd bitcoin From fa5ca2437c052fa9651ad15e108863882274e8a9 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Thu, 5 Mar 2026 15:36:23 -0300 Subject: [PATCH 2/2] capnp: add Mining.submitBlock() method --- capnp/mining.capnp | 1 + tests/test.rs | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/capnp/mining.capnp b/capnp/mining.capnp index f790e12..2526323 100644 --- a/capnp/mining.capnp +++ b/capnp/mining.capnp @@ -23,6 +23,7 @@ interface Mining $Proxy.wrap("interfaces::Mining") { createNewBlock @4 (context :Proxy.Context, options: BlockCreateOptions, cooldown: Bool = true) -> (result: BlockTemplate); checkBlock @5 (context :Proxy.Context, block: Data, options: BlockCheckOptions) -> (reason: Text, debug: Text, result: Bool); interrupt @6 () -> (); + submitBlock @7 (context :Proxy.Context, block: Data) -> (reason: Text, debug: Text, result: Bool); } interface BlockTemplate $Proxy.wrap("interfaces::BlockTemplate") { diff --git a/tests/test.rs b/tests/test.rs index bf7e0d2..774d6e6 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -235,6 +235,39 @@ async fn mining_block_template_lifecycle() { .await; } +/// submitBlock with a template block should be rejected (unsolved high-hash). +#[tokio::test] +#[serial_test::serial] +async fn mining_submit_block() { + with_mining_client(|_client, thread, mining| async move { + let template = make_block_template(&mining, &thread).await; + + let mut get_block_req = template.get_block_request(); + get_block_req + .get() + .get_context() + .unwrap() + .set_thread(thread.clone()); + let get_block_resp = get_block_req.send().promise.await.unwrap(); + let block = get_block_resp.get().unwrap().get_result().unwrap().to_vec(); + + let mut req = mining.submit_block_request(); + req.get().get_context().unwrap().set_thread(thread.clone()); + req.get().set_block(&block); + let resp = req.send().promise.await.unwrap(); + let results = resp.get().unwrap(); + assert!( + !results.get_result(), + "unsolved template block must not be accepted" + ); + let _reason = results.get_reason().unwrap(); + let _debug = results.get_debug().unwrap(); + + destroy_template(&template, &thread).await; + }) + .await; +} + /// checkBlock with a template block payload, and interrupt. #[tokio::test] // Serialized because interrupt() can affect other in-flight mining waits.