MCPcopy Create free account
hub / github.com/ElementsProject/lightning / write_bignum

Function write_bignum

tests/utils.py:518–529  ·  view source on GitHub ↗
(outf, val)

Source from the content-addressed store, hash-verified

516 nodes = []
517
518 def write_bignum(outf, val):
519 if val < 253:
520 outf.write(val.to_bytes(1, byteorder='big'))
521 elif val <= 0xFFFF:
522 outf.write(b'\xFD')
523 outf.write(val.to_bytes(2, byteorder='big'))
524 elif val <= 0xFFFFFFFF:
525 outf.write(b'\xFE')
526 outf.write(val.to_bytes(4, byteorder='big'))
527 else:
528 outf.write(b'\xFF')
529 outf.write(val.to_bytes(8, byteorder='big'))
530
531 def write_dumb_template(outf, channels, propname, illegalvals=[]):
532 """We don't bother uniquifing, just one entry per chan dir"""

Callers 2

write_dumb_templateFunction · 0.85
generate_gossip_storeFunction · 0.85

Calls 2

writeMethod · 0.45
to_bytesMethod · 0.45

Tested by

no test coverage detected