Rusty Russell
c75f9f4318
devtools/bolt11-cli: print min_final_cltv_expiry.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
59febcb968
sphinx: explain why parse_onionpacket fails.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
66de6b84be
channeld: use pointer for shared secret.
It's more natural than using a zero-secret when something goes wrong.
Also note that the HSM will actually kill the connection if the ECDH
fails, which is fortunately statistically unlikely.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
c5ee905c92
gossipwith: correctly replace all ccan/io operations in handshake.c.
This is kind of a hack, but let's make it a complete hack. GCC with
-flto noticed we use different definitions of 'struct io_conn' here
and gave the warning:
ccan/ccan/io/io.h:620:17: warning: type of ‘io_close’ does not match original declaration [-Wlto-type-mismatch]
struct io_plan *io_close(struct io_conn *conn);
^
ccan/ccan/io/io.c:449:17: note: ‘io_close’ was previously declared here
struct io_plan *io_close(struct io_conn *conn)
^
ccan/ccan/io/io.c:449:17: note: code may be misoptimized unless -fno-strict-aliasing is used
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
c236361efd
wireaddr: update bolt version, remove 'padding' from addresses.
Nobody used this, so it was removed from the spec.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
William Casarin
7c4b9c8a0d
build: fix compile error on gcc ~7.3.0
It seems to be having a bit of trouble understanding the control flow to realize
it's not actually uninitialized.
Add an error handler after the switch in case we miss a real uninitialized error
in the future.
Signed-off-by: William Casarin <jb55@jb55.com>
6 years ago
Rusty Russell
41b0872f58
Use localfeatures and globalfeatures consistently.
That's what BOLT #1 calls them; make it easier for people to grep.
Reported-by: @niftynei
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
d16c3dcdc7
devtools/decodemsg: take series of msgs from stdin.
Useful in combination with gossipwith.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
47f5bc4deb
gossipwith: add ability to send message.
Just cmdline for now, rather than a proper stdin io loop.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
0925daa087
gossipwith: simple tool to snarf gossip from a node.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
317a830e94
devtools: dump-gossipstore.
Not very useful by itself, but when combined with decodemsg it can tell
us quite a bit.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
practicalswift
0f7b11bdc2
Remove redundant code
6 years ago
Rusty Russell
337075dc8c
tal: don't access low-level tal functions.
In several places we use low-level tal functions because we want the
label to be something other than the default. ccan/tal is adding
tal_*_label so replace them and shim it for now.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
5cf34d6618
Remove tal_len, use tal_count() or tal_bytelen().
tal_count() is used where there's a type, even if it's char or u8, and
tal_bytelen() is going to replace tal_len() for clarity: it's only needed
where a pointer is void.
We shim tal_bytelen() for now.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
93cf28553d
devtools/decodemsg: add --onion option for decoding onion errors.
This requires a tweak to generate-wire.py too, since it always called the
top-level routine 'print_message'.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
ueno
21e61a5232
fix: make devtools-clean
7 years ago
Rusty Russell
e217bc1220
per-commit-secret is a struct secret, not a sha256.
Well, it's generated by shachain, so technically it is a sha256, but
that's an internal detail. It's a secret.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
01c02fd617
devtools/decodemsg: decode encoded_short_ids.
$ devtools/decodemsg 010806226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f000000000000ffff0100160178da6360486760606400824c285d00a60111710144
$ devtools/decodemsg 010506226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f00110000006700000100000000690000010000
Before:
WIRE_REPLY_CHANNEL_RANGE:
chain_hash=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
first_blocknum=0
number_of_blocks=65535
complete=1
encoded_short_ids=[0178da6360486760606400824c285d00a60111710144]
WIRE_QUERY_SHORT_CHANNEL_IDS:
chain_hash=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
encoded_short_ids=[0000006700000100000000690000010000]
After:
WIRE_REPLY_CHANNEL_RANGE:
chain_hash=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
first_blocknum=0
number_of_blocks=65535
complete=1
encoded_short_ids=[ (ZLIB) 103:1:0 105:1:0 112:1:0 ]
WIRE_QUERY_SHORT_CHANNEL_IDS:
chain_hash=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
encoded_short_ids=[ (UNCOMPRESSED) 103:1:0 105:1:0 ]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
0bd82a8138
devtools/decodemsg: decode node_announcement.addresses
$ ./devtools/decodemsg 01014bfa4585cb36194ce7c308e8d3d9032ff4e42ed4764a4c6d0a9a58da0a4e57e97fbd463577a5fd14347c60cc7bef2b40bd644337153564320b310b4d155cab1300005b3315de0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c035180266e4e3838ae383b3e382bbe383b3e382b92031e69daf000000000000000000000000004d010102030404d202000000000000000000000000000000002607039216a8b803f3acd758aa260704e00533f3e8f2aedaa8969b3d0fa03a96e857bbb28064dca5e147e934244b9ba50230032607
Before:
WIRE_NODE_ANNOUNCEMENT:
signature=304402204bfa4585cb36194ce7c308e8d3d9032ff4e42ed4764a4c6d0a9a58da0a4e57e902207fbd463577a5fd14347c60cc7bef2b40bd644337153564320b310b4d155cab13
features=[]
timestamp=1530074590
node_id=0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518
rgb_color=[0266e4]
alias=[ナンセンス 1杯 e3838ae383b3e382bbe383b3e382b92031e69daf000000000000000000000000 ]
addresses=[010102030404d202000000000000000000000000000000002607039216a8b803f3acd758aa260704e00533f3e8f2aedaa8969b3d0fa03a96e857bbb28064dca5e147e934244b9ba50230032607]
After:
WIRE_NODE_ANNOUNCEMENT:
signature=304402204bfa4585cb36194ce7c308e8d3d9032ff4e42ed4764a4c6d0a9a58da0a4e57e902207fbd463577a5fd14347c60cc7bef2b40bd644337153564320b310b4d155cab13
features=[]
timestamp=1530074590
node_id=0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518
rgb_color=[0266e4]
alias=[ナンセンス 1杯 e3838ae383b3e382bbe383b3e382b92031e69daf000000000000000000000000 ]
addresses=[ 1.2.3.4:1234 [::]:9735 silkroad6ownowfk.onion:9735 4acth47i6kxnvkewtm6q7ib2s3ufpo5sqbsnzjpbi7utijcltosqemad.onion:9735 ]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
bf4dc09910
devtools/decodemsg: decode node_announcement.alias
$ ./devtools/decodemsg 01014bfa4585cb36194ce7c308e8d3d9032ff4e42ed4764a4c6d0a9a58da0a4e57e97fbd463577a5fd14347c60cc7bef2b40bd644337153564320b310b4d155cab1300005b3315de0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c035180266e4e3838ae383b3e382bbe383b3e382b92031e69daf000000000000000000000000004d010102030404d202000000000000000000000000000000002607039216a8b803f3acd758aa260704e00533f3e8f2aedaa8969b3d0fa03a96e857bbb28064dca5e147e934244b9ba50230032607
Before:
WIRE_NODE_ANNOUNCEMENT:
signature=304402204bfa4585cb36194ce7c308e8d3d9032ff4e42ed4764a4c6d0a9a58da0a4e57e902207fbd463577a5fd14347c60cc7bef2b40bd644337153564320b310b4d155cab13
features=[]
timestamp=1530074590
node_id=0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518
rgb_color=[\x02f\xe4]
alias=[\xe3\x83\x8a\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xb3\xe3\x82\xb9 1\xe6\x9d\xaf\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00]
addresses=[\x01\x01\x02\x03\x04\x04\xd2\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&\x07\x03\x92\x16\xa8\xb8\x03\xf3\xac\xd7X\xaa&\x07\x04\xe0\x053\xf3\xe8\xf2\xae\xda\xa8\x96\x9b=\x0f\xa0:\x96\xe8W\xbb\xb2\x80d\xdc\xa5\xe1G\xe94$K\x9b\xa5\x020\x03&\x07]
After:
WIRE_NODE_ANNOUNCEMENT:
signature=304402204bfa4585cb36194ce7c308e8d3d9032ff4e42ed4764a4c6d0a9a58da0a4e57e902207fbd463577a5fd14347c60cc7bef2b40bd644337153564320b310b4d155cab13
features=[]
timestamp=1530074590
node_id=0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518
rgb_color=[0266e4]
alias=[ナンセンス 1杯 e3838ae383b3e382bbe383b3e382b92031e69daf000000000000000000000000 ]
addresses=[010102030404d202000000000000000000000000000000002607039216a8b803f3acd758aa260704e00533f3e8f2aedaa8969b3d0fa03a96e857bbb28064dca5e147e934244b9ba50230032607]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
c02ff11506
print_wire: hand field names to print routines.
This lets us override how we print them.
Also, add dependency on header for devtools/Makefile.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
5aa1f37f07
devtools/Makefile: add devtools/onion.c to DEVTOOLS_TOOL_SRC
This way the object file correctly depends on external headers. Currently
a parallel build on a clean tree can give:
```
In file included from ./common/sphinx.h:6:0,
from devtools/onion.c:5:
./bitcoin/pubkey.h:8:10: fatal error: secp256k1.h: No such file or directory
#include <secp256k1.h>
^~~~~~~~~~~~~
compilation terminated.
<builtin>: recipe for target 'devtools/onion.o' failed
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
cae25ca5db
devtools/print_wire: add return for numerical fields.
Before:
$ ./devtools/decodemsg 0102c2bd3f4a94ff390ce764caf51925d0ed38fa95b6539945b42124f5c4e625da63351380c79230a05550d0e5def9c2412f4f164478f9f9491140e505f79c0d716506226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f00006700000100015afd0da1000000060000000000000000000000010000000a
WIRE_CHANNEL_UPDATE:
signature=3045022100c2bd3f4a94ff390ce764caf51925d0ed38fa95b6539945b42124f5c4e625da630220351380c79230a05550d0e5def9c2412f4f164478f9f9491140e505f79c0d7165
chain_hash=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
short_channel_id=103:1:1
timestamp=1526533537flags=0cltv_expiry_delta=6htlc_minimum_msat=0fee_base_msat=1fee_proportional_millionths=10
After:
WIRE_CHANNEL_UPDATE:
signature=3045022100c2bd3f4a94ff390ce764caf51925d0ed38fa95b6539945b42124f5c4e625da630220351380c79230a05550d0e5def9c2412f4f164478f9f9491140e505f79c0d7165
chain_hash=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
short_channel_id=103:1:1
timestamp=1526533537
flags=0
cltv_expiry_delta=6
htlc_minimum_msat=0
fee_base_msat=1
fee_proportional_millionths=10
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
practicalswift
abf510740d
Force the use of the POSIX C locale for all commands and their subprocesses
7 years ago
Christian Decker
c635396766
common: Moving some bech32 related utilities to bech32_util
These were so far only used for bolt11 construction, but we'll need them for the
DNS seed as well, so here we just pull them out into their own unit and prefix
them.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
7 years ago
Rusty Russell
09c4203767
bolt11: allow multiple fallback addresses.
We can have more than one; eg we might offer both bech32 and a p2sh
address, and in future we might offer v1 segwit, etc.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
9f7d4312ff
bolt11: undo json encoding for description bytes.
We don't handle \u, since we assume everyone sane is using UTF-8. We'd
still have to reject '\u0000' and maybe other weird cases if we did.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
practicalswift
148aaa79d5
Check hex_decode(...) return value
7 years ago
ZmnSCPxj
f9bc0353c4
devtools/onion: Add to gitignore.
7 years ago
Christian Decker
249464ccd2
sphinx: Print test vectors to stderr instead of stdout
7 years ago
Christian Decker
ff6d5e896a
sphinx: Add a dependency form the onion tool to the ccan config
Signed-off-by: Christian Decker <decker.christian@gmail.com>
7 years ago
Christian Decker
d701e52c81
sphinx: Fixed the onion generation and decoding tool
Signed-off-by: Christian Decker <decker.christian@gmail.com>
7 years ago
Christian Decker
08bfb740f5
onion: Move cli onion tool to devtools/onion
Signed-off-by: Christian Decker <decker.christian@gmail.com>
7 years ago
practicalswift
91a9c2923f
Mark intentionally unused parameters as such (with "UNUSED")
7 years ago
ZmnSCPxj
ff1a466ef3
devtools/.gitignore: Ignore decodemsg.
7 years ago
Rusty Russell
fff7dd0826
devtools/decodemsg: new tool.
$ ./devtools/decodemsg 00110000000000000000000000000000000000000000000000000000000000000000000e496e7465726e616c206572726f72
WIRE_ERROR:
channel_id=0000000000000000000000000000000000000000000000000000000000000000
data=[Internal error]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
0610f66c34
bolt11: handle r value fee spec change.
We don't use it yet, but now we'll decode correctly.
See: https://github.com/lightningnetwork/lightning-rfc/pull/317
lightning-rfc commit: ef053c09431442697ab46e83f9d3f86e3510a18e
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
e9f9721ed3
devtools/bolt11-cli: handle hashed descriptions
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
practicalswift
0353ec0983
Remove trailing whitespace
7 years ago
Rusty Russell
1648eb548a
devtools/bolt11-cli: simple helper to decode bolt11.
Can be extended to encode later, for example.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago