Rusty Russell
4a54884d4b
gossipd: routing benchmark.
...
Initial run (100,000 nodes):
$ ./gossipd/test/run-bench-find_route 100000 1 > /tmp/out
=> 15646 msec
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-18 22:03:31 +01:00
Rusty Russell
745c7b223a
gossipd/routing: make local functions static.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-18 22:03:31 +01:00
Christian Decker
e154f4a019
pytest: Minor cleanup
...
Now using assertRaisesRegex instead of try-except and added restart to
nodes.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-12-17 02:44:20 +00:00
Christian Decker
a8a6d1d669
channel: Directly send announcements and updates to gossipd
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-12-17 02:44:20 +00:00
Christian Decker
32a96973a5
pytest: Fix a flaky channel_reenable test
...
It was relying on the message order instead of waiting the desired
state.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-12-17 02:44:20 +00:00
Rusty Russell
94711969f9
gossipd: hand out gossip_index to other daemons.
...
When gossipd sends a message, have a gossip_index. When it gets back a
peer, the current gossip_index is included, so it can know exactly where
it's up to.
Most of this is mechanical plumbing through openingd, channeld and closingd,
even though openingd and closingd don't (currently) read gossip, so their
gossip_index will be unchanged.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-17 02:44:20 +00:00
Rusty Russell
6afc7dcc09
gossipd: don't increment broadcast_index until *after* message sent.
...
If the peer is moved from remote to local, this may be lost; it's more
secure to increment after we've sent the broadcast.
2017-12-17 02:44:20 +00:00
Rusty Russell
67aa95c194
gossipd: hand back peer, don't hand a new peer.
...
All peers come from gossipd, and maintain an fd to talk to it. Sometimes
we hand the peer back, but to avoid a race, we always recreated it.
The race was that a daemon closed the gossip_fd, which made gossipd
forget the peer, then master handed the peer back to gossipd. We stop
the race by never closing the gossipfd, but hand it back to gossipd
for closing.
Now gossipd has to accept two fds, but the handling of peers is far
clearer.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-17 02:44:20 +00:00
Rusty Russell
8832925122
gossipd: don't hand length to route code, it's implied.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-17 02:44:20 +00:00
Rusty Russell
b83ac58a98
subd: if a required daemon exits, wait instead of killing it.
...
Otherwise we always say it died because we killed it, so we don't get
the exit status.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-17 02:44:20 +00:00
Rusty Russell
36746bf65a
Makefile: make gossipd objects depend correctly on its own headers.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-17 02:44:20 +00:00
Rusty Russell
bcfbc24308
gossipd: split peer structure to clearly separate local and remote fields.
...
We should also go through and use consistent nomenclature on functions which
are used with a local peer ("lpeer_xxx"?) and those with a remote peer
("rpeer_xxx"?) but this is minimal.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-17 02:44:20 +00:00
Rusty Russell
0cab9d1dd1
daemon_conn: helper to release daemon_conn.
...
We'll want this for the next change, where gossipd migrates remote peers
back to local ones.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-17 02:44:20 +00:00
Rusty Russell
8ed511b3c7
test_lightningd: add test for funding failures.
...
We should not disconnect from a peer just because it fails opening; we
should return it to gossipd, and give a meaningful error.
Closes : #401
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-17 02:44:20 +00:00
Rusty Russell
97434d9c4a
openingd: handle ERROR packets (if other end fails negotiation).
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-17 02:44:20 +00:00
Rusty Russell
6b232de7b1
openingd: return to master for more gossip when negotiation fails.
...
We can open other channels, if we want.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-17 02:44:20 +00:00
Rusty Russell
afea2520ba
wireaddr: marshal empty address properly.
...
On unmarshal, we stop unmarshaling on a 0 (ADDR_TYPE_PADDING) type. So
we should also stop marshaling in that case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-17 02:44:20 +00:00
Rusty Russell
899bf3fde9
subd: add transaction to subd exit corner case.
...
As demonstrated in the test at the end of this series, openingd dying
spontaneously causes the conn to be freed which causes the subd to be
destroyed, which fails the peer, which hits the db.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-17 02:44:20 +00:00
Rusty Russell
20d7ddcb6e
json_fund_channel: give more details than "peer died".
...
Rather than using the destructor, hook up the cmd so we can close it.
peers are allocated off ld, so they are only destroyed explicitly.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-17 02:44:20 +00:00
Christian Decker
a0724f45af
routing: Do not set an empty channel_announcement if none is given
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-12-17 02:44:20 +00:00
Christian Decker
4a51de44c0
gossip: Forward when we don't have a valid node_announcement yet
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-12-17 02:44:20 +00:00
Christian Decker
580a2612fd
routing: Add local and sigfail to trace when receiving cannounce
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-12-17 02:44:20 +00:00
Christian Decker
ba45ccffd8
routing: Return boolean from handle_channel_announcement
...
This will later be used to determine whether or not we should announce
ourselves as a node.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-12-17 02:44:20 +00:00
Christian Decker
b5f737e563
gossip: Passing alias, color and wireaddrs through to gossipd
...
First step towards `gossipd` managing the `node_announcement`.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-12-17 02:44:20 +00:00
Christian Decker
67c6d4d1f1
opts: Change alias to be u8*, better matches the unicode nature
...
We are still generating only char* style aliases, but the field is
defined to be unicode, which doesn't mix too well with char.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-12-17 02:44:20 +00:00
Christian Decker
19c030ea1f
routing: Make routing_state aware of its own ID
...
This is used to identify our own announcements.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-12-17 02:44:20 +00:00
Christian Decker
8d6281175d
gossip: Remove HSM_FD from handshake
2017-12-17 02:44:20 +00:00
ZmnSCPxj
4022fc0034
wallet.c: Minor leak in wallet_invoices_load.
2017-12-15 10:41:54 +00:00
ZmnSCPxj
44c37b60e4
Add test for withdrawing to P2WPKH and P2WSH.
2017-12-14 03:36:40 +00:00
ZmnSCPxj
e26d294b60
Add support for withdrawing to BECH32 addresses.
...
Fixes : #428
2017-12-14 03:36:40 +00:00
ZmnSCPxj
8512e2c8ef
README.md: Add link to waitanyinvoice
2017-12-14 03:07:20 +00:00
Rusty Russell
bbbbb60863
wallet: don't leak string on update.
...
We actually don't need tal_fmt() here at all, anyway.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-13 22:46:10 +01:00
Rusty Russell
5a319c781c
wallet: don't leak UTXO array on extracting outputs.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-13 22:46:10 +01:00
Rusty Russell
9747d1a62c
database: don't leak query string.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-13 22:46:10 +01:00
Rusty Russell
65fd7ce132
bitcoind: don't leak memory on every call to bitcoin-cli.
...
Fixes : #412
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-13 22:46:10 +01:00
Rusty Russell
b00525b8c8
options: don't leak memory when people override options.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-13 22:46:10 +01:00
Rusty Russell
005f3826c9
wallet/tests: add mocks for futureproofing.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-13 22:46:10 +01:00
Rusty Russell
2931760b5b
wallet: move tests into test/ dir like other unit tests.
...
Trivial move, but makes it easy to add new ones.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-13 22:46:10 +01:00
ZmnSCPxj
757d45c8a3
Test withdrawal to P2SH address.
2017-12-13 03:10:04 +00:00
ZmnSCPxj
9842898ca4
Add support for withdrawing to P2SH addresses.
2017-12-13 03:10:04 +00:00
ZmnSCPxj
d43fb87871
Factor out scriptpubkey_from_address function from json_withdraw.
2017-12-13 03:10:04 +00:00
ZmnSCPxj
9f481226fa
Rearrange checking of withdrawal address parsing success in json_withdraw.
2017-12-13 03:10:04 +00:00
ZmnSCPxj
b56fea8b2a
Modify hsm_sign_withdrawal to transmit scriptpubkey to withdraw to, rather than pkh.
2017-12-13 03:10:04 +00:00
ZmnSCPxj
5fd74f9933
Change withdraw_tx to accept scriptpubkey rather than plain address.
2017-12-13 03:10:04 +00:00
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>
2017-12-12 11:45:44 +01:00
Rusty Russell
e9f9721ed3
devtools/bolt11-cli: handle hashed descriptions
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-12 11:45:44 +01:00
Christian Decker
34444a99f9
docker: Added clang to build dependencies
2017-12-12 02:31:03 +00:00
Christian Decker
7572c22a26
travis: Add clang build to build matrix
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-12-12 02:31:03 +00:00
Christian Decker
61852b4603
cleanup: Use check_act* in handshake and remove unused static inline
...
This was tripping up `clang`.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-12-12 02:31:03 +00:00
practicalswift
486d321094
Avoid NULL pointer dereference in channelseq(...)
2017-12-11 16:07:57 +01:00