Christian Decker
5912c68185
db: Add a hexval helper to decode hex values from db into fields
...
This is going to be handy pretty soon. Channels are almost fully
blobs...
2017-08-10 12:34:58 +09:30
Christian Decker
de822b7ea0
git: Ignore closing daemon
2017-08-10 12:34:58 +09:30
Christian Decker
33ffb53d9e
db: Added schema for peers and channels
2017-08-10 12:34:58 +09:30
Christian Decker
85d2256898
wallet: Use persistent shachain for remote secrets
2017-08-10 12:34:58 +09:30
Christian Decker
1ff64ef07c
wallet: Implement delete for wallet_shachain
2017-08-10 12:34:58 +09:30
Christian Decker
416d6bf860
db: Enable foreign keys and cascade on shachain delete
...
Should make maintenance a bit easier.
2017-08-10 12:34:58 +09:30
Christian Decker
8b7efd01d7
wallet: Created a simple persisted shachain unit-test
...
This exercises the create, read and update functionality of the
persisted shachain.
2017-08-10 12:34:58 +09:30
Christian Decker
34baf05973
wallet: Implement shachain persistence
...
This needed a rather annoying hack since sqlite3 can only store
integers up to 2^63, so I just squash it down/invert it, and hope that
we never ever have more than 2^63 updates.
2017-08-10 12:34:58 +09:30
Christian Decker
b0c64909e7
wallet: Added database schema for shachain persistence
2017-08-10 12:34:58 +09:30
Christian Decker
28cc92cd15
gossip: Use bit 3 (mask 0x08) to signal initial routing sync
...
After quite some back and forth we seem to finally agree on the bit
3 (mask 0x08) to signal optional initial_routing_sync.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-08-09 10:01:33 +09:30
Christian Decker
fbe3a017a9
gossip: Fix crash of getroute if we don't know any channels
...
This happens when we either have no channel open, or didn't announce
the channel. This patch just fails the getroute request. I'll later
add the non-broadcast announcement for local channels that should fix
this for unannounced channels.
2017-08-08 10:23:29 +09:30
Rusty Russell
40895e4550
Update to match spec: "BOLT7: Reorder feature bitmaps in order to allow future changes"
...
aka. a257554456cda98afd1532c302c0e5e84de0455e
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-03 14:26:41 +02:00
Rusty Russell
2b7c091e70
closing: update to match proposal to restart negotiation on reconnect.
...
This simplifies significantly, as we don't need to remember what we offered.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-02 11:45:30 +09:30
Christian Decker
b1ded66d35
fix: Mispelled word in the README.md
...
Fixes #198
Reported-by: Toshiro Takahashi @toshirot
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-07-31 13:45:13 +02:00
Christian Decker
35847206b2
fix: Allow pings while waiting for the channel to lock
...
This was causing failures on testnet where confirmations are not
immediate.
Reported-by: Fabrice Drouin @sstone
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-07-22 09:52:14 +09:30
Christian Decker
2bf92c9063
peer: Check localfeatures and globalfeatures against what we support ( #195 )
...
We support a number of features already, so failing connections
whenever we see an even bit set is not a good idea. This turned out to
kill our connections to eclair.
Also, the spec says that the LSB / bit 0 is to be counted as index 0, and
therefore even. So we need to check the lower of each 2-bit-tuple not
the higher one.
2017-07-16 10:38:26 +09:30
Christian Decker
75de4476f3
cleanup: Addressing comments from #165
...
Thanks @rustyrussell for the feedback :-)
2017-07-15 13:51:48 +02:00
Christian Decker
7dc693963d
script: Consolidate scripts to use pubkey_to_hash160
2017-07-15 10:19:33 +09:30
sstone
f371b6df20
sphinx: fix payload amount encoding
...
it was changed to 64 bits
2017-07-14 19:27:33 +02:00
Christian Decker
2c0b52fb77
bitcoin: Make chainparams const
...
`cli` and `cli_args` were not `const` before since they are added to a
non-`const` array. Using `cast_const` we can keep them `const` without
unsafe cast.
Reported-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-07-13 15:36:50 +02:00
Christian Decker
5fdb8a58aa
fix: Addressing feedback from PR #192
2017-07-12 13:16:00 +02:00
Christian Decker
83c8c3fc52
opening: Use the correct chainparams to open a channel
...
We were using the bitcoin genesis blockhash for all networks, which is
not correct, and would result in the open being aborted when talking
to other implementations.
Reported-by: @sstone and @pm47
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-07-12 11:30:23 +09:30
Christian Decker
fbc2b65a3d
opening: Pass network_index through to openingd
...
This is needed in order to open channels with the correct
genesis_blockhash.
Reported-By: @sstone
2017-07-12 11:30:23 +09:30
Christian Decker
943b6526c7
pytest: Configure non-legacy tests correctly and filter legacy
2017-07-12 11:30:23 +09:30
Christian Decker
843e21826a
opts: Remove --regtest flag and pass chainparams to bitcoind
2017-07-12 11:30:23 +09:30
Christian Decker
cf16b5faea
options: Add option to set the network
2017-07-12 11:30:23 +09:30
Christian Decker
df056e5973
bitcoin: Added chainparams grouping blockchain specific parameters
2017-07-12 11:30:23 +09:30
Christian Decker
9370a3cdd2
opening: Fix switched parameters for towire_accept_channel
...
Turns out we were serializing two parameters in the wrong order.
2017-07-12 11:00:26 +09:30
Christian Decker
8e043fc448
pytest: Consolidating sync_blockheight and fixing flaky test
2017-07-12 11:00:26 +09:30
Christian Decker
1a1e29a4bc
gossip: Re-initiate the broadcast timer upon reconnect
...
We weren't registering reconnecting peers for broadcasts. Just
starting a timer is enough. Also added an integration test to check
that the gossip sync is being resumed.
2017-07-12 11:00:26 +09:30
Rusty Russell
03be40ea8b
lightningd: don't reset balance when we reconnect!
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
8b71ea924a
lightningd: don't crash when simply using closingd just for retransmission.
...
test_closing_negotiation_reconnect (__main__.LightningDTests) ... peer state CLOSINGD_COMPLETE should be CLOSINGD_SIGEXCHANGE
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
7dce850844
Makefile: wallet objects depend on sodium headers, too.
...
Noticed a build failure from a fresh git clone.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
f04222cb12
test_lightningd.py: make pay helper use random label if we don't care.
...
Suggested-by: Christian Decker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
a87d50acc9
Makefile: clean daemons on clean.
...
Reported-by: Christian Decker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
7d3e074863
Misc feedback minor fixes.
...
Reported-by: Christian Decker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
87232ec25c
lightningd: new peer state CLOSINGD_COMPLETE.
...
This is a transitional state, while we're waiting to see the
closing tx onchain (which is To Be Implemented).
The simplest way to do re-transmission is to re-use closingd, and just
disallow any updates.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
c1f21b9fce
lightningd/peer_control.c: rename peer->balance.
...
I made the mistake of thinking it was a [NUM_SIDES] array, but
it's actually our balance, and it's in millisatoshi. Rename
for clarity.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
4223a91842
lightningd: update daemon list.
...
This is used to check that versions are correct on startup.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
87f6a57d75
tests/test_lightningd.py: test closing and shutdown reconnection.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
0c5e238a48
lightningd: handle reconnect during shutdown and closing.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
0c07856ae4
lightningd/peer_control.c: remove unnecessary reconnected field.
...
It can be on the stack.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
a827d2b2bb
lightningd: add in support for closingd.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
e5a8a7502c
lightningd/closing: subdaemon for closing negotiation.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
d40334ce18
tests/test_lightningd.py: add pay helper for making payments.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
728593702f
close_tx: trim based on dust level.
...
Saves the caller doing it (though legacy doesn't trim at all!).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
6fa90c926a
channeld: exit after shutdown when no more HTLCs.
...
Ready for the introduction of closingd.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
80886cda8a
daemon_conn: fix daemon_conn_sync_flush.
...
We need to set fd to blocking before trying to sync write. Use
io_fd_block() elsewhere, too.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
35ec22b946
ccan: update to expose io_fd_block() from ccan/io.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
94a33a7d15
channeld: use an enum side not a bool for funder/
...
This predated our handling of enums.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30