Browse Source

pyln.spec.bolt*: change version numbering to include specific csv subversion.

Now they look like 1.0.1.137, so you can explicitly depend on a csv change
(without caring about a textual change).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
paymod-01
Rusty Russell 5 years ago
committed by Christian Decker
parent
commit
447231f52e
  1. 72
      contrib/pyln-spec/Makefile
  2. 2
      contrib/pyln-spec/bolt.py
  3. 35
      contrib/pyln-spec/bolt1/pyln/spec/bolt1/csv.py
  4. 1
      contrib/pyln-spec/bolt1/pyln/spec/bolt1/gen_csv_version.py
  5. 3
      contrib/pyln-spec/bolt1/pyln/spec/bolt1/gen_version.py
  6. 35
      contrib/pyln-spec/bolt1/pyln/spec/bolt1/text.py
  7. 100
      contrib/pyln-spec/bolt2/pyln/spec/bolt2/csv.py
  8. 1
      contrib/pyln-spec/bolt2/pyln/spec/bolt2/gen_csv_version.py
  9. 5
      contrib/pyln-spec/bolt2/pyln/spec/bolt2/gen_version.py
  10. 100
      contrib/pyln-spec/bolt2/pyln/spec/bolt2/text.py
  11. 55
      contrib/pyln-spec/bolt4/pyln/spec/bolt4/csv.py
  12. 1
      contrib/pyln-spec/bolt4/pyln/spec/bolt4/gen_csv_version.py
  13. 3
      contrib/pyln-spec/bolt4/pyln/spec/bolt4/gen_version.py
  14. 55
      contrib/pyln-spec/bolt4/pyln/spec/bolt4/text.py
  15. 83
      contrib/pyln-spec/bolt7/pyln/spec/bolt7/csv.py
  16. 1
      contrib/pyln-spec/bolt7/pyln/spec/bolt7/gen_csv_version.py
  17. 3
      contrib/pyln-spec/bolt7/pyln/spec/bolt7/gen_version.py
  18. 83
      contrib/pyln-spec/bolt7/pyln/spec/bolt7/text.py
  19. 9
      contrib/pyln-spec/subinit.py

72
contrib/pyln-spec/Makefile

