mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-23 15:20:49 +01:00
Merge bitcoin/bitcoin#30024: doc: replace remaining "520" magic nums with MAX_SCRIPT_ELEMENT_SIZE
ffc674595c
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: ACKffc674595c
sipa: ACKffc674595c
achow101: ACKffc674595c
glozow: ACKffc674595c
, agree it's clearer for these comments to refer to the greppable name of the limit rather than the number Tree-SHA512: 462afc1c64543877ac58cb3acdb01d42c6d08abfb362802f29f3482d75401a2a8adadbc2facd222a9a9fefcaab6854865ea400f50ad60bec17831d29f7798afe
This commit is contained in:
commit
f5b6f621ff
4 changed files with 4 additions and 4 deletions
|
@ -5197,7 +5197,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||||
std::vector<unsigned char> vData;
|
std::vector<unsigned char> vData;
|
||||||
vRecv >> vData;
|
vRecv >> vData;
|
||||||
|
|
||||||
// Nodes must NEVER send a data item > 520 bytes (the max size for a script data object,
|
// Nodes must NEVER send a data item > MAX_SCRIPT_ELEMENT_SIZE bytes (the max size for a script data object,
|
||||||
// and thus, the maximum size any matched object can have) in a filteradd message
|
// and thus, the maximum size any matched object can have) in a filteradd message
|
||||||
bool bad = false;
|
bool bad = false;
|
||||||
if (vData.size() > MAX_SCRIPT_ELEMENT_SIZE) {
|
if (vData.size() > MAX_SCRIPT_ELEMENT_SIZE) {
|
||||||
|
|
|
@ -85,7 +85,7 @@ CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore,
|
||||||
{
|
{
|
||||||
// Add script to keystore
|
// Add script to keystore
|
||||||
keystore.AddCScript(script);
|
keystore.AddCScript(script);
|
||||||
// Note that scripts over 520 bytes are not yet supported.
|
// Note that scripts over MAX_SCRIPT_ELEMENT_SIZE bytes are not yet supported.
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case OutputType::LEGACY:
|
case OutputType::LEGACY:
|
||||||
return ScriptHash(script);
|
return ScriptHash(script);
|
||||||
|
|
|
@ -111,7 +111,7 @@ bool IsStandardTx(const CTransaction& tx, const std::optional<unsigned>& max_dat
|
||||||
for (const CTxIn& txin : tx.vin)
|
for (const CTxIn& txin : tx.vin)
|
||||||
{
|
{
|
||||||
// Biggest 'standard' txin involving only keys is a 15-of-15 P2SH
|
// Biggest 'standard' txin involving only keys is a 15-of-15 P2SH
|
||||||
// multisig with compressed keys (remember the 520 byte limit on
|
// multisig with compressed keys (remember the MAX_SCRIPT_ELEMENT_SIZE byte limit on
|
||||||
// redeemScript size). That works out to a (15*(33+1))+3=513 byte
|
// redeemScript size). That works out to a (15*(33+1))+3=513 byte
|
||||||
// redeemScript, 513+1+15*(73+1)+3=1627 bytes of scriptSig, which
|
// redeemScript, 513+1+15*(73+1)+3=1627 bytes of scriptSig, which
|
||||||
// we round off to 1650(MAX_STANDARD_SCRIPTSIG_SIZE) bytes for
|
// we round off to 1650(MAX_STANDARD_SCRIPTSIG_SIZE) bytes for
|
||||||
|
|
|
@ -1054,7 +1054,7 @@ class SegWitTest(BitcoinTestFramework):
|
||||||
|
|
||||||
@subtest
|
@subtest
|
||||||
def test_max_witness_push_length(self):
|
def test_max_witness_push_length(self):
|
||||||
"""Test that witness stack can only allow up to 520 byte pushes."""
|
"""Test that witness stack can only allow up to MAX_SCRIPT_ELEMENT_SIZE byte pushes."""
|
||||||
|
|
||||||
block = self.build_next_block()
|
block = self.build_next_block()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue