Reduce MIN_STANDARD_TX_SIZE to 83 bytes (#4668)

P2SH output is 2 bytes smaller than P2PKH
This commit is contained in:
UdjinM6 2022-01-20 19:05:34 +03:00 committed by GitHub
parent f3cd4046c9
commit 8087038951
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -22,8 +22,8 @@ static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 2000000;
static const unsigned int DEFAULT_BLOCK_MIN_TX_FEE = 1000; static const unsigned int DEFAULT_BLOCK_MIN_TX_FEE = 1000;
/** The maximum size for transactions we're willing to relay/mine */ /** The maximum size for transactions we're willing to relay/mine */
static const unsigned int MAX_STANDARD_TX_SIZE = 100000; static const unsigned int MAX_STANDARD_TX_SIZE = 100000;
/** The minimum size for transactions we're willing to relay/mine (1 empty scriptSig input + 1 P2PKH output = 85 bytes) */ /** The minimum size for transactions we're willing to relay/mine (1 empty scriptSig input + 1 P2SH output = 83 bytes) */
static const unsigned int MIN_STANDARD_TX_SIZE = 85; static const unsigned int MIN_STANDARD_TX_SIZE = 83;
/** Maximum number of signature check operations in an IsStandard() P2SH script */ /** Maximum number of signature check operations in an IsStandard() P2SH script */
static const unsigned int MAX_P2SH_SIGOPS = 15; static const unsigned int MAX_P2SH_SIGOPS = 15;
/** The maximum number of sigops we're willing to relay/mine in a single tx */ /** The maximum number of sigops we're willing to relay/mine in a single tx */

View File

@ -551,7 +551,7 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
return state.DoS(0, false, REJECT_NONSTANDARD, reason); return state.DoS(0, false, REJECT_NONSTANDARD, reason);
// Do not work on transactions that are too small. // Do not work on transactions that are too small.
// A transaction with 1 empty scriptSig input and 1 P2PKH output has size of 85 bytes. // A transaction with 1 empty scriptSig input and 1 P2SH output has size of 83 bytes.
// Transactions smaller than this are not relayed to reduce unnecessary malloc overhead. // Transactions smaller than this are not relayed to reduce unnecessary malloc overhead.
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) < MIN_STANDARD_TX_SIZE) if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) < MIN_STANDARD_TX_SIZE)
return state.DoS(0, false, REJECT_NONSTANDARD, "tx-size-small"); return state.DoS(0, false, REJECT_NONSTANDARD, "tx-size-small");