@ -3,8 +3,10 @@
SPECDIR := ../../../lightning-rfc
# This gives us something like 'v1.0-137-gae2d248b7ad8b0965f224c303019ba04c661008f'
GITDESCRIBE := $(shell git -C $(SPECDIR) describe --abbrev=40)
# PEP 440 requires numbers only, but allows -post (setuptools prefers .post though):
VERSION := $(shell echo $(GITDESCRIBE) | sed 's/^v//' | sed 's/-/.post/' | sed 's/-g.*//')
# -> 1.0
BASEVERSION := $(shell echo $(GITDESCRIBE) | sed 's/^v//' | sed 's/-.*//')
# -> 137
POSTVERSION := $(shell echo $(GITDESCRIBE) | sed 's/[^-]*-\([^-]*\)-.*/\1/')
# This maintains -dirty, if present.
GITVERSION := $(shell echo $(GITDESCRIBE) | sed 's/.*-g//')
@ -22,30 +24,23 @@ check-source-flake8: $(DIRS:%=check-source-flake8-%)
check-source-mypy: $(DIRS:%=check-source-mypy-%)
check-source-flake8-%:
cd $* && flake8 --ignore=E501,E731,W503 --exclude=gen.py
cd $* && flake8 --ignore=E501,E731,W503 --exclude=text.py
# mypy . does not recurse. I have no idea why...
check-source-mypy-%:
cd $* && mypy --ignore-missing-imports `find * -name '*.py'`
# There's a smarter way to do this, probably.
# Given a bolt number and a variable, get the value from inside the package.
extract = $(shell python3 -c 'from pyln.spec import bolt$1 as bolt;print(bolt.$2)')
# Get the version for this bolt
version = $(call extract,$1,__version__)
VERSION_BOLT1 := $(shell python3 -c 'from pyln.spec import bolt1 as bolt;print(bolt.__version__)')
VERSION_BOLT2 := $(shell python3 -c 'from pyln.spec import bolt2 as bolt;print(bolt.__version__)')
VERSION_BOLT4 := $(shell python3 -c 'from pyln.spec import bolt4 as bolt;print(bolt.__version__)')
VERSION_BOLT7 := $(shell python3 -c 'from pyln.spec import bolt7 as bolt;print(bolt.__version__)')
# Given a direc the csv version for this bolt.
csv_version = $(call extract,$1,__csv_version__)
SDIST_FILE1 := bolt1/dist/pyln-bolt1-$(VERSION_BOLT1).tar.gz
BDIST_FILE1 := bolt1/dist/pyln_bolt1-$(VERSION_BOLT1)-py3-none-any.whl
SDIST_FILE2 := bolt2/dist/pyln-bolt2-$(VERSION_BOLT2).tar.gz
BDIST_FILE2 := bolt2/dist/pyln_bolt2-$(VERSION_BOLT2)-py3-none-any.whl
SDIST_FILE4 := bolt4/dist/pyln-bolt4-$(VERSION_BOLT4).tar.gz
BDIST_FILE4 := bolt4/dist/pyln_bolt4-$(VERSION_BOLT4)-py3-none-any.whl
SDIST_FILE7 := bolt7/dist/pyln-bolt7-$(VERSION_BOLT7).tar.gz
BDIST_FILE7 := bolt7/dist/pyln_bolt7-$(VERSION_BOLT7)-py3-none-any.whl
# Given a bolt number, get the current version.
sdistfiles = $(foreach b,$(BOLTS),bolt$b/dist/pyln-bolt$b-$(call version,$b).tar.gz)
bdistfiles = $(foreach b,$(BOLTS),bolt$b/dist/pyln_bolt$b-$(call version,$b)-py3-none-any.whl)
%.tar.gz:
cd $(dir $@)/.. && python3 setup.py sdist
@ -53,10 +48,10 @@ BDIST_FILE7 := bolt7/dist/pyln_bolt7-$(VERSION_BOLT7)-py3-none-any.whl
%.whl:
cd $(dir $@)/.. && python3 setup.py bdist_wheel
ARTEFACTS = $(foreach b,$(BOLTS),$(BDIST_FILE$(b)) $(SDIST_FILE$(b)))
ARTEFACTS := $(foreach b,$(BOLTS),$(call bdistfiles,$b) $(call sdistfiles,$b))
test-release-bolt%: $(ARTEFACTS)
python3 -m twine upload --repository testpypi --skip-existing $(BDIST_FILE$*)
python3 -m twine upload --repository testpypi --skip-existing $(call bdistfiles,$*) $(call sdistfiles,$*)
# Create a test virtualenv, install from the testpypi and run the
# tests against it (make sure not to use any virtualenv that may have
@ -65,7 +60,7 @@ test-release-bolt%: $(ARTEFACTS)
# Install the requirements from the prod repo, they are not being kept up to date on the test repo
testpypi-$*/bin/python3 -m pip install -r requirements.txt pytest flaky pytest-timeout
testpypi-$*/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-bolt$*
testpypi-$*/bin/python3 -c "from pyln.spec import bolt$* as bolt;assert(bolt.__version__ == '$(VERSION_BOLT$*)')"
testpypi-$*/bin/python3 -c "from pyln.spec import bolt$* as bolt;assert(bolt.__version__ == '$(call version,$*)')"
testpypi-$*/bin/pytest bolt$*/tests
rm -rf testpypi-$*
@ -74,20 +69,33 @@ test-release: check $(foreach b,$(BOLTS),test-release-bolt$b)
prod-release: test $(ARTEFACTS)
python3 -m twine upload $(ARTEFACTS)
refresh: $(CODE_DIRS:%=%/gen_version.py)
refresh: $(CODE_DIRS:%=%/gen_csv_version.py) $(CODE_DIRS:%=%/gen_version.py)
bolt1/pyln/spec/bolt1/gen.py: $(SPECDIR)/01-messaging.md Makefile
bolt2/pyln/spec/bolt2/gen.py: $(SPECDIR)/02-peer-protocol.md Makefile
bolt4/pyln/spec/bolt4/gen.py: $(SPECDIR)/04-onion-routing.md Makefile
bolt7/pyln/spec/bolt7/gen.py: $(SPECDIR)/07-routing-gossip.md Makefile
bolt1/pyln/spec/bolt1/csv.py bolt1/pyln/spec/bolt1/text.py: $(SPECDIR)/01-messaging.md Makefile
bolt2/pyln/spec/bolt2/csv.py bolt2/pyln/spec/bolt2/text.py: $(SPECDIR)/02-peer-protocol.md Makefile
bolt4/pyln/spec/bolt4/csv.py bolt4/pyln/spec/bolt4/text.py: $(SPECDIR)/04-onion-routing.md Makefile
bolt7/pyln/spec/bolt7/csv.py bolt7/pyln/spec/bolt7/text.py: $(SPECDIR)/07-routing-gossip.md Makefile
%/gen_version.py: %/gen.py
echo '__version__ = "$(VERSION)"' > $@
# Getting a bolt number from a target file is nontrivial.
boltnumfromfile = $(subst bolt,,$(word 1,$(subst /, ,$1)))
# Every time this is updated, it increments the version number.
# Only happens when CSV is actually different.
%/gen_csv_version.py: %/csv.py
@VER=$$(($(call csv_version,$(call boltnumfromfile,$@)) + 1)); echo Upgrading $@ to $$VER; echo '__csv_version__ = "'$$VER'"' > $@
# This is changed every time text is changed.
%/gen_version.py: %/text.py
echo '__base_version__ = "$(BASEVERSION)"' > $@
echo '__post_version__ = "$(POSTVERSION)"' >> $@
echo '__gitversion__ = "$(GITVERSION)"' >> $@
# We update iff it has changed.
$(CODE_DIRS:%=%/gen.py):
$(CODE_DIRS:%=%/csv.py):
@(echo csv = '['; python3 $(SPECDIR)/tools/extract-formats.py $< | sed 's/\(.*\)/ "\1",/'; echo ']') > $@.tmp
@echo 'desc = "'`head -n1 $< | cut -c3-`'"' >> $@.tmp
@if cmp $@ $@.tmp >/dev/null 2>&1; then rm $@.tmp; echo '$@ unchanged'; else mv $@.tmp $@; fi
$(CODE_DIRS:%=%/text.py):
@echo 'desc = "'`head -n1 $< | cut -c3-`'"' > $@.tmp
@(echo -n 'text = """'; sed 's,\\,\\\\,g' < $<; echo '"""') >> $@.tmp
@if cmp $@ $@.tmp >/dev/null 2>&1; then rm $@.tmp; else mv $@.tmp $@; fi
@if cmp $@ $@.tmp >/dev/null 2>&1; then rm $@.tmp; echo '$@ unchanged'; else mv $@.tmp $@; fi

2
contrib/pyln-spec/bolt.py

@ -1,5 +1,5 @@
from pyln.proto.message import MessageNamespace
from .gen import csv
from .csv import csv
namespace = MessageNamespace(csv_lines=csv)

35
contrib/pyln-spec/bolt1/pyln/spec/bolt1/csv.py

@ -0,0 +1,35 @@
csv = [
"msgtype,init,16",
"msgdata,init,gflen,u16,",
"msgdata,init,globalfeatures,byte,gflen",
"msgdata,init,flen,u16,",
"msgdata,init,features,byte,flen",
"msgdata,init,tlvs,init_tlvs,",
"tlvtype,init_tlvs,networks,1",
"tlvdata,init_tlvs,networks,chains,chain_hash,...",
"msgtype,error,17",
"msgdata,error,channel_id,channel_id,",
"msgdata,error,len,u16,",
"msgdata,error,data,byte,len",
"msgtype,ping,18",
"msgdata,ping,num_pong_bytes,u16,",
"msgdata,ping,byteslen,u16,",
"msgdata,ping,ignored,byte,byteslen",
"msgtype,pong,19",
"msgdata,pong,byteslen,u16,",
"msgdata,pong,ignored,byte,byteslen",
"tlvtype,n1,tlv1,1",
"tlvdata,n1,tlv1,amount_msat,tu64,",
"tlvtype,n1,tlv2,2",
"tlvdata,n1,tlv2,scid,short_channel_id,",
"tlvtype,n1,tlv3,3",
"tlvdata,n1,tlv3,node_id,point,",
"tlvdata,n1,tlv3,amount_msat_1,u64,",
"tlvdata,n1,tlv3,amount_msat_2,u64,",
"tlvtype,n1,tlv4,254",
"tlvdata,n1,tlv4,cltv_delta,u16,",
"tlvtype,n2,tlv1,0",
"tlvdata,n2,tlv1,amount_msat,tu64,",
"tlvtype,n2,tlv2,11",
"tlvdata,n2,tlv2,cltv_expiry,tu32,",
]

