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

Function featurebits

tests/test_connection.py:5204–5212  ·  view source on GitHub ↗

Encode feature bits BOLT-style: big-endian, bit 0 is the last byte's LSB.

(*bits)

Source from the content-addressed store, hash-verified

5202
5203
5204def featurebits(*bits):
5205 """Encode feature bits BOLT-style: big-endian, bit 0 is the last byte's LSB."""
5206 if not bits:
5207 return b''
5208 nbytes = max(bits) // 8 + 1
5209 arr = bytearray(nbytes)
5210 for b in bits:
5211 arr[nbytes - 1 - b // 8] |= 1 << (b % 8)
5212 return bytes(arr)
5213
5214
5215def feature_offered(bits, b):

Callers 1

raw_peer_connectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected