Rusty Russell
be4af38d0c
channel: unwrap and send incoming HTLCs to master.
...
So far it just looks it up, marks it resolved, then does nothing.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-04-01 23:59:46 +10:30
Rusty Russell
eb61446ec8
daemon/invoice: wean off dstate (a little), link into new daemon.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-04-01 23:59:46 +10:30
Rusty Russell
27764b65f9
lightningd: fix shachain to be 48-bits, with hack for legacy.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-04-01 23:59:46 +10:30
Rusty Russell
0197353bd9
lightningd/Makefile: put timeout into OLD_LIB_SRC for all daemons.
...
And remove the now-redundant mention in gossipd.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-04-01 23:59:46 +10:30
Rusty Russell
47da80fdca
lightningd: dev_newhtlc command.
...
For testing point-to-point HTLCs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-04-01 23:59:46 +10:30
Rusty Russell
185a649572
lightningd: include daemon/sphinx.
...
We're going to need it to make routes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-04-01 23:59:46 +10:30
Rusty Russell
cf6d25cad6
lightningd/connection: rename to lightningd/daemon_conn
...
To match the structure name.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-20 07:50:53 +10:30
Rusty Russell
4bf398c4e7
status: move into lightningd/status.
...
It's really a lightningd-only thing, and we're about to do surgery on it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-20 07:50:53 +10:30
Christian Decker
74df755a29
gossip: Added nested message types for getnodes query
...
Added a struct that represents a single entry in a `getnodes` reply,
so that we can append one after the other and parse them again on the
other side.
2017-03-15 21:32:55 +01:00
Christian Decker
408d2f5170
Async connection abstraction
...
This is an attempt at unifying all the async connection handling into
a reusable module.
2017-03-13 11:26:48 +01:00
Rusty Russell
da5c7e0a08
daemon/subdaemon: remove in favor of daemon/subd.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-11 07:19:41 +10:30
Rusty Russell
95f41287f0
lightningd/subd: new code for subdaemons.
...
This uses a single fd for both status and control.
To make this work, we enforce the convention that replies are the same
as requests + 100, and that their name ends in "_REPLY".
This also means that various daemons can simply exit when done; there's
no race between reading request and closing status fds.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-10 21:45:55 +10:30
Rusty Russell
cd62b74b1c
lightningd/msg_queue: helper for queues of messages/
...
Since they're short, we use a simple array. This can be replaced later.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-10 21:45:55 +10:30
Rusty Russell
9035d281c6
lightningd/lightningd: hook in channel daemon.
...
Doesn't do much yet except wait for funding confirmation.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-07 12:01:43 +10:30
Rusty Russell
9014f2593e
lightningd/channel: normal operation daemon.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-07 11:56:12 +10:30
Rusty Russell
c64447a929
lightningd/derive_basepoints: hoist derivation logic.
...
All the daemons will use a common seed for point derivation, so drag
it out of lightningd/opening.
This also provide a nice struct wrapper to reduce argument count.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-07 11:37:06 +10:30
Rusty Russell
6a14e24a82
lightningd: integrate bitcoind.
...
This allows us to broadcast transactions and watch for them.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-07 11:26:38 +10:30
Rusty Russell
e6efcdf5bd
daemon/bitcoind: wean off struct lightningd_state.
...
We want to use this in the new daemon, so use 'struct bitcoind'
everywhere.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-02 22:51:49 +10:30
Rusty Russell
9aebd5c797
lightningd: add opening to dependencies.
...
Without this, make check doesn't rebuild opening subdaemon.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-02 22:51:49 +10:30
Rusty Russell
fd258fe495
lightningd: wire up opening daemon.
...
Now we can actually open a channel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-24 16:22:56 +10:30
Rusty Russell
edc30b12ea
lightningd: --dev-debugger=<subdaemon>
...
Or for blackbox tests --gdb1=<subdaemon> / --gdb2=<subdaemon>.
This makes the subdaemon wait as soon as it's execed, so we can attach
the debugger.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-24 16:22:56 +10:30
Rusty Russell
89af53267b
lightningd/peer_failed: helper to send PKT_ERR and exit daemon.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-24 16:22:55 +10:30
Rusty Russell
5475666b7e
lightningd: simple wallet support.
...
This allows us to add funds via the P2SH-wrapped Segwit Transactions.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:19:02 +10:30
Rusty Russell
065f11b42a
lightningd/opening: opening daemon.
...
This conducts the conversation up until we have the txid to wait for
(or broadcast).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:29 +10:30
Rusty Russell
e3f2d72d4d
crypto_sync: synchronous routines for inter-peer crypto.
...
This is used by the opening daemon, for example.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:29 +10:30
Rusty Russell
891a915e0f
hsm: return BIP32 public seed on initialization.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:29 +10:30
Rusty Russell
fddb38126d
utxo: wire support for unspent transactions.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:29 +10:30
Rusty Russell
4a7418e3db
channel: object to track channel state.
...
This object is basically the embodyment of BOLT #2 . Each HTLC already
knows its own state; this moves them between states and keeps them
consistent.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +10:30
Rusty Russell
20a07d860a
check-source: include tests, libdir.
...
And fix the resulting issues.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +10:30
Rusty Russell
e11d9304ab
lightningd/hbtlc_tx: creation of BOLT 3 htlc transactions.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-07 12:14:22 +10:30
Rusty Russell
f9189254e4
lightningd/commit_tx: creation of BOLT 3 commitment transaction.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-07 12:14:22 +10:30
Rusty Russell
b290a96a4a
lightningd: use daemon/htlc_state.c
...
We're about to need HTLC handling.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-07 12:14:22 +10:30
Rusty Russell
be46fdf254
lightningd/funding_tx.c: helper to create a funding transaction (with change).
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-07 12:14:21 +10:30
Rusty Russell
75c6dd1981
channel_config: convenient structure for handling open/accept config info.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-07 12:14:21 +10:30
Rusty Russell
dc3b27e1d3
key_derive: key derivation from basepoints as specified in BOLT 3
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-07 12:14:21 +10:30
Christian Decker
76e2c980e1
gossip: Moving to intmap-based broadcast for the legacy daemon
...
Moved the broadcast functionality to broadcast.[ch]. So far this
includes only the enqueuing side of broadcasts, the dequeuing and
actual push to the peer is daemon dependent. This also adds the
broadcast_state to the routing_state and the last broadcast index to
the peer for the legacy daemon.
2017-02-03 05:52:11 +10:30
Rusty Russell
6bf3c30a10
lightningd/Makefile: fix check-source
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-13 10:51:57 +10:30
Christian Decker
b41d71da30
Makefile: Making sure header vars are populated correctly
...
The problem with wire headers not being generated in time before stuff
depended on it turns out to be related with inclusion order of
sub-makefiles. The inclusions must preceed the use of
LIGHTNINGD_HEADERS since they append to that variable.
2017-01-13 10:50:07 +10:30
Rusty Russell
33748bf119
lightningd/Makefile: combine all headers (wire/gen was missing)
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-11 10:15:27 +10:30
Rusty Russell
73d07ce441
libsodium: use our local submodule.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-11 10:04:26 +10:30
Rusty Russell
3af081aded
Makefile: make all lightningd objects depend on all lightningd headers.
...
Christian reported that we weren't generating some gen_ files.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-11 09:16:29 +10:30
Rusty Russell
83b156517f
lightningd/lightningd: maintain "condition" for each peer.
...
This lets us return better messages to the connect json command on failure.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:33 +10:30
Rusty Russell
c536616bee
lightningd/lightningd: wire up lightningd_gossip.
...
Now we hand peers off to the gossip daemon, to do the INIT handshake and
re-transmit/receive gossip. They may stay there forever if neither we nor
them wants to open a channel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:33 +10:30
Rusty Russell
21a5c62ead
lightningd_gossip: daemon to look after peers which don't a channel (yet)
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:33 +10:30
Rusty Russell
bf118f1b86
lightningd/lightningd: add connect command.
...
Unlike the old daemon, this just connects; a separate command will be needed
to create a channel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:33 +10:30
Rusty Russell
211491f4d7
lightningd/lightningd: add lightning_handshake.
...
Now we do crypto handshake when peer comes in.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:33 +10:30
Rusty Russell
32e1b5bb06
lightningd/handshake: simple daemon to do BOLT 8 crypto handshake.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:33 +10:30
Rusty Russell
0444d68197
lightningd/lightningd: add rpc interface.
...
daemon/lightning-cli works with this.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:33 +10:30
Rusty Russell
542e6844f7
lightningd/lightningd: start HSM at initialization time.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:33 +10:30
Rusty Russell
10b8dc5950
lightningd/hsm: simple daemon to control the keys.
...
This provides APIs to access the keys.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:33 +10:30
Rusty Russell
89a06734c4
lightningd/cryptomsg: test routines.
...
This creates output similar to the BOLT #8 test vectors.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:33 +10:30
Rusty Russell
a7f682c66e
lightningd/cryptomsg: routines to encrypt on the wire.
...
After the handshake, it's a simple matter of AEAD and key rotation.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:33 +10:30
Rusty Russell
faebb87d01
lightningd/subdaemon: routines to create daemons and get request/response.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:33 +10:30
Rusty Russell
8bf33c7839
lightningd/lightningd: daemon for controlling the other daemons.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:37:51 +10:30