From 56f98e00a02dab780341b77453169b272e3cea00 Mon Sep 17 00:00:00 2001 From: "John L. Jegutanis" Date: Thu, 23 May 2019 21:29:08 +0300 Subject: [PATCH] Changed constants from `static` to `const` and added 2 new constants --- src/blockdata/constants.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/blockdata/constants.rs b/src/blockdata/constants.rs index 8d86b49..7bf0b6d 100644 --- a/src/blockdata/constants.rs +++ b/src/blockdata/constants.rs @@ -30,15 +30,20 @@ use util::misc::hex_bytes; use util::uint::Uint256; /// The maximum allowable sequence number -pub static MAX_SEQUENCE: u32 = 0xFFFFFFFF; +pub const MAX_SEQUENCE: u32 = 0xFFFFFFFF; /// How many satoshis are in "one bitcoin" -pub static COIN_VALUE: u64 = 100_000_000; +pub const COIN_VALUE: u64 = 100_000_000; /// How many seconds between blocks we expect on average -pub static TARGET_BLOCK_SPACING: u32 = 600; +pub const TARGET_BLOCK_SPACING: u32 = 600; /// How many blocks between diffchanges -pub static DIFFCHANGE_INTERVAL: u32 = 2016; +pub const DIFFCHANGE_INTERVAL: u32 = 2016; /// How much time on average should occur between diffchanges -pub static DIFFCHANGE_TIMESPAN: u32 = 14 * 24 * 3600; +pub const DIFFCHANGE_TIMESPAN: u32 = 14 * 24 * 3600; +/// The maximum allowed weight for a block, see BIP 141 (network rule) +pub const MAX_BLOCK_WEIGHT: u32 = 4_000_000; +/// The minimum transaction weight for a valid serialized transaction +pub const MIN_TRANSACTION_WEIGHT: u32 = 4 * 60; + /// In Bitcoind this is insanely described as ~((u256)0 >> 32) pub fn max_target(_: Network) -> Uint256 {