Merge rust-bitcoin/rust-bitcoin#4229: feature: introduce MAX_BLOCK_SERIALIZED_SIZE to check limit
e4513bf925
feat: add MAX_BLOCK_SERIALIZED_SIZE existing in core (ChrisCho-H) Pull request description: fad0d9ea2d1e807806fa141238e279fddea6ae99: add `MAX_BLOCK_SERIALIZED_SIZE` as constant, which also exists in [bitcoin-core](59ff17e5af/src/consensus/consensus.h (L13)
). I originally thought it would be better to use this value for checking limit of push_bytes [here](0870cd1660/bitcoin/src/blockdata/script/push_bytes.rs (L31)
), as it's the actual limit(`OP_PUSHDATA4` semantic says it could allow up to 4GB though). However, I'm not sure whether there might be need to push_bytes larger than `MAX_BLOCK_SERIALIZED_SIZE`, so just let developer use this constant to check the actual limit rather than enforcing it. ACKs for top commit: tcharding: ACKe4513bf925
apoelstra: ACK e4513bf9250799bc18a10728af184d6c86a561a4; successfully ran local tests Tree-SHA512: 44c5a4882666ad286c1e1c40b9738929e2a8ad4bb44aaf48865fc395291185ae5aae351d26ac9334671e47a11e844bd037bd251a921b6b028a116d1b442b9183
This commit is contained in:
commit
b18aa6f9d4
|
@ -52,6 +52,8 @@ pub const SUBSIDY_HALVING_INTERVAL: u32 = 210_000;
|
|||
pub const MAX_SCRIPTNUM_VALUE: u32 = 0x80000000; // 2^31
|
||||
/// Number of blocks needed for an output from a coinbase transaction to be spendable.
|
||||
pub const COINBASE_MATURITY: u32 = 100;
|
||||
/// The maximum allowed size for a serialized block, in bytes (only for buffer size limits)
|
||||
pub const MAX_BLOCK_SERIALIZED_SIZE: usize = 4_000_000;
|
||||
|
||||
// This is the 65 byte (uncompressed) pubkey used as the one-and-only output of the genesis transaction.
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue