Rusty Russell
b1738c5b89
tools: fix 32 bit compile error
...
```
tools/test/enum.c: In function ‘fromwire_test_enum’:
tools/test/enum.c:11:34: error: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘size_t {aka unsigned int}’ [-Werror=format=]
printf("fromwire_test_enum at %ld\n", *max);
```
and:
```
devtools/print_wire.c: In function ‘printwire_tlvs’:
devtools/print_wire.c:201:22: error: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘u64 {aka long long unsigned int}’ [-Werror=format=]
printf("**TYPE #%ld UNKNOWN for TLV %s**\n", type, fieldname);
^
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-25 11:41:48 +08:00
lisa neigut
281b4c241e
bolt-gen: fixup the devtool/decodemsg printing facility
...
Fixup TLV handling in the bolt printing utility, `devtools/decodemsg`
2019-07-24 02:52:53 +00:00
Rusty Russell
b4455d517c
common/node_id: new type.
...
Node ids are pubkeys, but we only use them as pubkeys for routing and checking
gossip messages. So we're packing and unpacking them constantly, and wasting
some space and time.
This introduces a new type, explicitly the SEC1 compressed encoding
(33 bytes). We ensure its validity when we load from the db, or get it
from JSON. We still use 'struct pubkey' for peer messages, which checks
validity.
Results from 5 runs, min-max(mean +/- stddev):
store_load_msec,vsz_kb,store_rewrite_sec,listnodes_sec,listchannels_sec,routing_sec,peer_write_all_sec
39475-39572(39518+/-36),2880732,41.150000-41.390000(41.298+/-0.085),2.260000-2.550000(2.336+/-0.11),44.390000-65.150000(58.648+/-7.5),32.740000-33.020000(32.89+/-0.093),44.130000-45.090000(44.566+/-0.32)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-04-09 12:37:16 -07:00
Rusty Russell
28f5da7b2f
tools/generate-wire: use amount_msat / amount_sat for peer protocol.
...
Basically we tell it that every field ending in '_msat' is a struct
amount_msat, and 'satoshis' is an amount_sat. The exceptions are
channel_update's fee_base_msat which is a u32, and
final_incorrect_htlc_amount's incoming_htlc_amt which is also a
'struct amount_msat'.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-21 08:01:37 +00:00
practicalswift
0f7b11bdc2
Remove redundant code
2018-08-02 15:58:14 +09:30
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>
2018-07-17 12:32:00 +02:00
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>
2018-07-01 14:55:29 +02:00
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>
2018-07-01 14:55:29 +02:00
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>
2018-07-01 14:55:29 +02:00
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>
2018-07-01 14:55:29 +02:00
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>
2018-05-19 15:52:56 -04:00
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>
2018-02-02 00:57:10 +00:00