diff --git a/bip-0119.mediawiki b/bip-0119.mediawiki index 99a91501..c2d9912a 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("