aboutsummaryrefslogtreecommitdiff
path: root/src/policy/policy.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-07-18 20:57:20 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2016-07-19 12:31:49 +0200
commitab942c15bd3854650afa810d7c22d7fd30d346c1 (patch)
treeb1b4aeac333ab2f3b3b21a31d614e1674e0774f3 /src/policy/policy.cpp
parent045106b4f13c1d6f3a4f65d6dddc6ac1e15003bb (diff)
Treat high-sigop transactions as larger rather than rejecting them
Diffstat (limited to 'src/policy/policy.cpp')
-rw-r--r--src/policy/policy.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp
index 8617db00c8..0cd3ac7119 100644
--- a/src/policy/policy.cpp
+++ b/src/policy/policy.cpp
@@ -151,12 +151,14 @@ bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs)
return true;
}
-int64_t GetVirtualTransactionSize(int64_t nWeight)
+unsigned int nBytesPerSigOp = DEFAULT_BYTES_PER_SIGOP;
+
+int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost)
{
- return (nWeight + WITNESS_SCALE_FACTOR - 1) / WITNESS_SCALE_FACTOR;
+ return (std::max(nWeight, nSigOpCost * nBytesPerSigOp) + WITNESS_SCALE_FACTOR - 1) / WITNESS_SCALE_FACTOR;
}
-int64_t GetVirtualTransactionSize(const CTransaction& tx)
+int64_t GetVirtualTransactionSize(const CTransaction& tx, int64_t nSigOpCost)
{
- return GetVirtualTransactionSize(GetTransactionWeight(tx));
+ return GetVirtualTransactionSize(GetTransactionWeight(tx), nSigOpCost);
}