diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2985a39..e3f178f 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#33922 PR branch + cd bitcoin + git fetch --depth 1 origin pull/33922/head:pr-33922 + git checkout pr-33922 - name: Build Bitcoin Core run: | cd bitcoin diff --git a/capnp/mining.capnp b/capnp/mining.capnp index cda48c0..b2d0681 100644 --- a/capnp/mining.capnp +++ b/capnp/mining.capnp @@ -26,6 +26,7 @@ interface Mining $Proxy.wrap("interfaces::Mining") { submitBlock @7 (context :Proxy.Context, block: Data) -> (reason: Text, debug: Text, result: Bool); getTransactionsByTxID @8 (context :Proxy.Context, txids: List(Data)) -> (result: List(Data)); getTransactionsByWitnessID @9 (context :Proxy.Context, wtxids: List(Data)) -> (result: List(Data)); + getMemoryLoad @10 (context :Proxy.Context) -> (result: MemoryLoad); } interface BlockTemplate $Proxy.wrap("interfaces::BlockTemplate") { @@ -50,6 +51,10 @@ struct BlockCreateOptions $Proxy.wrap("node::BlockCreateOptions") { coinbaseOutputMaxAdditionalSigops @2 :UInt64 = .defaultCoinbaseOutputMaxAdditionalSigops $Proxy.name("coinbase_output_max_additional_sigops"); } +struct MemoryLoad $Proxy.wrap("interfaces::MemoryLoad") { + usage @0 :UInt64; +} + struct BlockWaitOptions $Proxy.wrap("node::BlockWaitOptions") { timeout @0 : Float64 = .maxDouble $Proxy.name("timeout"); feeThreshold @1 : Int64 = .maxMoney $Proxy.name("fee_threshold"); diff --git a/tests/test.rs b/tests/test.rs index 153f76e..35adda1 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -143,7 +143,7 @@ fn mining_constants() { ); } -/// isTestChain, isInitialBlockDownload, getTip. +/// isTestChain, isInitialBlockDownload, getTip, getMemoryLoad. #[tokio::test] #[serial_test::parallel] async fn mining_basic_queries() { @@ -172,6 +172,16 @@ async fn mining_basic_queries() { let tip_hash = tip.get_hash().unwrap(); assert_eq!(tip_hash.len(), 32, "block hash must be 32 bytes"); assert!(tip.get_height() >= 0, "height must be non-negative"); + + // getMemoryLoad + let resp = mining + .get_memory_load_request() + .send() + .promise + .await + .unwrap(); + let memory_load = resp.get().unwrap().get_result().unwrap(); + let _usage: u64 = memory_load.get_usage(); }) .await; }