From fd33338c8e829928b2c3977d22ae007b965220ed Mon Sep 17 00:00:00 2001 From: "James C. Owens" Date: Mon, 4 Dec 2023 08:35:53 -0500 Subject: [PATCH] Add full contract validation into CheckContracts() --- src/validation.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/validation.cpp b/src/validation.cpp index d9b12eb165..2b6c9a1152 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -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; }