aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjtimon <jtimon@monetize.io>2014-03-22 20:19:48 +0100
committerjtimon <jtimon@monetize.io>2014-06-04 13:29:36 +0200
commitcfeb8235fda44aa71fb99ce583c2c2049105ad5a (patch)
tree5e558a2965780d3334e38452b681f5cdc8407e96
parent21913a9ac9525547ebe18619748abb18a2ca8cdf (diff)
Add RequireStandard chain parameter
-rw-r--r--src/chainparams.cpp2
-rw-r--r--src/chainparams.h2
-rw-r--r--src/main.cpp4
3 files changed, 6 insertions, 2 deletions
diff --git a/src/chainparams.cpp b/src/chainparams.cpp
index c43de2e72d..f10599690f 100644
--- a/src/chainparams.cpp
+++ b/src/chainparams.cpp
@@ -226,6 +226,7 @@ public:
}
virtual bool AllowMinDifficultyBlocks() const { return true; }
+ virtual bool RequireStandard() const { return false; }
virtual Network NetworkID() const { return CChainParams::TESTNET; }
};
static CTestNetParams testNetParams;
@@ -262,6 +263,7 @@ public:
virtual bool MiningRequiresPeers() const { return false; }
virtual bool MineBlocksOnDemand() const { return true; }
virtual bool DefaultCheckMemPool() const { return true; }
+ virtual bool RequireStandard() const { return false; }
virtual Network NetworkID() const { return CChainParams::REGTEST; }
};
static CRegTestParams regTestParams;
diff --git a/src/chainparams.h b/src/chainparams.h
index e1ce86550c..881eb2294d 100644
--- a/src/chainparams.h
+++ b/src/chainparams.h
@@ -72,6 +72,8 @@ public:
virtual bool DefaultCheckMemPool() const { return false; }
/* Allow mining of a min-difficulty block */
virtual bool AllowMinDifficultyBlocks() const { return false; }
+ /* Make standard checks */
+ virtual bool RequireStandard() const { return true; }
const string& DataDir() const { return strDataDir; }
/* Make miner stop after a block is found. In RPC, don't return
* until nGenProcLimit blocks are generated */
diff --git a/src/main.cpp b/src/main.cpp
index 7d0a57657b..2f24beecc6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -833,7 +833,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
// Rather not work on nonstandard transactions (unless -testnet/-regtest)
string reason;
- if (Params().NetworkID() == CChainParams::MAIN && !IsStandardTx(tx, reason))
+ if (Params().RequireStandard() && !IsStandardTx(tx, reason))
return state.DoS(0,
error("AcceptToMemoryPool : nonstandard transaction: %s", reason),
REJECT_NONSTANDARD, reason);
@@ -894,7 +894,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
}
// Check for non-standard pay-to-script-hash in inputs
- if (Params().NetworkID() == CChainParams::MAIN && !AreInputsStandard(tx, view))
+ if (Params().RequireStandard() && !AreInputsStandard(tx, view))
return error("AcceptToMemoryPool: : nonstandard transaction input");
// Note: if you modify this code to accept non-standard transactions, then