| 3408 | } |
| 3409 | |
| 3410 | bool ContextualCheckTransaction(const CTransaction &tx, CValidationState &state, int nHeight, |
| 3411 | int64_t nLockTimeCutoff, int64_t nMedianTimePastPrev) { |
| 3412 | if (!IsFinalTx(tx, nHeight, nLockTimeCutoff)) { |
| 3413 | return state.DoS(10, error("%s: contains a non-final transaction", __func__), REJECT_INVALID, "bad-txns-nonfinal"); |
| 3414 | } |
| 3415 | if ((Opt().UAHFTime() != 0) && |
| 3416 | (nMedianTimePastPrev >= Opt().UAHFTime()) && |
| 3417 | (nHeight <= Opt().UAHFProtectSunset())) { |
| 3418 | for (const CTxOut &o : tx.vout) { |
| 3419 | if (o.scriptPubKey.IsCommitment(GetAntiReplayCommitment())) { |
| 3420 | return state.DoS(10, error("%s: chain protected from tx", __func__), REJECT_INVALID, "bad-txn-replay"); |
| 3421 | } |
| 3422 | } |
| 3423 | } |
| 3424 | return true; |
| 3425 | } |
| 3426 | |
| 3427 | bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIndex * const pindexPrev) |
| 3428 | { |