Skip to content

Commit f5b6f62

Browse files
committed
Merge bitcoin#30024: doc: replace remaining "520" magic nums with MAX_SCRIPT_ELEMENT_SIZE
ffc6745 Replace remaining "520" magic numbers with MAX_SCRIPT_ELEMENT_SIZE (Jon Atack) Pull request description: Noticed these while reviewing BIPs yesterday. It would be clearer and more future-proof to refer to their constant name. ACKs for top commit: instagibbs: ACK ffc6745 sipa: ACK ffc6745 achow101: ACK ffc6745 glozow: ACK ffc6745, agree it's clearer for these comments to refer to the greppable name of the limit rather than the number Tree-SHA512: 462afc1c64543877ac58cb3acdb01d42c6d08abfb362802f29f3482d75401a2a8adadbc2facd222a9a9fefcaab6854865ea400f50ad60bec17831d29f7798afe
2 parents f9486de + ffc6745 commit f5b6f62

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/net_processing.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5197,7 +5197,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
51975197
std::vector<unsigned char> vData;
51985198
vRecv >> vData;
51995199

5200-
// Nodes must NEVER send a data item > 520 bytes (the max size for a script data object,
5200+
// Nodes must NEVER send a data item > MAX_SCRIPT_ELEMENT_SIZE bytes (the max size for a script data object,
52015201
// and thus, the maximum size any matched object can have) in a filteradd message
52025202
bool bad = false;
52035203
if (vData.size() > MAX_SCRIPT_ELEMENT_SIZE) {

src/outputtype.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore,
8585
{
8686
// Add script to keystore
8787
keystore.AddCScript(script);
88-
// Note that scripts over 520 bytes are not yet supported.
88+
// Note that scripts over MAX_SCRIPT_ELEMENT_SIZE bytes are not yet supported.
8989
switch (type) {
9090
case OutputType::LEGACY:
9191
return ScriptHash(script);

src/policy/policy.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ bool IsStandardTx(const CTransaction& tx, const std::optional<unsigned>& max_dat
111111
for (const CTxIn& txin : tx.vin)
112112
{
113113
// Biggest 'standard' txin involving only keys is a 15-of-15 P2SH
114-
// multisig with compressed keys (remember the 520 byte limit on
114+
// multisig with compressed keys (remember the MAX_SCRIPT_ELEMENT_SIZE byte limit on
115115
// redeemScript size). That works out to a (15*(33+1))+3=513 byte
116116
// redeemScript, 513+1+15*(73+1)+3=1627 bytes of scriptSig, which
117117
// we round off to 1650(MAX_STANDARD_SCRIPTSIG_SIZE) bytes for

test/functional/p2p_segwit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ def test_extra_witness_data(self):
10541054

10551055
@subtest
10561056
def test_max_witness_push_length(self):
1057-
"""Test that witness stack can only allow up to 520 byte pushes."""
1057+
"""Test that witness stack can only allow up to MAX_SCRIPT_ELEMENT_SIZE byte pushes."""
10581058

10591059
block = self.build_next_block()
10601060

0 commit comments

Comments
 (0)