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
8 years ago
Christian Decker
943b6526c7
pytest: Configure non-legacy tests correctly and filter legacy
8 years ago
Christian Decker
843e21826a
opts: Remove --regtest flag and pass chainparams to bitcoind
8 years ago
Christian Decker
cf16b5faea
options: Add option to set the network
8 years ago
Christian Decker
df056e5973
bitcoin: Added chainparams grouping blockchain specific parameters
8 years ago
Christian Decker
9370a3cdd2
opening: Fix switched parameters for towire_accept_channel
Turns out we were serializing two parameters in the wrong order.
8 years ago
Christian Decker
8e043fc448
pytest: Consolidating sync_blockheight and fixing flaky test
8 years ago
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.
8 years ago
Rusty Russell
03be40ea8b
lightningd: don't reset balance when we reconnect!
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
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>
8 years ago
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>
8 years ago
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>
8 years ago
Rusty Russell
a87d50acc9
Makefile: clean daemons on clean.
Reported-by: Christian Decker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
7d3e074863
Misc feedback minor fixes.
Reported-by: Christian Decker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
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>
8 years ago
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>
8 years ago
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>
8 years ago
Rusty Russell
87f6a57d75
tests/test_lightningd.py: test closing and shutdown reconnection.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
0c5e238a48
lightningd: handle reconnect during shutdown and closing.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
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>
8 years ago
Rusty Russell
a827d2b2bb
lightningd: add in support for closingd.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
e5a8a7502c
lightningd/closing: subdaemon for closing negotiation.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
d40334ce18
tests/test_lightningd.py: add pay helper for making payments.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
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>
8 years ago
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>
8 years ago
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>
8 years ago
Rusty Russell
35ec22b946
ccan: update to expose io_fd_block() from ccan/io.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
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>
8 years ago
Rusty Russell
7884343c15
tools/generate-wire.py: enums are assignable.
Simplfies their marshalling/unmarshalling.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Christian Decker
a53acb7877
make: Explicitly set cc compatibility
This is apparently necessary to build `lightningd` on debian jessie,
which uses an older gcc version.
8 years ago
Christian Decker
8ba457956a
travis: Run integration tests with and without valgrind on travis
Run one travis build with valgrind on legacy tests, off on new daemon
tests, and another build with the roles switched. Should also speed
this up a bit since we run in parallel.
8 years ago
Rusty Russell
9ec804341c
channeld: fix intermittant failure on reading init msg from master.
As tracked down by Christian; by setting up the master conn first,
we make the master fd async. This means that the synchronous read
(in init_channel) can fail with -EAGAIN, and indeed, Christian
saw this when not running under valgrind.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
249085ac10
channeld: reorder functions more logically.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
4a3c309e84
tests/test_lightningd.py: fix assumption about gossip order
Reported-by: Christian Decker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
9fae82c175
tests: generalize wait_for_log into wait_for_logs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
c05f63a4db
peer_control: fix double-state transition on reconnect.
We actually don't need to transition if we're reconnecting, and logic
to go to CHANNELD_NORMAL was wrong: we checked that we'd seen funding tx
locked, but not that we'd received a msg from the remote peer.
We need to fix the tests now we no longer double-transition, too.
Fixes : #188
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Christian Decker
f9a2f73072
Addressing feedback from PR #187
8 years ago
Christian Decker
70f4484ba8
channeld: Pass through the agreed feerate_per_kw to channeld
We were erroneously using the fee_base which refers to the fees we
require for forwarding transactions instead of the on-chain fees.
8 years ago
Christian Decker
5c80963577
bug: channel_update parameters slipped by one
8 years ago
Christian Decker
5e1dcea5b8
opening: Passing feerate_per_kw through to master
8 years ago
Christian Decker
02aba77698
channel: Passing channel_flags through to channeld
8 years ago
Rusty Russell
ac1172c7b0
lightningd: check scriptpubkey in shutdown.
Important: a non-standard one can make the closing tx not propagate.
Drive-by cut&paste message fix, too.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
4881129f54
peer_fail_permanent: handle take() arg.
We assume this in at least one caller.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
ee9ebbc184
channeld: fix `funding_locked` retransmission using latest revision of BOLT2.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
42c9cb58c7
channeld: rename commit_index to next_index.
This is what it actually is, and makes it clearer when we refer to the
spec. It's the commitment we're currently updating, which is the next
commitment.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
d411b07ba2
channeld: fix make_revocation_msg() to take index of revoke.
It currently takes index + 1 (ie. current commit), which is confusing
in this context.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
1679f2da06
channeld: update to send next commitment number on connection reestablish.
As per latest BOLT revision.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
05b9e0d538
channeld: do connection reestablishment synchronously.
We currently have the problem that the master can send new HTLCs before
we've processed the incoming reestablish message.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
456fa39380
sync_crypto_write: support take(msg)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
de5bf56ffa
opening: update to new open_channel with channel_flags.
While we're there, make the announcement conditional on it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago