mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Fix locking issues in DIP3 unit tests (#2285)
* Don't use GetTransaction in CheckProUpRegTx GetTransaction locks mempool.cs internally. This brings messes up the locking order of cs_main, mempool.cs and CCheckQueue::ControlMutex. * Lock cs_main in TestChainSetup::CreateBlock when updating CbTx
This commit is contained in:
parent
1e74bcace9
commit
2a95dd30c5
@ -190,11 +190,11 @@ bool CheckProUpRegTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CVal
|
||||
|
||||
// This is a temporary restriction that will be lifted later
|
||||
// It is required while we are transitioning from the old MN list to the deterministic list
|
||||
CTransactionRef proRegTx;
|
||||
uint256 tmpHashBlock;
|
||||
if (!GetTransaction(ptx.proTxHash, proRegTx, Params().GetConsensus(), tmpHashBlock))
|
||||
Coin coin;
|
||||
if (!GetUTXOCoin(COutPoint(dmn->proTxHash, dmn->nCollateralIndex), coin) || coin.IsSpent()) {
|
||||
return state.DoS(100, false, REJECT_INVALID, "bad-protx-payee-collateral");
|
||||
if (proRegTx->vout[dmn->nCollateralIndex].scriptPubKey != ptx.scriptPayout)
|
||||
}
|
||||
if (coin.out.scriptPubKey != ptx.scriptPayout)
|
||||
return state.DoS(10, false, REJECT_INVALID, "bad-protx-payee-collateral");
|
||||
|
||||
if (mnList.HasUniqueProperty(ptx.keyIDOperator)) {
|
||||
|
@ -151,6 +151,7 @@ CBlock TestChainSetup::CreateBlock(const std::vector<CMutableTransaction>& txns,
|
||||
|
||||
// Manually update CbTx as we modified the block here
|
||||
if (block.vtx[0]->nType == TRANSACTION_COINBASE) {
|
||||
LOCK(cs_main);
|
||||
CCbTx cbTx;
|
||||
if (!GetTxPayload(*block.vtx[0], cbTx)) {
|
||||
BOOST_ASSERT(false);
|
||||
|
Loading…
Reference in New Issue
Block a user