Rusty Russell
a25e2816e9
type_to_string: add secp256k1_pubkey
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-25 11:03:55 +10:30
Christian Decker
66175c7361
Merge pull request #115 from ElementsProject/pytest-pathfix
...
pytest: don't assume paths of valgrind and bitcoind.
2017-01-24 14:22:23 +01:00
Rusty Russell
1575181ef5
pytest: don't assume paths of valgrind and bitcoind.
...
In particular, my bitcoind is in /usr/local/bin
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-24 14:37:56 +10:30
Rusty Russell
1c49af7486
Merge pull request #114 from cdecker/pytest-new
...
pytest: Add support for both legacy and new daemons
2017-01-24 13:36:47 +10:30
Christian Decker
1948062250
pytest: Using python-bitcoinlib instead of python-bitcoinrpc
...
The latter is unmaintained and has a number of problems.
2017-01-23 10:37:34 +01:00
Christian Decker
180c96776b
pytest: Split the python integration tests into new and legacy
2017-01-23 10:37:34 +01:00
Christian Decker
5f61b3a272
pytest: Separating new lightningd and legacy lightningd RPC client
...
We intend to ultimately no longer use the legacy `daemon/lightningd`
and instead use `lightningd/lightningd`, so I grouped the new RPC and
the legacy RPC and implemented stubs for the new daemon.
2017-01-23 10:37:34 +01:00
Christian Decker
091c2fc8f5
log: Flushing logs on each new entry
...
This is to speed up the python testing framework and should not have a
big impact on performance.
2017-01-23 10:37:34 +01:00
Christian Decker
7cc5e2fc7a
pytest: Added pytest target to Makefile
2017-01-23 10:45:36 +10:30
Christian Decker
cf1c03f4d9
pytest: Implemented initial python integration tests.
2017-01-23 10:45:36 +10:30
Christian Decker
41a5e74db9
pytest: Implement utilities for python unittests
2017-01-23 10:45:36 +10:30
Christian Decker
cd9bb9b014
contrib: Implemented python RPC client
2017-01-23 10:45:36 +10:30
Christian Decker
3f79a0e117
log: Flushing logs on every line
...
This is needed for the new testing framework since we wait for
messages to be printed on stdout. Buffering delays this
arbitrarily. Flushing so often should not have much of a performance
impact.
2017-01-23 10:45:36 +10:30
Rusty Russell
2fb2e757ae
doc: add lightning-waitinvoice man page.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-23 10:39:43 +10:30
Rusty Russell
69079e51a9
doc: move Makefile parts into doc/
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-23 10:38:42 +10:30
Rusty Russell
df59cef3af
doc: rename waitinvoice manpage to waitanyinvoice.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-23 10:28:32 +10:30
Christian Decker
d6ccf90063
jsonrpc: Renamed awaitpayment
-> waitinvoice
-> waitanyinvoice
...
As suggested by Rusty
2017-01-23 10:22:13 +10:30
Christian Decker
1a9bfe7be4
jsonrpc: Added awaitpayment
method
...
`awaitinvoice` can be used to wait on a specific invoice to be
completed. If the invoice was previously paid, then the command
returns immediately, otherwise it'll block until the invoice is
paid. This complements `waitinvoice` which uses a highwatermark and
waits for the next invoice. I found waitinvoice a bit hard to use
since it doesn't allow waiting for a specific invoice to be completed,
just the next in the insertion order.
2017-01-23 10:22:13 +10:30
Christian Decker
ba83430b5f
trivial: Removing unused constant
2017-01-22 16:19:11 +01:00
Christian Decker
cae283087d
sphinx: Committing the onion packet to the payment-hash
...
The sphinx onion packet now commits to the HTLC payment-hash it is
associated with. This prevents replay attacks with the same onion.
2017-01-16 11:14:30 +10:30
Christian Decker
91b17d45d8
sphinx: Removing last vestiges of the end-to-end payload
...
So far this was simply set to a zero-length end-to-end payload. We
don't have any plans of re-adding it for the moment, so let's get rid
of the unused code.
2017-01-16 11:14:15 +10:30
Christian Decker
285b8b4698
sphinx: Use libsecp256k1 to generate shared secrets
...
So far we did it on our own, but since the spec specifies that we use
the libsecp256k1 version anyway, we can remove our own implementation.
2017-01-16 11:08:36 +10:30
Christian Decker
679dec3e6a
sphinx: Actually use the full pubkey in ECDH key generation
...
The spec says that we use the libsecp256k1 style ECDH, which uses the
full compressed pubkey from the scalar multiplication which is then
hashed. This is in contrast to the btcsuite implementation which was
only using the hashed X-coordinate.
2017-01-16 11:08:36 +10:30
Christian Decker
3d20cf559a
gitignore: Ignoring some of the test-binaries.
2017-01-13 19:45:53 +01:00
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
91209d4d66
ccan: forgotten test files after last update.
...
Also add ccan/config.h to .gitignore.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-11 10:17:33 +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
1c6e28eaac
libsodium: add as submodule.
...
We need 1.0.9+ for the IETF chacha variants; Ubuntu xenial only ships
with 1.0.8.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-11 09:29:40 +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
1e34e5344d
lightningd/lightningd: add getpeers command.
...
This has an optional log level if you want to see logs for the peers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:34 +10:30
Rusty Russell
dc8b174e3a
lightningd/lightningd: maintain a per-peer log.
...
At the moment we just log each condition change.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:33 +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
7aaffda779
lightningd/lightningd: finish connect command once gossip started.
...
This is after the INIT message is received, so we know there are no
incompatible features.
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
1800e84db7
subdaemon: callback to handle subdaemon status updates.
...
It's a bit messy, since some status messages are accompanied by an FD:
in this case, the handler returns STATUS_NEED_FD and we read that then
re-call the handler.
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
03758af4e1
lightningd/lightningd: create unique ID for each peer.
...
This distinguishes them before they have an ID, and also if the daemon
doesn't know the ID.
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
78841456e0
lightningd/handshake: test handshake, produce BOLT 8 test vectors.
...
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
6f5fed17d8
lightningd/test: simple black-box tests.
...
These use the same infrastructure as the daemon/test blackbox tests,
so they're not currently wired into make check; use make
"lightningd-blackbox-tests".
2017-01-10 15:38:33 +10:30
Rusty Russell
e39d09d5a5
daemon/test/scripts: maek slightly more general for lightningd/lightningd
...
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
015eb072b8
Makefile: split CORE_SRC into CORE_SRC, CORE_TX_SRC and CORE_PROTOBUF_SRC
...
With the lightningd daemon split, we don't need them all.
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
6a089ce112
cryptomsg: add towire/fromwire for crypto state.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:38:33 +10:30