1
contrib/pyln-spec/bolt1/pyln/spec/bolt1/gen_csv_version.py

@ -0,0 +1 @@
__csv_version__ = "1"

3
contrib/pyln-spec/bolt1/pyln/spec/bolt1/gen_version.py

@ -1,2 +1,3 @@
__version__ = "1.0.post137"
__base_version__ = "1.0"
__post_version__ = "137"
__gitversion__ = "9e8e29af9b9a922eb114b2c716205d0772946e56"

35
contrib/pyln-spec/bolt1/pyln/spec/bolt1/gen.py → contrib/pyln-spec/bolt1/pyln/spec/bolt1/text.py

@ -1,38 +1,3 @@
csv = [
"msgtype,init,16",
"msgdata,init,gflen,u16,",
"msgdata,init,globalfeatures,byte,gflen",
"msgdata,init,flen,u16,",
"msgdata,init,features,byte,flen",
"msgdata,init,tlvs,init_tlvs,",
"tlvtype,init_tlvs,networks,1",
"tlvdata,init_tlvs,networks,chains,chain_hash,...",
"msgtype,error,17",
"msgdata,error,channel_id,channel_id,",
"msgdata,error,len,u16,",
"msgdata,error,data,byte,len",
"msgtype,ping,18",
"msgdata,ping,num_pong_bytes,u16,",
"msgdata,ping,byteslen,u16,",
"msgdata,ping,ignored,byte,byteslen",
"msgtype,pong,19",
"msgdata,pong,byteslen,u16,",
"msgdata,pong,ignored,byte,byteslen",
"tlvtype,n1,tlv1,1",
"tlvdata,n1,tlv1,amount_msat,tu64,",
"tlvtype,n1,tlv2,2",
"tlvdata,n1,tlv2,scid,short_channel_id,",
"tlvtype,n1,tlv3,3",
"tlvdata,n1,tlv3,node_id,point,",
"tlvdata,n1,tlv3,amount_msat_1,u64,",
"tlvdata,n1,tlv3,amount_msat_2,u64,",
"tlvtype,n1,tlv4,254",
"tlvdata,n1,tlv4,cltv_delta,u16,",
"tlvtype,n2,tlv1,0",
"tlvdata,n2,tlv1,amount_msat,tu64,",
"tlvtype,n2,tlv2,11",
"tlvdata,n2,tlv2,cltv_expiry,tu32,",
]
desc = "BOLT #1: Base Protocol"
text = """# BOLT #1: Base Protocol

100
contrib/pyln-spec/bolt2/pyln/spec/bolt2/csv.py

@ -0,0 +1,100 @@
csv = [
"msgtype,open_channel,32",
"msgdata,open_channel,chain_hash,chain_hash,",
"msgdata,open_channel,temporary_channel_id,byte,32",
"msgdata,open_channel,funding_satoshis,u64,",
"msgdata,open_channel,push_msat,u64,",
"msgdata,open_channel,dust_limit_satoshis,u64,",
"msgdata,open_channel,max_htlc_value_in_flight_msat,u64,",
"msgdata,open_channel,channel_reserve_satoshis,u64,",
"msgdata,open_channel,htlc_minimum_msat,u64,",
"msgdata,open_channel,feerate_per_kw,u32,",
"msgdata,open_channel,to_self_delay,u16,",
"msgdata,open_channel,max_accepted_htlcs,u16,",
"msgdata,open_channel,funding_pubkey,point,",
"msgdata,open_channel,revocation_basepoint,point,",
"msgdata,open_channel,payment_basepoint,point,",
"msgdata,open_channel,delayed_payment_basepoint,point,",
"msgdata,open_channel,htlc_basepoint,point,",
"msgdata,open_channel,first_per_commitment_point,point,",
"msgdata,open_channel,channel_flags,byte,",
"msgdata,open_channel,tlvs,open_channel_tlvs,",
"tlvtype,open_channel_tlvs,upfront_shutdown_script,0",
"tlvdata,open_channel_tlvs,upfront_shutdown_script,shutdown_scriptpubkey,byte,...",
"msgtype,accept_channel,33",
"msgdata,accept_channel,temporary_channel_id,byte,32",
"msgdata,accept_channel,dust_limit_satoshis,u64,",
"msgdata,accept_channel,max_htlc_value_in_flight_msat,u64,",
"msgdata,accept_channel,channel_reserve_satoshis,u64,",
"msgdata,accept_channel,htlc_minimum_msat,u64,",
"msgdata,accept_channel,minimum_depth,u32,",
"msgdata,accept_channel,to_self_delay,u16,",
"msgdata,accept_channel,max_accepted_htlcs,u16,",
"msgdata,accept_channel,funding_pubkey,point,",
"msgdata,accept_channel,revocation_basepoint,point,",
"msgdata,accept_channel,payment_basepoint,point,",
"msgdata,accept_channel,delayed_payment_basepoint,point,",
"msgdata,accept_channel,htlc_basepoint,point,",
"msgdata,accept_channel,first_per_commitment_point,point,",
"msgdata,accept_channel,tlvs,accept_channel_tlvs,",
"tlvtype,accept_channel_tlvs,upfront_shutdown_script,0",
"tlvdata,accept_channel_tlvs,upfront_shutdown_script,shutdown_scriptpubkey,byte,...",
"msgtype,funding_created,34",
"msgdata,funding_created,temporary_channel_id,byte,32",
"msgdata,funding_created,funding_txid,sha256,",
"msgdata,funding_created,funding_output_index,u16,",
"msgdata,funding_created,signature,signature,",
"msgtype,funding_signed,35",
"msgdata,funding_signed,channel_id,channel_id,",
"msgdata,funding_signed,signature,signature,",
"msgtype,funding_locked,36",
"msgdata,funding_locked,channel_id,channel_id,",
"msgdata,funding_locked,next_per_commitment_point,point,",
"msgtype,shutdown,38",
"msgdata,shutdown,channel_id,channel_id,",
"msgdata,shutdown,len,u16,",
"msgdata,shutdown,scriptpubkey,byte,len",
"msgtype,closing_signed,39",
"msgdata,closing_signed,channel_id,channel_id,",
"msgdata,closing_signed,fee_satoshis,u64,",
"msgdata,closing_signed,signature,signature,",
"msgtype,update_add_htlc,128",
"msgdata,update_add_htlc,channel_id,channel_id,",
"msgdata,update_add_htlc,id,u64,",
"msgdata,update_add_htlc,amount_msat,u64,",
"msgdata,update_add_htlc,payment_hash,sha256,",
"msgdata,update_add_htlc,cltv_expiry,u32,",
"msgdata,update_add_htlc,onion_routing_packet,byte,1366",
"msgtype,update_fulfill_htlc,130",
"msgdata,update_fulfill_htlc,channel_id,channel_id,",
"msgdata,update_fulfill_htlc,id,u64,",
"msgdata,update_fulfill_htlc,payment_preimage,byte,32",
"msgtype,update_fail_htlc,131",
"msgdata,update_fail_htlc,channel_id,channel_id,",
"msgdata,update_fail_htlc,id,u64,",
"msgdata,update_fail_htlc,len,u16,",
"msgdata,update_fail_htlc,reason,byte,len",
"msgtype,update_fail_malformed_htlc,135",
"msgdata,update_fail_malformed_htlc,channel_id,channel_id,",
"msgdata,update_fail_malformed_htlc,id,u64,",
"msgdata,update_fail_malformed_htlc,sha256_of_onion,sha256,",
"msgdata,update_fail_malformed_htlc,failure_code,u16,",
"msgtype,commitment_signed,132",
"msgdata,commitment_signed,channel_id,channel_id,",
"msgdata,commitment_signed,signature,signature,",
"msgdata,commitment_signed,num_htlcs,u16,",
"msgdata,commitment_signed,htlc_signature,signature,num_htlcs",
"msgtype,revoke_and_ack,133",
"msgdata,revoke_and_ack,channel_id,channel_id,",
"msgdata,revoke_and_ack,per_commitment_secret,byte,32",
"msgdata,revoke_and_ack,next_per_commitment_point,point,",
"msgtype,update_fee,134",
"msgdata,update_fee,channel_id,channel_id,",
"msgdata,update_fee,feerate_per_kw,u32,",
"msgtype,channel_reestablish,136",
"msgdata,channel_reestablish,channel_id,channel_id,",
"msgdata,channel_reestablish,next_commitment_number,u64,",
"msgdata,channel_reestablish,next_revocation_number,u64,",
"msgdata,channel_reestablish,your_last_per_commitment_secret,byte,32",
"msgdata,channel_reestablish,my_current_per_commitment_point,point,",
]

1
contrib/pyln-spec/bolt2/pyln/spec/bolt2/gen_csv_version.py

@ -0,0 +1 @@
__csv_version__ = "1"

5
contrib/pyln-spec/bolt2/pyln/spec/bolt2/gen_version.py

@ -1,2 +1,3 @@
__version__ = "1.0.post137"
__gitversion__ = "ae2d248b7ad8b0965f224c303019ba04c661008f"
__base_version__ = "1.0"
__post_version__ = "137"
__gitversion__ = "9e8e29af9b9a922eb114b2c716205d0772946e56"

100
contrib/pyln-spec/bolt2/pyln/spec/bolt2/gen.py → contrib/pyln-spec/bolt2/pyln/spec/bolt2/text.py

@ -1,103 +1,3 @@
csv = [
"msgtype,open_channel,32",
"msgdata,open_channel,chain_hash,chain_hash,",
"msgdata,open_channel,temporary_channel_id,byte,32",
"msgdata,open_channel,funding_satoshis,u64,",
"msgdata,open_channel,push_msat,u64,",
"msgdata,open_channel,dust_limit_satoshis,u64,",
"msgdata,open_channel,max_htlc_value_in_flight_msat,u64,",
"msgdata,open_channel,channel_reserve_satoshis,u64,",
"msgdata,open_channel,htlc_minimum_msat,u64,",
"msgdata,open_channel,feerate_per_kw,u32,",
"msgdata,open_channel,to_self_delay,u16,",
"msgdata,open_channel,max_accepted_htlcs,u16,",
"msgdata,open_channel,funding_pubkey,point,",
"msgdata,open_channel,revocation_basepoint,point,",
"msgdata,open_channel,payment_basepoint,point,",
"msgdata,open_channel,delayed_payment_basepoint,point,",
"msgdata,open_channel,htlc_basepoint,point,",
"msgdata,open_channel,first_per_commitment_point,point,",
"msgdata,open_channel,channel_flags,byte,",
"msgdata,open_channel,tlvs,open_channel_tlvs,",
"tlvtype,open_channel_tlvs,upfront_shutdown_script,0",
"tlvdata,open_channel_tlvs,upfront_shutdown_script,shutdown_scriptpubkey,byte,...",
"msgtype,accept_channel,33",
"msgdata,accept_channel,temporary_channel_id,byte,32",
"msgdata,accept_channel,dust_limit_satoshis,u64,",
"msgdata,accept_channel,max_htlc_value_in_flight_msat,u64,",
"msgdata,accept_channel,channel_reserve_satoshis,u64,",
"msgdata,accept_channel,htlc_minimum_msat,u64,",
"msgdata,accept_channel,minimum_depth,u32,",
"msgdata,accept_channel,to_self_delay,u16,",
"msgdata,accept_channel,max_accepted_htlcs,u16,",
"msgdata,accept_channel,funding_pubkey,point,",
"msgdata,accept_channel,revocation_basepoint,point,",
"msgdata,accept_channel,payment_basepoint,point,",
"msgdata,accept_channel,delayed_payment_basepoint,point,",
"msgdata,accept_channel,htlc_basepoint,point,",
"msgdata,accept_channel,first_per_commitment_point,point,",
"msgdata,accept_channel,tlvs,accept_channel_tlvs,",
"tlvtype,accept_channel_tlvs,upfront_shutdown_script,0",
"tlvdata,accept_channel_tlvs,upfront_shutdown_script,shutdown_scriptpubkey,byte,...",
"msgtype,funding_created,34",
"msgdata,funding_created,temporary_channel_id,byte,32",
"msgdata,funding_created,funding_txid,sha256,",
"msgdata,funding_created,funding_output_index,u16,",
"msgdata,funding_created,signature,signature,",
"msgtype,funding_signed,35",
"msgdata,funding_signed,channel_id,channel_id,",
"msgdata,funding_signed,signature,signature,",
"msgtype,funding_locked,36",
"msgdata,funding_locked,channel_id,channel_id,",
"msgdata,funding_locked,next_per_commitment_point,point,",
"msgtype,shutdown,38",
"msgdata,shutdown,channel_id,channel_id,",
"msgdata,shutdown,len,u16,",
"msgdata,shutdown,scriptpubkey,byte,len",
"msgtype,closing_signed,39",
"msgdata,closing_signed,channel_id,channel_id,",
"msgdata,closing_signed,fee_satoshis,u64,",
"msgdata,closing_signed,signature,signature,",
"msgtype,update_add_htlc,128",
"msgdata,update_add_htlc,channel_id,channel_id,",
"msgdata,update_add_htlc,id,u64,",
"msgdata,update_add_htlc,amount_msat,u64,",
"msgdata,update_add_htlc,payment_hash,sha256,",
"msgdata,update_add_htlc,cltv_expiry,u32,",
"msgdata,update_add_htlc,onion_routing_packet,byte,1366",
"msgtype,update_fulfill_htlc,130",
"msgdata,update_fulfill_htlc,channel_id,channel_id,",
"msgdata,update_fulfill_htlc,id,u64,",
"msgdata,update_fulfill_htlc,payment_preimage,byte,32",
"msgtype,update_fail_htlc,131",
"msgdata,update_fail_htlc,channel_id,channel_id,",
"msgdata,update_fail_htlc,id,u64,",
"msgdata,update_fail_htlc,len,u16,",
"msgdata,update_fail_htlc,reason,byte,len",
"msgtype,update_fail_malformed_htlc,135",
"msgdata,update_fail_malformed_htlc,channel_id,channel_id,",
"msgdata,update_fail_malformed_htlc,id,u64,",
"msgdata,update_fail_malformed_htlc,sha256_of_onion,sha256,",
"msgdata,update_fail_malformed_htlc,failure_code,u16,",
"msgtype,commitment_signed,132",
"msgdata,commitment_signed,channel_id,channel_id,",
"msgdata,commitment_signed,signature,signature,",
"msgdata,commitment_signed,num_htlcs,u16,",
"msgdata,commitment_signed,htlc_signature,signature,num_htlcs",
"msgtype,revoke_and_ack,133",
"msgdata,revoke_and_ack,channel_id,channel_id,",
"msgdata,revoke_and_ack,per_commitment_secret,byte,32",
"msgdata,revoke_and_ack,next_per_commitment_point,point,",
"msgtype,update_fee,134",
"msgdata,update_fee,channel_id,channel_id,",
"msgdata,update_fee,feerate_per_kw,u32,",
"msgtype,channel_reestablish,136",
"msgdata,channel_reestablish,channel_id,channel_id,",
"msgdata,channel_reestablish,next_commitment_number,u64,",
"msgdata,channel_reestablish,next_revocation_number,u64,",
"msgdata,channel_reestablish,your_last_per_commitment_secret,byte,32",
"msgdata,channel_reestablish,my_current_per_commitment_point,point,",
]
desc = "BOLT #2: Peer Protocol for Channel Management"
text = """# BOLT #2: Peer Protocol for Channel Management

