mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
Add getCoinbaseMerklePath() to Mining interface
This commit is contained in:
parent
63d6ad7c89
commit
47b4875ef0
3 changed files with 14 additions and 0 deletions
|
@ -42,6 +42,13 @@ public:
|
|||
virtual CTransactionRef getCoinbaseTx() = 0;
|
||||
virtual std::vector<unsigned char> getCoinbaseCommitment() = 0;
|
||||
virtual int getWitnessCommitmentIndex() = 0;
|
||||
|
||||
/**
|
||||
* Compute merkle path to the coinbase transaction
|
||||
*
|
||||
* @return merkle path ordered from the deepest
|
||||
*/
|
||||
virtual std::vector<uint256> getCoinbaseMerklePath() = 0;
|
||||
};
|
||||
|
||||
//! Interface giving clients (RPC, Stratum v2 Template Provider in the future)
|
||||
|
|
|
@ -31,6 +31,7 @@ interface BlockTemplate $Proxy.wrap("interfaces::BlockTemplate") {
|
|||
getCoinbaseTx @4 (context: Proxy.Context) -> (result: Data);
|
||||
getCoinbaseCommitment @5 (context: Proxy.Context) -> (result: Data);
|
||||
getWitnessCommitmentIndex @6 (context: Proxy.Context) -> (result: Int32);
|
||||
getCoinbaseMerklePath @7 (context: Proxy.Context) -> (result: List(Data));
|
||||
}
|
||||
|
||||
struct BlockCreateOptions $Proxy.wrap("node::BlockCreateOptions") {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <chain.h>
|
||||
#include <chainparams.h>
|
||||
#include <common/args.h>
|
||||
#include <consensus/merkle.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <deploymentstatus.h>
|
||||
#include <external_signer.h>
|
||||
|
@ -910,6 +911,11 @@ public:
|
|||
return GetWitnessCommitmentIndex(m_block_template->block);
|
||||
}
|
||||
|
||||
std::vector<uint256> getCoinbaseMerklePath() override
|
||||
{
|
||||
return BlockMerkleBranch(m_block_template->block);
|
||||
}
|
||||
|
||||
const std::unique_ptr<CBlockTemplate> m_block_template;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue