aboutsummaryrefslogtreecommitdiff
path: root/src/policy/policy.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-08-10 09:22:42 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-08-10 09:22:49 +0200
commitedc2c700a75c70e1cceb4728b610b37d1c36a6aa (patch)
tree016594a0058008f982b29647bb751c2567f6f164 /src/policy/policy.cpp
parent114f7e944b1cdc5f4c195d43be4d2feb729c6311 (diff)
parent3f65ba2b3bd6c4e269f8f89b16d386b443431693 (diff)
downloadbitcoin-edc2c700a75c70e1cceb4728b610b37d1c36a6aa.tar.xz
Merge #8438: [0.13] backport: Treat high-sigop transactions as larger rather than rejecting them
3f65ba2 Treat high-sigop transactions as larger rather than rejecting them (Pieter Wuille)
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 57df1f0b19..48080abc77 100644
--- a/src/policy/policy.cpp
+++ b/src/policy/policy.cpp
@@ -154,12 +154,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);
}