Rename MAX_TX_SIZE to MAX_TX_SIZE_AFTER_SAPLING
This commit is contained in:
parent
ddcee7e13a
commit
25fee3509a
|
@ -24,7 +24,7 @@ static const unsigned int MAX_BLOCK_SIZE = 2000000;
|
||||||
static const unsigned int MAX_BLOCK_SIGOPS = 20000;
|
static const unsigned int MAX_BLOCK_SIGOPS = 20000;
|
||||||
/** The maximum size of a transaction (network rule) */
|
/** The maximum size of a transaction (network rule) */
|
||||||
static const unsigned int MAX_TX_SIZE_BEFORE_SAPLING = 100000;
|
static const unsigned int MAX_TX_SIZE_BEFORE_SAPLING = 100000;
|
||||||
static const unsigned int MAX_TX_SIZE = MAX_BLOCK_SIZE;
|
static const unsigned int MAX_TX_SIZE_AFTER_SAPLING = MAX_BLOCK_SIZE;
|
||||||
/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
|
/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
|
||||||
static const int COINBASE_MATURITY = 100;
|
static const int COINBASE_MATURITY = 100;
|
||||||
/** The minimum value which is invalid for expiry height, used by CTransaction and CMutableTransaction */
|
/** The minimum value which is invalid for expiry height, used by CTransaction and CMutableTransaction */
|
||||||
|
|
|
@ -1060,8 +1060,9 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio
|
||||||
REJECT_INVALID, "bad-txns-vout-empty");
|
REJECT_INVALID, "bad-txns-vout-empty");
|
||||||
|
|
||||||
// Size limits
|
// Size limits
|
||||||
BOOST_STATIC_ASSERT(MAX_BLOCK_SIZE >= MAX_TX_SIZE); // sanity
|
BOOST_STATIC_ASSERT(MAX_BLOCK_SIZE >= MAX_TX_SIZE_AFTER_SAPLING); // sanity
|
||||||
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) > MAX_TX_SIZE)
|
BOOST_STATIC_ASSERT(MAX_TX_SIZE_AFTER_SAPLING > MAX_TX_SIZE_BEFORE_SAPLING); // sanity
|
||||||
|
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) > MAX_TX_SIZE_AFTER_SAPLING)
|
||||||
return state.DoS(100, error("CheckTransaction(): size limits failed"),
|
return state.DoS(100, error("CheckTransaction(): size limits failed"),
|
||||||
REJECT_INVALID, "bad-txns-oversize");
|
REJECT_INVALID, "bad-txns-oversize");
|
||||||
|
|
||||||
|
|
|
@ -3490,7 +3490,7 @@ UniValue z_getoperationstatus_IMPL(const UniValue& params, bool fRemoveFinishedO
|
||||||
// For now though, we assume we use one joinsplit per zaddr output (and the second output note is change).
|
// For now though, we assume we use one joinsplit per zaddr output (and the second output note is change).
|
||||||
// We reduce the result by 1 to ensure there is room for non-joinsplit CTransaction data.
|
// We reduce the result by 1 to ensure there is room for non-joinsplit CTransaction data.
|
||||||
#define Z_SENDMANY_MAX_ZADDR_OUTPUTS_BEFORE_SAPLING ((MAX_TX_SIZE_BEFORE_SAPLING / GetSerializeSize(JSDescription(), SER_NETWORK, PROTOCOL_VERSION)) - 1)
|
#define Z_SENDMANY_MAX_ZADDR_OUTPUTS_BEFORE_SAPLING ((MAX_TX_SIZE_BEFORE_SAPLING / GetSerializeSize(JSDescription(), SER_NETWORK, PROTOCOL_VERSION)) - 1)
|
||||||
#define Z_SENDMANY_MAX_ZADDR_OUTPUTS ((MAX_TX_SIZE / GetSerializeSize(JSDescription(), SER_NETWORK, PROTOCOL_VERSION)) - 1)
|
#define Z_SENDMANY_MAX_ZADDR_OUTPUTS ((MAX_TX_SIZE_AFTER_SAPLING / GetSerializeSize(JSDescription(), SER_NETWORK, PROTOCOL_VERSION)) - 1)
|
||||||
|
|
||||||
// transaction.h comment: spending taddr output requires CTxIn >= 148 bytes and typical taddr txout is 34 bytes
|
// transaction.h comment: spending taddr output requires CTxIn >= 148 bytes and typical taddr txout is 34 bytes
|
||||||
#define CTXIN_SPEND_DUST_SIZE 148
|
#define CTXIN_SPEND_DUST_SIZE 148
|
||||||
|
@ -3623,7 +3623,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
|
||||||
|
|
||||||
int nextBlockHeight = chainActive.Height() + 1;
|
int nextBlockHeight = chainActive.Height() + 1;
|
||||||
size_t max_zaddr_outputs = Z_SENDMANY_MAX_ZADDR_OUTPUTS;
|
size_t max_zaddr_outputs = Z_SENDMANY_MAX_ZADDR_OUTPUTS;
|
||||||
unsigned int max_tx_size = MAX_TX_SIZE;
|
unsigned int max_tx_size = MAX_TX_SIZE_AFTER_SAPLING;
|
||||||
if (!NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
|
if (!NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
|
||||||
max_zaddr_outputs = Z_SENDMANY_MAX_ZADDR_OUTPUTS_BEFORE_SAPLING;
|
max_zaddr_outputs = Z_SENDMANY_MAX_ZADDR_OUTPUTS_BEFORE_SAPLING;
|
||||||
max_tx_size = MAX_TX_SIZE_BEFORE_SAPLING;
|
max_tx_size = MAX_TX_SIZE_BEFORE_SAPLING;
|
||||||
|
@ -3733,7 +3733,7 @@ UniValue z_shieldcoinbase(const UniValue& params, bool fHelp)
|
||||||
"\nby the caller. If the limit parameter is set to zero, and Overwinter is not yet active, the -mempooltxinputlimit"
|
"\nby the caller. If the limit parameter is set to zero, and Overwinter is not yet active, the -mempooltxinputlimit"
|
||||||
"\noption will determine the number of uxtos. Any limit is constrained by the consensus rule defining a maximum"
|
"\noption will determine the number of uxtos. Any limit is constrained by the consensus rule defining a maximum"
|
||||||
"\ntransaction size of "
|
"\ntransaction size of "
|
||||||
+ strprintf("%d bytes before Sapling, and %d bytes once Sapling activates.", MAX_TX_SIZE_BEFORE_SAPLING, MAX_TX_SIZE)
|
+ strprintf("%d bytes before Sapling, and %d bytes once Sapling activates.", MAX_TX_SIZE_BEFORE_SAPLING, MAX_TX_SIZE_AFTER_SAPLING)
|
||||||
+ HelpRequiringPassphrase() + "\n"
|
+ HelpRequiringPassphrase() + "\n"
|
||||||
"\nArguments:\n"
|
"\nArguments:\n"
|
||||||
"1. \"fromaddress\" (string, required) The address is a taddr or \"*\" for all taddrs belonging to the wallet.\n"
|
"1. \"fromaddress\" (string, required) The address is a taddr or \"*\" for all taddrs belonging to the wallet.\n"
|
||||||
|
@ -3797,7 +3797,7 @@ UniValue z_shieldcoinbase(const UniValue& params, bool fHelp)
|
||||||
|
|
||||||
int nextBlockHeight = chainActive.Height() + 1;
|
int nextBlockHeight = chainActive.Height() + 1;
|
||||||
bool overwinterActive = NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER);
|
bool overwinterActive = NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER);
|
||||||
unsigned int max_tx_size = MAX_TX_SIZE;
|
unsigned int max_tx_size = MAX_TX_SIZE_AFTER_SAPLING;
|
||||||
if (!NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
|
if (!NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
|
||||||
max_tx_size = MAX_TX_SIZE_BEFORE_SAPLING;
|
max_tx_size = MAX_TX_SIZE_BEFORE_SAPLING;
|
||||||
}
|
}
|
||||||
|
@ -3940,7 +3940,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp)
|
||||||
"\n\nThe number of UTXOs and notes selected for merging can be limited by the caller. If the transparent limit"
|
"\n\nThe number of UTXOs and notes selected for merging can be limited by the caller. If the transparent limit"
|
||||||
"\nparameter is set to zero, and Overwinter is not yet active, the -mempooltxinputlimit option will determine the"
|
"\nparameter is set to zero, and Overwinter is not yet active, the -mempooltxinputlimit option will determine the"
|
||||||
"\nnumber of UTXOs. Any limit is constrained by the consensus rule defining a maximum transaction size of "
|
"\nnumber of UTXOs. Any limit is constrained by the consensus rule defining a maximum transaction size of "
|
||||||
+ strprintf("%d bytes before Sapling, and %d bytes once Sapling activates.", MAX_TX_SIZE_BEFORE_SAPLING, MAX_TX_SIZE)
|
+ strprintf("%d bytes before Sapling, and %d bytes once Sapling activates.", MAX_TX_SIZE_BEFORE_SAPLING, MAX_TX_SIZE_AFTER_SAPLING)
|
||||||
+ HelpRequiringPassphrase() + "\n"
|
+ HelpRequiringPassphrase() + "\n"
|
||||||
"\nArguments:\n"
|
"\nArguments:\n"
|
||||||
"1. fromaddresses (string, required) A JSON array with addresses.\n"
|
"1. fromaddresses (string, required) A JSON array with addresses.\n"
|
||||||
|
@ -4093,7 +4093,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp)
|
||||||
|
|
||||||
int nextBlockHeight = chainActive.Height() + 1;
|
int nextBlockHeight = chainActive.Height() + 1;
|
||||||
bool overwinterActive = NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER);
|
bool overwinterActive = NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER);
|
||||||
unsigned int max_tx_size = MAX_TX_SIZE;
|
unsigned int max_tx_size = MAX_TX_SIZE_AFTER_SAPLING;
|
||||||
if (!NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
|
if (!NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
|
||||||
max_tx_size = MAX_TX_SIZE_BEFORE_SAPLING;
|
max_tx_size = MAX_TX_SIZE_BEFORE_SAPLING;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2590,7 +2590,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int max_tx_size = MAX_TX_SIZE;
|
unsigned int max_tx_size = MAX_TX_SIZE_AFTER_SAPLING;
|
||||||
if (!NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
|
if (!NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
|
||||||
max_tx_size = MAX_TX_SIZE_BEFORE_SAPLING;
|
max_tx_size = MAX_TX_SIZE_BEFORE_SAPLING;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue