@@ -835,7 +835,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C
835835 return state.DoS (0 , false , REJECT_NONSTANDARD, reason);
836836
837837 // Don't accept witness transactions before the final threshold passes
838- if (!tx.wit .IsNull () && !(chainActive.Tip ()->nHeight + 1 >= Params ().GetConsensus ().SegWitHeight && IsSuperMajority (5 , chainActive.Tip (), Params ().GetConsensus ().nMajorityRejectBlockOutdated , Params ().GetConsensus ()))) {
838+ if (!GetBoolArg ( " -prematurewitness " , false ) && ! tx.wit .IsNull () && !(chainActive.Tip ()->nHeight + 1 >= Params ().GetConsensus ().SegWitHeight && IsSuperMajority (5 , chainActive.Tip (), Params ().GetConsensus ().nMajorityRejectBlockOutdated , Params ().GetConsensus ()))) {
839839 return state.DoS (0 , false , REJECT_NONSTANDARD, " no-witness-yet" );
840840 }
841841
@@ -1176,11 +1176,16 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C
11761176 }
11771177 }
11781178
1179+ unsigned int scriptVerifyFlags = STANDARD_SCRIPT_VERIFY_FLAGS;
1180+ if (!Params ().RequireStandard ()) {
1181+ scriptVerifyFlags = GetArg (" -promiscuousmempoolflags" , scriptVerifyFlags);
1182+ }
1183+
11791184 // Check against previous transactions
11801185 // This is done last to help prevent CPU exhaustion denial-of-service attacks.
1181- if (!CheckInputs (tx, state, view, true , STANDARD_SCRIPT_VERIFY_FLAGS , true )) {
1182- if (CheckInputs (tx, state, view, true , STANDARD_SCRIPT_VERIFY_FLAGS & ~(SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_CLEANSTACK), true ) &&
1183- !CheckInputs (tx, state, view, true , STANDARD_SCRIPT_VERIFY_FLAGS & ~SCRIPT_VERIFY_CLEANSTACK, true )) {
1186+ if (!CheckInputs (tx, state, view, true , scriptVerifyFlags , true )) {
1187+ if (CheckInputs (tx, state, view, true , scriptVerifyFlags & ~(SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_CLEANSTACK), true ) &&
1188+ !CheckInputs (tx, state, view, true , scriptVerifyFlags & ~SCRIPT_VERIFY_CLEANSTACK, true )) {
11841189 // Only the witness is wrong, so the transaction itself may be fine.
11851190 state.SetCorruptionPossible ();
11861191 }
0 commit comments