Skip to content

Commit

Permalink
Fixes UB reported in issue bitcoin#19278
Browse files Browse the repository at this point in the history
  • Loading branch information
rajarshimaitra committed Jun 25, 2020
1 parent 39bd9dd commit 8cc8548
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5055,11 +5055,11 @@ bool LoadMempool(CTxMemPool& pool)
file >> nFeeDelta;

CAmount amountdelta = nFeeDelta;
if (amountdelta) {
if (amountdelta && MoneyRange(amountdelta)) {
pool.PrioritiseTransaction(tx->GetHash(), amountdelta);
}
TxValidationState state;
if (nTime + nExpiryTimeout > nNow) {
if (nTime > nNow - nExpiryTimeout) {
LOCK(cs_main);
AcceptToMemoryPoolWithTime(chainparams, pool, state, tx, nTime,
nullptr /* plTxnReplaced */, false /* bypass_limits */, 0 /* nAbsurdFee */,
Expand Down Expand Up @@ -5087,7 +5087,9 @@ bool LoadMempool(CTxMemPool& pool)
file >> mapDeltas;

for (const auto& i : mapDeltas) {
pool.PrioritiseTransaction(i.first, i.second);
if(MoneyRange(i.second)){
pool.PrioritiseTransaction(i.first, i.second);
}
}

// TODO: remove this try except in v0.22
Expand Down

0 comments on commit 8cc8548

Please sign in to comment.