diff --git a/src/policy/policy.h b/src/policy/policy.h --- a/src/policy/policy.h +++ b/src/policy/policy.h @@ -62,7 +62,8 @@ /** * Default for -bytespersigop . */ -static const unsigned int DEFAULT_BYTES_PER_SIGOP = 20; +static const unsigned int DEFAULT_BYTES_PER_SIGOP = + 1000000 / MAX_BLOCK_SIGOPS_PER_MB; /** * Min feerate for defining dust. Historically this has been the same as the * minRelayTxFee, however changing the dust limit changes which transactions are @@ -122,7 +123,10 @@ extern CFeeRate dustRelayFee; extern uint32_t nBytesPerSigOp; -/** Compute the virtual transaction size (weight reinterpreted as bytes). */ +/** + * Compute the virtual transaction size (size, or more if sigops are too + * dense). + */ int64_t GetVirtualTransactionSize(int64_t nSize, int64_t nSigOpCount, unsigned int bytes_per_sigop); int64_t GetVirtualTransactionSize(const CTransaction &tx, int64_t nSigOpCount, @@ -130,4 +134,9 @@ int64_t GetVirtualTransactionInputSize(const CTxIn &txin, int64_t nSigOpCount, unsigned int bytes_per_sigop); +static inline int64_t GetVirtualTransactionSize(int64_t nSize, + int64_t nSigOpCount) { + return GetVirtualTransactionSize(nSize, nSigOpCount, ::nBytesPerSigOp); +} + #endif // BITCOIN_POLICY_POLICY_H diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -182,7 +182,7 @@ int64_t GetVirtualTransactionSize(int64_t nSize, int64_t nSigOpCount, unsigned int bytes_per_sigop) { - return nSize; + return std::max(nSize, nSigOpCount * bytes_per_sigop); } int64_t GetVirtualTransactionSize(const CTransaction &tx, int64_t nSigOpCount,