mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-02 09:46:14 +00:00
ipc mining: provide default option values (incompatible schema change)
This change copies default option values from the C++ mining interface to the Cap'n Proto interface. Currently, no capnp default values are set, so they are implicitly all false or 0, which is inconvenient for the rust and python clients and inconsistent with the C++ client. Warning: This is an intermediate, review-only commit. Binaries built from it should not be distributed or used to connect to other clients or servers. It makes incompatible changes to the `mining.capnp` schema without updating the `Init.makeMining` version, causing binaries to advertise support for a schema they do not actually implement. Mixed versions may therefore exchange garbage requests/responses instead of producing clear errors. The final commit in this series bumps the mining interface number to ensure mismatches are detected. git-bisect-skip: yes
This commit is contained in:
parent
a4603ac774
commit
c6638fa7c5
@ -21,7 +21,7 @@ interface Mining $Proxy.wrap("interfaces::Mining") {
|
||||
isTestChain @0 (context :Proxy.Context) -> (result: Bool);
|
||||
isInitialBlockDownload @1 (context :Proxy.Context) -> (result: Bool);
|
||||
getTip @2 (context :Proxy.Context) -> (result: Common.BlockRef, hasResult: Bool);
|
||||
waitTipChanged @3 (context :Proxy.Context, currentTip: Data, timeout: Float64) -> (result: Common.BlockRef);
|
||||
waitTipChanged @3 (context :Proxy.Context, currentTip: Data, timeout: Float64 = .maxDouble) -> (result: Common.BlockRef);
|
||||
createNewBlock @4 (options: BlockCreateOptions) -> (result: BlockTemplate);
|
||||
checkBlock @5 (block: Data, options: BlockCheckOptions) -> (reason: Text, debug: Text, result: Bool);
|
||||
}
|
||||
@ -43,19 +43,19 @@ interface BlockTemplate $Proxy.wrap("interfaces::BlockTemplate") {
|
||||
}
|
||||
|
||||
struct BlockCreateOptions $Proxy.wrap("node::BlockCreateOptions") {
|
||||
useMempool @0 :Bool $Proxy.name("use_mempool");
|
||||
blockReservedWeight @1 :UInt64 $Proxy.name("block_reserved_weight");
|
||||
coinbaseOutputMaxAdditionalSigops @2 :UInt64 $Proxy.name("coinbase_output_max_additional_sigops");
|
||||
useMempool @0 :Bool = true $Proxy.name("use_mempool");
|
||||
blockReservedWeight @1 :UInt64 = .defaultBlockReservedWeight $Proxy.name("block_reserved_weight");
|
||||
coinbaseOutputMaxAdditionalSigops @2 :UInt64 = .defaultCoinbaseOutputMaxAdditionalSigops $Proxy.name("coinbase_output_max_additional_sigops");
|
||||
}
|
||||
|
||||
struct BlockWaitOptions $Proxy.wrap("node::BlockWaitOptions") {
|
||||
timeout @0 : Float64 $Proxy.name("timeout");
|
||||
feeThreshold @1 : Int64 $Proxy.name("fee_threshold");
|
||||
timeout @0 : Float64 = .maxDouble $Proxy.name("timeout");
|
||||
feeThreshold @1 : Int64 = .maxMoney $Proxy.name("fee_threshold");
|
||||
}
|
||||
|
||||
struct BlockCheckOptions $Proxy.wrap("node::BlockCheckOptions") {
|
||||
checkMerkleRoot @0 :Bool $Proxy.name("check_merkle_root");
|
||||
checkPow @1 :Bool $Proxy.name("check_pow");
|
||||
checkMerkleRoot @0 :Bool = true $Proxy.name("check_merkle_root");
|
||||
checkPow @1 :Bool = true $Proxy.name("check_pow");
|
||||
}
|
||||
|
||||
struct CoinbaseTx $Proxy.wrap("node::CoinbaseTx") {
|
||||
|
||||
@ -243,9 +243,6 @@ class IPCMiningTest(BitcoinTestFramework):
|
||||
|
||||
async with AsyncExitStack() as stack:
|
||||
opts = self.capnp_modules['mining'].BlockCreateOptions()
|
||||
opts.useMempool = True
|
||||
opts.blockReservedWeight = 4000
|
||||
opts.coinbaseOutputMaxAdditionalSigops = 0
|
||||
template = await mining_create_block_template(mining, stack, ctx, opts)
|
||||
assert template is not None
|
||||
block = await mining_get_block(template, ctx)
|
||||
@ -351,12 +348,7 @@ class IPCMiningTest(BitcoinTestFramework):
|
||||
|
||||
def run_test(self):
|
||||
self.miniwallet = MiniWallet(self.nodes[0])
|
||||
self.default_block_create_options = self.capnp_modules['mining'].BlockCreateOptions(
|
||||
useMempool=True,
|
||||
blockReservedWeight=4000,
|
||||
coinbaseOutputMaxAdditionalSigops=0
|
||||
)
|
||||
|
||||
self.default_block_create_options = self.capnp_modules['mining'].BlockCreateOptions()
|
||||
self.run_mining_interface_test()
|
||||
self.run_block_template_test()
|
||||
self.run_coinbase_and_submission_test()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user