From aa1871b149b96e5d355df4253526231e006d313b Mon Sep 17 00:00:00 2001 From: Jeremy Rubin Date: Tue, 10 May 2022 08:45:03 -0700 Subject: [BIP-119] Make serialization specification complete, defining all functions fully --- bip-0119.mediawiki | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'bip-0119.mediawiki') diff --git a/bip-0119.mediawiki b/bip-0119.mediawiki index 99a9150..c2d9912 100644 --- a/bip-0119.mediawiki +++ b/bip-0119.mediawiki @@ -212,6 +212,34 @@ including hashes of the scriptsigs, sequences, and outputs. See the section optimization. + +def ser_compact_size(l): + r = b"" + if l < 253: + # Serialize as unsigned char + r = struct.pack("B", l) + elif l < 0x10000: + # Serialize as unsigned char 253 followed by unsigned 2 byte integer (little endian) + r = struct.pack(" -- cgit v1.2.3