diff options
author | Andrew Toth <andrewstoth@gmail.com> | 2020-03-27 11:00:10 -0400 |
---|---|---|
committer | Andrew Toth <andrewstoth@gmail.com> | 2020-03-27 11:00:10 -0400 |
commit | dcc8332543f8fb6d1bb47cb270fcbb6a814a7d6e (patch) | |
tree | ee8fdeb4cb550416b1141d6a590ce53e83ca4696 /src/miner.cpp | |
parent | e3154aacf444a29f9f5642b6c937e875ab9a2c13 (diff) |
Add generateblock rpc
Diffstat (limited to 'src/miner.cpp')
-rw-r--r-- | src/miner.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/miner.cpp b/src/miner.cpp index 61d27d17c1..5ab23c7f4f 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -39,6 +39,17 @@ int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParam return nNewTime - nOldTime; } +void RegenerateCommitments(CBlock& block) +{ + CMutableTransaction tx{*block.vtx.at(0)}; + tx.vout.erase(tx.vout.begin() + GetWitnessCommitmentIndex(block)); + block.vtx.at(0) = MakeTransactionRef(tx); + + GenerateCoinbaseCommitment(block, WITH_LOCK(cs_main, return LookupBlockIndex(block.hashPrevBlock)), Params().GetConsensus()); + + block.hashMerkleRoot = BlockMerkleRoot(block); +} + BlockAssembler::Options::Options() { blockMinFeeRate = CFeeRate(DEFAULT_BLOCK_MIN_TX_FEE); nBlockMaxWeight = DEFAULT_BLOCK_MAX_WEIGHT; |