Skip to content

Commit cfeb823

Browse files
committed
Add RequireStandard chain parameter
1 parent 21913a9 commit cfeb823

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/chainparams.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ class CTestNetParams : public CMainParams {
226226
}
227227

228228
virtual bool AllowMinDifficultyBlocks() const { return true; }
229+
virtual bool RequireStandard() const { return false; }
229230
virtual Network NetworkID() const { return CChainParams::TESTNET; }
230231
};
231232
static CTestNetParams testNetParams;
@@ -262,6 +263,7 @@ class CRegTestParams : public CTestNetParams {
262263
virtual bool MiningRequiresPeers() const { return false; }
263264
virtual bool MineBlocksOnDemand() const { return true; }
264265
virtual bool DefaultCheckMemPool() const { return true; }
266+
virtual bool RequireStandard() const { return false; }
265267
virtual Network NetworkID() const { return CChainParams::REGTEST; }
266268
};
267269
static CRegTestParams regTestParams;

src/chainparams.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ class CChainParams
7272
virtual bool DefaultCheckMemPool() const { return false; }
7373
/* Allow mining of a min-difficulty block */
7474
virtual bool AllowMinDifficultyBlocks() const { return false; }
75+
/* Make standard checks */
76+
virtual bool RequireStandard() const { return true; }
7577
const string& DataDir() const { return strDataDir; }
7678
/* Make miner stop after a block is found. In RPC, don't return
7779
* until nGenProcLimit blocks are generated */

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
833833

834834
// Rather not work on nonstandard transactions (unless -testnet/-regtest)
835835
string reason;
836-
if (Params().NetworkID() == CChainParams::MAIN && !IsStandardTx(tx, reason))
836+
if (Params().RequireStandard() && !IsStandardTx(tx, reason))
837837
return state.DoS(0,
838838
error("AcceptToMemoryPool : nonstandard transaction: %s", reason),
839839
REJECT_NONSTANDARD, reason);
@@ -894,7 +894,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
894894
}
895895

896896
// Check for non-standard pay-to-script-hash in inputs
897-
if (Params().NetworkID() == CChainParams::MAIN && !AreInputsStandard(tx, view))
897+
if (Params().RequireStandard() && !AreInputsStandard(tx, view))
898898
return error("AcceptToMemoryPool: : nonstandard transaction input");
899899

900900
// Note: if you modify this code to accept non-standard transactions, then

0 commit comments

Comments
 (0)