bitcoin-utils: fix encoding of CompactSize integers

Encoding an atom as a Compact fails when a = 0: a 4-byte CompactSize is
emitted.
This commit is contained in:
dasrun-fadben 2021-12-16 12:37:51 -07:00
parent fee929ec33
commit d66de5b486

View File

@ -143,6 +143,7 @@
|= a=@
^- hexb
=/ l=@ (met 3 a)
?: =(l 0) 1^a
?: =(l 1) 1^a
?: =(l 2) (cat:byt ~[1^0xfd (flip:byt 2^a)])
?: (lte l 4) (cat:byt ~[1^0xfe (flip:byt 4^a)])