55
contrib/pyln-spec/bolt4/pyln/spec/bolt4/csv.py

@ -0,0 +1,55 @@
csv = [
"tlvtype,tlv_payload,amt_to_forward,2",
"tlvdata,tlv_payload,amt_to_forward,amt_to_forward,tu64,",
"tlvtype,tlv_payload,outgoing_cltv_value,4",
"tlvdata,tlv_payload,outgoing_cltv_value,outgoing_cltv_value,tu32,",
"tlvtype,tlv_payload,short_channel_id,6",
"tlvdata,tlv_payload,short_channel_id,short_channel_id,short_channel_id,",
"tlvtype,tlv_payload,payment_data,8",
"tlvdata,tlv_payload,payment_data,payment_secret,byte,32",
"tlvdata,tlv_payload,payment_data,total_msat,tu64,",
"msgtype,invalid_realm,PERM|1",
"msgtype,temporary_node_failure,NODE|2",
"msgtype,permanent_node_failure,PERM|NODE|2",
"msgtype,required_node_feature_missing,PERM|NODE|3",
"msgtype,invalid_onion_version,BADONION|PERM|4",
"msgdata,invalid_onion_version,sha256_of_onion,sha256,",
"msgtype,invalid_onion_hmac,BADONION|PERM|5",
"msgdata,invalid_onion_hmac,sha256_of_onion,sha256,",
"msgtype,invalid_onion_key,BADONION|PERM|6",
"msgdata,invalid_onion_key,sha256_of_onion,sha256,",
"msgtype,temporary_channel_failure,UPDATE|7",
"msgdata,temporary_channel_failure,len,u16,",
"msgdata,temporary_channel_failure,channel_update,byte,len",
"msgtype,permanent_channel_failure,PERM|8",
"msgtype,required_channel_feature_missing,PERM|9",
"msgtype,unknown_next_peer,PERM|10",
"msgtype,amount_below_minimum,UPDATE|11",
"msgdata,amount_below_minimum,htlc_msat,u64,",
"msgdata,amount_below_minimum,len,u16,",
"msgdata,amount_below_minimum,channel_update,byte,len",
"msgtype,fee_insufficient,UPDATE|12",
"msgdata,fee_insufficient,htlc_msat,u64,",
"msgdata,fee_insufficient,len,u16,",
"msgdata,fee_insufficient,channel_update,byte,len",
"msgtype,incorrect_cltv_expiry,UPDATE|13",
"msgdata,incorrect_cltv_expiry,cltv_expiry,u32,",
"msgdata,incorrect_cltv_expiry,len,u16,",
"msgdata,incorrect_cltv_expiry,channel_update,byte,len",
"msgtype,expiry_too_soon,UPDATE|14",
"msgdata,expiry_too_soon,len,u16,",
"msgdata,expiry_too_soon,channel_update,byte,len",
"msgtype,incorrect_or_unknown_payment_details,PERM|15",
"msgdata,incorrect_or_unknown_payment_details,htlc_msat,u64,",
"msgdata,incorrect_or_unknown_payment_details,height,u32,",
"msgtype,final_incorrect_cltv_expiry,18",
"msgdata,final_incorrect_cltv_expiry,cltv_expiry,u32,",
"msgtype,final_incorrect_htlc_amount,19",
"msgdata,final_incorrect_htlc_amount,incoming_htlc_amt,u64,",
"msgtype,channel_disabled,UPDATE|20",
"msgtype,expiry_too_far,21",
"msgtype,invalid_onion_payload,PERM|22",
"msgdata,invalid_onion_payload,type,bigsize,",
"msgdata,invalid_onion_payload,offset,u16,",
"msgtype,mpp_timeout,23",
]

