mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Do not run functions with necessary side-effects in assert()
This commit is contained in:
parent
26fe5c98ab
commit
da9cdd2c9c
2 changed files with 8 additions and 4 deletions
|
|
@ -1518,7 +1518,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||
}
|
||||
|
||||
CBlock block;
|
||||
assert(ReadBlockFromDisk(block, it->second, chainparams.GetConsensus()));
|
||||
bool ret = ReadBlockFromDisk(block, it->second, chainparams.GetConsensus());
|
||||
assert(ret);
|
||||
|
||||
BlockTransactions resp(req);
|
||||
for (size_t i = 0; i < req.indexes.size(); i++) {
|
||||
|
|
@ -2730,7 +2731,8 @@ bool SendMessages(CNode* pto, CConnman& connman)
|
|||
vHeaders.front().GetHash().ToString(), pto->id);
|
||||
//TODO: Shouldn't need to reload block from disk, but requires refactor
|
||||
CBlock block;
|
||||
assert(ReadBlockFromDisk(block, pBestIndex, consensusParams));
|
||||
bool ret = ReadBlockFromDisk(block, pBestIndex, consensusParams);
|
||||
assert(ret);
|
||||
CBlockHeaderAndShortTxIDs cmpctblock(block, state.fWantsCmpctWitness);
|
||||
int nSendFlags = state.fWantsCmpctWitness ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS;
|
||||
connman.PushMessage(pto, msgMaker.Make(nSendFlags, NetMsgType::CMPCTBLOCK, cmpctblock));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue