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

Function open_channel2

tests/test_opening.py:3696–3709  ·  view source on GitHub ↗
(index, chain_hash)

Source from the content-addressed store, hash-verified

3694 return CCPrivateKey(index.to_bytes(32, "big")).public_key.format(compressed=True)
3695
3696 def open_channel2(index, chain_hash):
3697 keys = [pubkey(index * 7 + offset + 1) for offset in range(7)]
3698 temporary_channel_id = hashlib.sha256(bytes(33) + keys[1]).digest()
3699 fixed = b"".join([
3700 struct.pack(">H", 64), # type: open_channel2
3701 chain_hash,
3702 temporary_channel_id,
3703 struct.pack(">IIQQQQHHI", 253, 253, 100_000, 546,
3704 100_000_000, 0, 6, 30, 0),
3705 *keys,
3706 b"\x00", # channel_flags
3707 ])
3708 # opening_tlvs: type 1 channel_type = static_remotekey + anchors.
3709 return temporary_channel_id, fixed + bytes.fromhex("0103401000")
3710
3711 class SocketConn:
3712 def __init__(self, host, port):

Callers 1

Calls 3

digestMethod · 0.80
joinMethod · 0.80
pubkeyFunction · 0.70

Tested by

no test coverage detected