Skip to content

Commit 42fc48f

Browse files
committed
new modules: pyln.proto.message.{bolt1,bolt2,bolt4,bolt7}
These are autogenerated, but now they export their own MessageNamespace, as well as the raw csv. They also expose their SubtypeTypes, MessageTypes and TlvStreamTypes, though in theory these could clash (they don't for now, and it'd be kinda awkward if they did). Signed-off-by: Rusty Russell <[email protected]>
1 parent a4eb933 commit 42fc48f

File tree

25 files changed

+439
-325
lines changed

25 files changed

+439
-325
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#! /usr/bin/make
2+
3+
refresh:
4+
for d in bolt*; do $(MAKE) -C $$d; done
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /usr/bin/make
2+
3+
SPECDIR := ../../../../../../../lightning-rfc
4+
5+
csv.py: $(SPECDIR)/01-messaging.md Makefile
6+
SPECNUM=`basename $< | sed 's/-.*//'`; (echo csv = '['; python3 $(SPECDIR)/tools/extract-formats.py $< | sed 's/\(.*\)/ "\1",/'; echo ']') > $@
7+
chmod a+x $@
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from .csv import csv
2+
from .bolt import namespace
3+
import sys
4+
5+
__version__ = '0.0.1'
6+
7+
__all__ = [
8+
'csv',
9+
'namespace',
10+
]
11+
12+
mod = sys.modules[__name__]
13+
for d in namespace.subtypes, namespace.tlvtypes, namespace.messagetypes:
14+
for name in d:
15+
setattr(mod, name, d[name])
16+
__all__.append(name)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from pyln.proto.message import MessageNamespace
2+
from .csv import csv
3+
4+
5+
namespace = MessageNamespace(csv_lines=csv)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
csv = [
2+
"msgtype,init,16",
3+
"msgdata,init,gflen,u16,",
4+
"msgdata,init,globalfeatures,byte,gflen",
5+
"msgdata,init,flen,u16,",
6+
"msgdata,init,features,byte,flen",
7+
"msgdata,init,tlvs,init_tlvs,",
8+
"tlvtype,init_tlvs,networks,1",
9+
"tlvdata,init_tlvs,networks,chains,chain_hash,...",
10+
"msgtype,error,17",
11+
"msgdata,error,channel_id,channel_id,",
12+
"msgdata,error,len,u16,",
13+
"msgdata,error,data,byte,len",
14+
"msgtype,ping,18",
15+
"msgdata,ping,num_pong_bytes,u16,",
16+
"msgdata,ping,byteslen,u16,",
17+
"msgdata,ping,ignored,byte,byteslen",
18+
"msgtype,pong,19",
19+
"msgdata,pong,byteslen,u16,",
20+
"msgdata,pong,ignored,byte,byteslen",
21+
"tlvtype,n1,tlv1,1",
22+
"tlvdata,n1,tlv1,amount_msat,tu64,",
23+
"tlvtype,n1,tlv2,2",
24+
"tlvdata,n1,tlv2,scid,short_channel_id,",
25+
"tlvtype,n1,tlv3,3",
26+
"tlvdata,n1,tlv3,node_id,point,",
27+
"tlvdata,n1,tlv3,amount_msat_1,u64,",
28+
"tlvdata,n1,tlv3,amount_msat_2,u64,",
29+
"tlvtype,n1,tlv4,254",
30+
"tlvdata,n1,tlv4,cltv_delta,u16,",
31+
"tlvtype,n2,tlv1,0",
32+
"tlvdata,n2,tlv1,amount_msat,tu64,",
33+
"tlvtype,n2,tlv2,11",
34+
"tlvdata,n2,tlv2,cltv_expiry,tu32,",
35+
]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /usr/bin/make
2+
3+
SPECDIR := ../../../../../../../lightning-rfc
4+
5+
csv.py: $(SPECDIR)/02-peer-protocol.md Makefile
6+
SPECNUM=`basename $< | sed 's/-.*//'`; (echo csv = '['; python3 $(SPECDIR)/tools/extract-formats.py $< | sed 's/\(.*\)/ "\1",/'; echo ']') > $@
7+
chmod a+x $@
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from .csv import csv
2+
from .bolt import namespace
3+
import sys
4+
5+
__version__ = '0.0.1'
6+
7+
__all__ = [
8+
'csv',
9+
'namespace',
10+
]
11+
12+
mod = sys.modules[__name__]
13+
for d in namespace.subtypes, namespace.tlvtypes, namespace.messagetypes:
14+
for name in d:
15+
setattr(mod, name, d[name])
16+
__all__.append(name)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from pyln.proto.message import MessageNamespace
2+
from .csv import csv
3+
4+
5+
namespace = MessageNamespace(csv_lines=csv)
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
csv = [
2+
"msgtype,open_channel,32",
3+
"msgdata,open_channel,chain_hash,chain_hash,",
4+
"msgdata,open_channel,temporary_channel_id,byte,32",
5+
"msgdata,open_channel,funding_satoshis,u64,",
6+
"msgdata,open_channel,push_msat,u64,",
7+
"msgdata,open_channel,dust_limit_satoshis,u64,",
8+
"msgdata,open_channel,max_htlc_value_in_flight_msat,u64,",
9+
"msgdata,open_channel,channel_reserve_satoshis,u64,",
10+
"msgdata,open_channel,htlc_minimum_msat,u64,",
11+
"msgdata,open_channel,feerate_per_kw,u32,",
12+
"msgdata,open_channel,to_self_delay,u16,",
13+
"msgdata,open_channel,max_accepted_htlcs,u16,",
14+
"msgdata,open_channel,funding_pubkey,point,",
15+
"msgdata,open_channel,revocation_basepoint,point,",
16+
"msgdata,open_channel,payment_basepoint,point,",
17+
"msgdata,open_channel,delayed_payment_basepoint,point,",
18+
"msgdata,open_channel,htlc_basepoint,point,",
19+
"msgdata,open_channel,first_per_commitment_point,point,",
20+
"msgdata,open_channel,channel_flags,byte,",
21+
"msgdata,open_channel,tlvs,open_channel_tlvs,",
22+
"tlvtype,open_channel_tlvs,upfront_shutdown_script,0",
23+
"tlvdata,open_channel_tlvs,upfront_shutdown_script,shutdown_scriptpubkey,byte,...",
24+
"msgtype,accept_channel,33",
25+
"msgdata,accept_channel,temporary_channel_id,byte,32",
26+
"msgdata,accept_channel,dust_limit_satoshis,u64,",
27+
"msgdata,accept_channel,max_htlc_value_in_flight_msat,u64,",
28+
"msgdata,accept_channel,channel_reserve_satoshis,u64,",
29+
"msgdata,accept_channel,htlc_minimum_msat,u64,",
30+
"msgdata,accept_channel,minimum_depth,u32,",
31+
"msgdata,accept_channel,to_self_delay,u16,",
32+
"msgdata,accept_channel,max_accepted_htlcs,u16,",
33+
"msgdata,accept_channel,funding_pubkey,point,",
34+
"msgdata,accept_channel,revocation_basepoint,point,",
35+
"msgdata,accept_channel,payment_basepoint,point,",
36+
"msgdata,accept_channel,delayed_payment_basepoint,point,",
37+
"msgdata,accept_channel,htlc_basepoint,point,",
38+
"msgdata,accept_channel,first_per_commitment_point,point,",
39+
"msgdata,accept_channel,tlvs,accept_channel_tlvs,",
40+
"tlvtype,accept_channel_tlvs,upfront_shutdown_script,0",
41+
"tlvdata,accept_channel_tlvs,upfront_shutdown_script,shutdown_scriptpubkey,byte,...",
42+
"msgtype,funding_created,34",
43+
"msgdata,funding_created,temporary_channel_id,byte,32",
44+
"msgdata,funding_created,funding_txid,sha256,",
45+
"msgdata,funding_created,funding_output_index,u16,",
46+
"msgdata,funding_created,signature,signature,",
47+
"msgtype,funding_signed,35",
48+
"msgdata,funding_signed,channel_id,channel_id,",
49+
"msgdata,funding_signed,signature,signature,",
50+
"msgtype,funding_locked,36",
51+
"msgdata,funding_locked,channel_id,channel_id,",
52+
"msgdata,funding_locked,next_per_commitment_point,point,",
53+
"msgtype,shutdown,38",
54+
"msgdata,shutdown,channel_id,channel_id,",
55+
"msgdata,shutdown,len,u16,",
56+
"msgdata,shutdown,scriptpubkey,byte,len",
57+
"msgtype,closing_signed,39",
58+
"msgdata,closing_signed,channel_id,channel_id,",
59+
"msgdata,closing_signed,fee_satoshis,u64,",
60+
"msgdata,closing_signed,signature,signature,",
61+
"msgtype,update_add_htlc,128",
62+
"msgdata,update_add_htlc,channel_id,channel_id,",
63+
"msgdata,update_add_htlc,id,u64,",
64+
"msgdata,update_add_htlc,amount_msat,u64,",
65+
"msgdata,update_add_htlc,payment_hash,sha256,",
66+
"msgdata,update_add_htlc,cltv_expiry,u32,",
67+
"msgdata,update_add_htlc,onion_routing_packet,byte,1366",
68+
"msgtype,update_fulfill_htlc,130",
69+
"msgdata,update_fulfill_htlc,channel_id,channel_id,",
70+
"msgdata,update_fulfill_htlc,id,u64,",
71+
"msgdata,update_fulfill_htlc,payment_preimage,byte,32",
72+
"msgtype,update_fail_htlc,131",
73+
"msgdata,update_fail_htlc,channel_id,channel_id,",
74+
"msgdata,update_fail_htlc,id,u64,",
75+
"msgdata,update_fail_htlc,len,u16,",
76+
"msgdata,update_fail_htlc,reason,byte,len",
77+
"msgtype,update_fail_malformed_htlc,135",
78+
"msgdata,update_fail_malformed_htlc,channel_id,channel_id,",
79+
"msgdata,update_fail_malformed_htlc,id,u64,",
80+
"msgdata,update_fail_malformed_htlc,sha256_of_onion,sha256,",
81+
"msgdata,update_fail_malformed_htlc,failure_code,u16,",
82+
"msgtype,commitment_signed,132",
83+
"msgdata,commitment_signed,channel_id,channel_id,",
84+
"msgdata,commitment_signed,signature,signature,",
85+
"msgdata,commitment_signed,num_htlcs,u16,",
86+
"msgdata,commitment_signed,htlc_signature,signature,num_htlcs",
87+
"msgtype,revoke_and_ack,133",
88+
"msgdata,revoke_and_ack,channel_id,channel_id,",
89+
"msgdata,revoke_and_ack,per_commitment_secret,byte,32",
90+
"msgdata,revoke_and_ack,next_per_commitment_point,point,",
91+
"msgtype,update_fee,134",
92+
"msgdata,update_fee,channel_id,channel_id,",
93+
"msgdata,update_fee,feerate_per_kw,u32,",
94+
"msgtype,channel_reestablish,136",
95+
"msgdata,channel_reestablish,channel_id,channel_id,",
96+
"msgdata,channel_reestablish,next_commitment_number,u64,",
97+
"msgdata,channel_reestablish,next_revocation_number,u64,",
98+
"msgdata,channel_reestablish,your_last_per_commitment_secret,byte,32",
99+
"msgdata,channel_reestablish,my_current_per_commitment_point,point,",
100+
]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /usr/bin/make
2+
3+
SPECDIR := ../../../../../../../lightning-rfc
4+
5+
csv.py: $(SPECDIR)/04-onion-routing.md Makefile
6+
SPECNUM=`basename $< | sed 's/-.*//'`; (echo csv = '['; python3 $(SPECDIR)/tools/extract-formats.py $< | sed 's/\(.*\)/ "\1",/'; echo ']') > $@
7+
chmod a+x $@

0 commit comments

Comments
 (0)