Skip to content

Commit

Permalink
New constant MAX_STANDARD_SHIELDED_TX_SIZE defined for sapling txes s…
Browse files Browse the repository at this point in the history
…tandard-ness checks inside IsStandardTx.
  • Loading branch information
furszy committed Oct 28, 2020
1 parent 31a8fed commit a3c4d2d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/policy/policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason)
// computing signature hashes is O(ninputs*txsize). Limiting transactions
// to MAX_STANDARD_TX_SIZE mitigates CPU exhaustion attacks.
unsigned int sz = GetSerializeSize(tx, SER_NETWORK, CTransaction::CURRENT_VERSION);
unsigned int nMaxSize = tx.ContainsZerocoins() ? MAX_ZEROCOIN_TX_SIZE : MAX_STANDARD_TX_SIZE;
unsigned int nMaxSize = tx.hasSaplingData() ? MAX_STANDARD_SHIELDED_TX_SIZE :
tx.ContainsZerocoins() ? MAX_ZEROCOIN_TX_SIZE : MAX_STANDARD_TX_SIZE;
if (sz >= nMaxSize) {
reason = "tx-size";
return false;
Expand Down
1 change: 1 addition & 0 deletions src/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ static const unsigned int DEFAULT_LIMITFREERELAY = 30;
/** 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_ZEROCOIN_TX_SIZE = 150000;
static const unsigned int MAX_STANDARD_SHIELDED_TX_SIZE = MAX_TX_SIZE_AFTER_SAPLING;
/** Default for -checkblocks */
static const signed int DEFAULT_CHECKBLOCKS = 10;
/** The maximum size of a blk?????.dat file (since 0.8) */
Expand Down

0 comments on commit a3c4d2d

Please sign in to comment.