1
contrib/pyln-spec/bolt4/pyln/spec/bolt4/gen_csv_version.py

@ -0,0 +1 @@
__csv_version__ = "1"

3
contrib/pyln-spec/bolt4/pyln/spec/bolt4/gen_version.py

@ -1,2 +1,3 @@
__version__ = "1.0.post137"
__base_version__ = "1.0"
__post_version__ = "137"
__gitversion__ = "9e8e29af9b9a922eb114b2c716205d0772946e56"

55
contrib/pyln-spec/bolt4/pyln/spec/bolt4/gen.py → contrib/pyln-spec/bolt4/pyln/spec/bolt4/text.py

@ -1,58 +1,3 @@
csv = [
"tlvtype,tlv_payload,amt_to_forward,2",
"tlvdata,tlv_payload,amt_to_forward,amt_to_forward,tu64,",
"tlvtype,tlv_payload,outgoing_cltv_value,4",
"tlvdata,tlv_payload,outgoing_cltv_value,outgoing_cltv_value,tu32,",
"tlvtype,tlv_payload,short_channel_id,6",
"tlvdata,tlv_payload,short_channel_id,short_channel_id,short_channel_id,",
"tlvtype,tlv_payload,payment_data,8",
"tlvdata,tlv_payload,payment_data,payment_secret,byte,32",
"tlvdata,tlv_payload,payment_data,total_msat,tu64,",
"msgtype,invalid_realm,PERM|1",
"msgtype,temporary_node_failure,NODE|2",
"msgtype,permanent_node_failure,PERM|NODE|2",
"msgtype,required_node_feature_missing,PERM|NODE|3",
"msgtype,invalid_onion_version,BADONION|PERM|4",
"msgdata,invalid_onion_version,sha256_of_onion,sha256,",
"msgtype,invalid_onion_hmac,BADONION|PERM|5",
"msgdata,invalid_onion_hmac,sha256_of_onion,sha256,",
"msgtype,invalid_onion_key,BADONION|PERM|6",
"msgdata,invalid_onion_key,sha256_of_onion,sha256,",
"msgtype,temporary_channel_failure,UPDATE|7",
"msgdata,temporary_channel_failure,len,u16,",
"msgdata,temporary_channel_failure,channel_update,byte,len",
"msgtype,permanent_channel_failure,PERM|8",
"msgtype,required_channel_feature_missing,PERM|9",
"msgtype,unknown_next_peer,PERM|10",
"msgtype,amount_below_minimum,UPDATE|11",
"msgdata,amount_below_minimum,htlc_msat,u64,",
"msgdata,amount_below_minimum,len,u16,",
"msgdata,amount_below_minimum,channel_update,byte,len",
"msgtype,fee_insufficient,UPDATE|12",
"msgdata,fee_insufficient,htlc_msat,u64,",
"msgdata,fee_insufficient,len,u16,",
"msgdata,fee_insufficient,channel_update,byte,len",
"msgtype,incorrect_cltv_expiry,UPDATE|13",
"msgdata,incorrect_cltv_expiry,cltv_expiry,u32,",
"msgdata,incorrect_cltv_expiry,len,u16,",
"msgdata,incorrect_cltv_expiry,channel_update,byte,len",
"msgtype,expiry_too_soon,UPDATE|14",
"msgdata,expiry_too_soon,len,u16,",
"msgdata,expiry_too_soon,channel_update,byte,len",
"msgtype,incorrect_or_unknown_payment_details,PERM|15",
"msgdata,incorrect_or_unknown_payment_details,htlc_msat,u64,",
"msgdata,incorrect_or_unknown_payment_details,height,u32,",
"msgtype,final_incorrect_cltv_expiry,18",
"msgdata,final_incorrect_cltv_expiry,cltv_expiry,u32,",
"msgtype,final_incorrect_htlc_amount,19",
"msgdata,final_incorrect_htlc_amount,incoming_htlc_amt,u64,",
"msgtype,channel_disabled,UPDATE|20",
"msgtype,expiry_too_far,21",
"msgtype,invalid_onion_payload,PERM|22",
"msgdata,invalid_onion_payload,type,bigsize,",
"msgdata,invalid_onion_payload,offset,u16,",
"msgtype,mpp_timeout,23",
]
desc = "BOLT #4: Onion Routing Protocol"
text = """# BOLT #4: Onion Routing Protocol

83
contrib/pyln-spec/bolt7/pyln/spec/bolt7/csv.py

@ -0,0 +1,83 @@
csv = [
"msgtype,announcement_signatures,259",
"msgdata,announcement_signatures,channel_id,channel_id,",
"msgdata,announcement_signatures,short_channel_id,short_channel_id,",
"msgdata,announcement_signatures,node_signature,signature,",
"msgdata,announcement_signatures,bitcoin_signature,signature,",
"msgtype,channel_announcement,256",
"msgdata,channel_announcement,node_signature_1,signature,",
"msgdata,channel_announcement,node_signature_2,signature,",
"msgdata,channel_announcement,bitcoin_signature_1,signature,",
"msgdata,channel_announcement,bitcoin_signature_2,signature,",
"msgdata,channel_announcement,len,u16,",
"msgdata,channel_announcement,features,byte,len",
"msgdata,channel_announcement,chain_hash,chain_hash,",
"msgdata,channel_announcement,short_channel_id,short_channel_id,",
"msgdata,channel_announcement,node_id_1,point,",
"msgdata,channel_announcement,node_id_2,point,",
"msgdata,channel_announcement,bitcoin_key_1,point,",
"msgdata,channel_announcement,bitcoin_key_2,point,",
"msgtype,node_announcement,257",
"msgdata,node_announcement,signature,signature,",
"msgdata,node_announcement,flen,u16,",
"msgdata,node_announcement,features,byte,flen",
"msgdata,node_announcement,timestamp,u32,",
"msgdata,node_announcement,node_id,point,",
"msgdata,node_announcement,rgb_color,byte,3",
"msgdata,node_announcement,alias,byte,32",
"msgdata,node_announcement,addrlen,u16,",
"msgdata,node_announcement,addresses,byte,addrlen",
"msgtype,channel_update,258",
"msgdata,channel_update,signature,signature,",
"msgdata,channel_update,chain_hash,chain_hash,",
"msgdata,channel_update,short_channel_id,short_channel_id,",
"msgdata,channel_update,timestamp,u32,",
"msgdata,channel_update,message_flags,byte,",
"msgdata,channel_update,channel_flags,byte,",
"msgdata,channel_update,cltv_expiry_delta,u16,",
"msgdata,channel_update,htlc_minimum_msat,u64,",
"msgdata,channel_update,fee_base_msat,u32,",
"msgdata,channel_update,fee_proportional_millionths,u32,",
"msgdata,channel_update,htlc_maximum_msat,u64,,option_channel_htlc_max",
"msgtype,query_short_channel_ids,261,gossip_queries",
"msgdata,query_short_channel_ids,chain_hash,chain_hash,",
"msgdata,query_short_channel_ids,len,u16,",
"msgdata,query_short_channel_ids,encoded_short_ids,byte,len",
"msgdata,query_short_channel_ids,tlvs,query_short_channel_ids_tlvs,",
"tlvtype,query_short_channel_ids_tlvs,query_flags,1",
"tlvdata,query_short_channel_ids_tlvs,query_flags,encoding_type,byte,",
"tlvdata,query_short_channel_ids_tlvs,query_flags,encoded_query_flags,byte,...",
"msgtype,reply_short_channel_ids_end,262,gossip_queries",
"msgdata,reply_short_channel_ids_end,chain_hash,chain_hash,",
"msgdata,reply_short_channel_ids_end,full_information,byte,",
"msgtype,query_channel_range,263,gossip_queries",
"msgdata,query_channel_range,chain_hash,chain_hash,",
"msgdata,query_channel_range,first_blocknum,u32,",
"msgdata,query_channel_range,number_of_blocks,u32,",
"msgdata,query_channel_range,tlvs,query_channel_range_tlvs,",
"tlvtype,query_channel_range_tlvs,query_option,1",
"tlvdata,query_channel_range_tlvs,query_option,query_option_flags,bigsize,",
"msgtype,reply_channel_range,264,gossip_queries",
"msgdata,reply_channel_range,chain_hash,chain_hash,",
"msgdata,reply_channel_range,first_blocknum,u32,",
"msgdata,reply_channel_range,number_of_blocks,u32,",
"msgdata,reply_channel_range,full_information,byte,",
"msgdata,reply_channel_range,len,u16,",
"msgdata,reply_channel_range,encoded_short_ids,byte,len",
"msgdata,reply_channel_range,tlvs,reply_channel_range_tlvs,",
"tlvtype,reply_channel_range_tlvs,timestamps_tlv,1",
"tlvdata,reply_channel_range_tlvs,timestamps_tlv,encoding_type,byte,",
"tlvdata,reply_channel_range_tlvs,timestamps_tlv,encoded_timestamps,byte,...",
"tlvtype,reply_channel_range_tlvs,checksums_tlv,3",
"tlvdata,reply_channel_range_tlvs,checksums_tlv,checksums,channel_update_checksums,...",
"subtype,channel_update_timestamps",
"subtypedata,channel_update_timestamps,timestamp_node_id_1,u32,",
"subtypedata,channel_update_timestamps,timestamp_node_id_2,u32,",
"subtype,channel_update_checksums",
"subtypedata,channel_update_checksums,checksum_node_id_1,u32,",
"subtypedata,channel_update_checksums,checksum_node_id_2,u32,",
"msgtype,gossip_timestamp_filter,265,gossip_queries",
"msgdata,gossip_timestamp_filter,chain_hash,chain_hash,",
"msgdata,gossip_timestamp_filter,first_timestamp,u32,",
"msgdata,gossip_timestamp_filter,timestamp_range,u32,",
]

1
contrib/pyln-spec/bolt7/pyln/spec/bolt7/gen_csv_version.py

@ -0,0 +1 @@
__csv_version__ = "1"

3
contrib/pyln-spec/bolt7/pyln/spec/bolt7/gen_version.py

@ -1,2 +1,3 @@
__version__ = "1.0.post137"
__base_version__ = "1.0"
__post_version__ = "137"
__gitversion__ = "9e8e29af9b9a922eb114b2c716205d0772946e56"

83
contrib/pyln-spec/bolt7/pyln/spec/bolt7/gen.py → contrib/pyln-spec/bolt7/pyln/spec/bolt7/text.py

@ -1,86 +1,3 @@
csv = [
"msgtype,announcement_signatures,259",
"msgdata,announcement_signatures,channel_id,channel_id,",
"msgdata,announcement_signatures,short_channel_id,short_channel_id,",
"msgdata,announcement_signatures,node_signature,signature,",
"msgdata,announcement_signatures,bitcoin_signature,signature,",
"msgtype,channel_announcement,256",
"msgdata,channel_announcement,node_signature_1,signature,",
"msgdata,channel_announcement,node_signature_2,signature,",
"msgdata,channel_announcement,bitcoin_signature_1,signature,",
"msgdata,channel_announcement,bitcoin_signature_2,signature,",
"msgdata,channel_announcement,len,u16,",
"msgdata,channel_announcement,features,byte,len",
"msgdata,channel_announcement,chain_hash,chain_hash,",
"msgdata,channel_announcement,short_channel_id,short_channel_id,",
"msgdata,channel_announcement,node_id_1,point,",
"msgdata,channel_announcement,node_id_2,point,",
"msgdata,channel_announcement,bitcoin_key_1,point,",
"msgdata,channel_announcement,bitcoin_key_2,point,",
"msgtype,node_announcement,257",
"msgdata,node_announcement,signature,signature,",
"msgdata,node_announcement,flen,u16,",
"msgdata,node_announcement,features,byte,flen",
"msgdata,node_announcement,timestamp,u32,",
"msgdata,node_announcement,node_id,point,",
"msgdata,node_announcement,rgb_color,byte,3",
"msgdata,node_announcement,alias,byte,32",
"msgdata,node_announcement,addrlen,u16,",
"msgdata,node_announcement,addresses,byte,addrlen",
"msgtype,channel_update,258",
"msgdata,channel_update,signature,signature,",
"msgdata,channel_update,chain_hash,chain_hash,",
"msgdata,channel_update,short_channel_id,short_channel_id,",
"msgdata,channel_update,timestamp,u32,",
"msgdata,channel_update,message_flags,byte,",
"msgdata,channel_update,channel_flags,byte,",
"msgdata,channel_update,cltv_expiry_delta,u16,",
"msgdata,channel_update,htlc_minimum_msat,u64,",
"msgdata,channel_update,fee_base_msat,u32,",
"msgdata,channel_update,fee_proportional_millionths,u32,",
"msgdata,channel_update,htlc_maximum_msat,u64,,option_channel_htlc_max",
"msgtype,query_short_channel_ids,261,gossip_queries",
"msgdata,query_short_channel_ids,chain_hash,chain_hash,",
"msgdata,query_short_channel_ids,len,u16,",
"msgdata,query_short_channel_ids,encoded_short_ids,byte,len",
"msgdata,query_short_channel_ids,tlvs,query_short_channel_ids_tlvs,",
"tlvtype,query_short_channel_ids_tlvs,query_flags,1",
"tlvdata,query_short_channel_ids_tlvs,query_flags,encoding_type,byte,",
"tlvdata,query_short_channel_ids_tlvs,query_flags,encoded_query_flags,byte,...",
"msgtype,reply_short_channel_ids_end,262,gossip_queries",
"msgdata,reply_short_channel_ids_end,chain_hash,chain_hash,",
"msgdata,reply_short_channel_ids_end,full_information,byte,",
"msgtype,query_channel_range,263,gossip_queries",
"msgdata,query_channel_range,chain_hash,chain_hash,",
"msgdata,query_channel_range,first_blocknum,u32,",
"msgdata,query_channel_range,number_of_blocks,u32,",
"msgdata,query_channel_range,tlvs,query_channel_range_tlvs,",
"tlvtype,query_channel_range_tlvs,query_option,1",
"tlvdata,query_channel_range_tlvs,query_option,query_option_flags,bigsize,",
"msgtype,reply_channel_range,264,gossip_queries",
"msgdata,reply_channel_range,chain_hash,chain_hash,",
"msgdata,reply_channel_range,first_blocknum,u32,",
"msgdata,reply_channel_range,number_of_blocks,u32,",
"msgdata,reply_channel_range,full_information,byte,",
"msgdata,reply_channel_range,len,u16,",
"msgdata,reply_channel_range,encoded_short_ids,byte,len",
"msgdata,reply_channel_range,tlvs,reply_channel_range_tlvs,",
"tlvtype,reply_channel_range_tlvs,timestamps_tlv,1",
"tlvdata,reply_channel_range_tlvs,timestamps_tlv,encoding_type,byte,",
"tlvdata,reply_channel_range_tlvs,timestamps_tlv,encoded_timestamps,byte,...",
"tlvtype,reply_channel_range_tlvs,checksums_tlv,3",
"tlvdata,reply_channel_range_tlvs,checksums_tlv,checksums,channel_update_checksums,...",
"subtype,channel_update_timestamps",
"subtypedata,channel_update_timestamps,timestamp_node_id_1,u32,",
"subtypedata,channel_update_timestamps,timestamp_node_id_2,u32,",
"subtype,channel_update_checksums",
"subtypedata,channel_update_checksums,checksum_node_id_1,u32,",
"subtypedata,channel_update_checksums,checksum_node_id_2,u32,",
"msgtype,gossip_timestamp_filter,265,gossip_queries",
"msgdata,gossip_timestamp_filter,chain_hash,chain_hash,",
"msgdata,gossip_timestamp_filter,first_timestamp,u32,",
"msgdata,gossip_timestamp_filter,timestamp_range,u32,",
]
desc = "BOLT #7: P2P Node and Channel Discovery"
text = """# BOLT #7: P2P Node and Channel Discovery

9
contrib/pyln-spec/subinit.py

@ -1,9 +1,14 @@
# This is the same __init__.py for all bolt dirs.
from .gen import csv, text, desc
from .gen_version import __version__, __gitversion__
from .csv import csv
from .text import text, desc
from .gen_csv_version import __csv_version__
from .gen_version import __base_version__, __post_version__, __gitversion__
from .bolt import namespace
import sys
# eg. 1.0.1.137.
__version__ = '{}.{}.{}'.format(__base_version__, __csv_version__, __post_version__)
__all__ = [
'csv',
'text',

Loading…
Cancel
Save