Skip to content

Commit

Permalink
Add full contract validation into CheckContracts()
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed Dec 4, 2023
1 parent 3e58720 commit fd33338
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,19 @@ bool CheckContracts(const CTransaction& tx, const MapPrevTx& inputs, int block_h
FormatMoney(supplied_burn_fee)));
}

// Validate the individual contracts. This is required even though contracts are checked upon
// receipt into the memory pool. There are situations where a transaction has not been propagated
// into the memory pool of a particular node, but was on other nodes, and was included in a staked
// block. In that case the transaction must be revalidated on THIS node as part of the block connection
// process.
int DoS = 0;
if (!GRC::ValidateContracts(tx, DoS)) {
return tx.DoS(DoS, error("%s: invalid contract in tx %s, assigning DoS misbehavior of %i",
__func__,
tx.GetHash().ToString(),
DoS));
}

return true;
}

Expand Down

0 comments on commit fd33338

Please sign in to comment.