mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
miner: Pass in chainman to RegenerateCommitments
Pass in chainman instead of prev_block so that we can enforce the block.hashPrevBlock refers to prev_block invariant in the function itself. We should probably rethink BlockAssembler's API and somehow include commitment regeneration functionality in there. Something like a variant of CreateNewBlock that takes in a std::vector<TxRef> and return a CBlock instead of CBlockTemplate. That could avoid reaching for LookupBlockIndex at all.
This commit is contained in:
parent
9ecade1425
commit
e6b4aa6eb5
4 changed files with 13 additions and 7 deletions
|
|
@ -378,8 +378,7 @@ static RPCHelpMan generateblock()
|
|||
|
||||
// Add transactions
|
||||
block.vtx.insert(block.vtx.end(), txs.begin(), txs.end());
|
||||
CBlockIndex* prev_block = WITH_LOCK(::cs_main, return chainman.m_blockman.LookupBlockIndex(block.hashPrevBlock));
|
||||
RegenerateCommitments(block, prev_block);
|
||||
RegenerateCommitments(block, chainman);
|
||||
|
||||
{
|
||||
LOCK(cs_main);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue