Add a max scriptnum constant
Integers within Script can have a maximum value of 2^31 (i.e., they are signed) but we (miniscript) often uses unsigned ints, to facilitate checking the unsigned type is the correct size to fit in a signed int add a const `MAX_SCRIPTNUM_VALUE`.
This commit is contained in:
parent
7a346970d0
commit
1390ee12ec
|
@ -53,6 +53,8 @@ pub const SCRIPT_ADDRESS_PREFIX_TEST: u8 = 196; // 0xc4
|
||||||
pub const MAX_SCRIPT_ELEMENT_SIZE: usize = 520;
|
pub const MAX_SCRIPT_ELEMENT_SIZE: usize = 520;
|
||||||
/// How may blocks between halvings.
|
/// How may blocks between halvings.
|
||||||
pub const SUBSIDY_HALVING_INTERVAL: u32 = 210_000;
|
pub const SUBSIDY_HALVING_INTERVAL: u32 = 210_000;
|
||||||
|
/// Maximum allowed value for an integer in Script.
|
||||||
|
pub const MAX_SCRIPTNUM_VALUE: u32 = 0x80000000; // 2^31
|
||||||
|
|
||||||
/// In Bitcoind this is insanely described as ~((u256)0 >> 32)
|
/// In Bitcoind this is insanely described as ~((u256)0 >> 32)
|
||||||
pub fn max_target(_: Network) -> Uint256 {
|
pub fn max_target(_: Network) -> Uint256 {
|
||||||
|
|
Loading…
Reference in New Issue