Rusty Russell
be46fdf254
lightningd/funding_tx.c: helper to create a funding transaction (with change).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
1bb66cde2a
bitcoin/scrpt: add vanilla p2pkh support.
We are about to use it for our funding tx change output.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
75c6dd1981
channel_config: convenient structure for handling open/accept config info.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
dc3b27e1d3
key_derive: key derivation from basepoints as specified in BOLT 3
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
e899c47260
bitcoin/base58: don't segv if key_to_base58 / key_from_base58 called first.
We need to initialize b58_sha256_impl here too.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
4ed259c46c
gen_peer_wire_csv: update for latest spec.
We have a separate announcement_signatures message now.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Christian Decker
eb75ae55e4
cleanup: Removed broadcast_queue from dstate
This is a left-over from the gossip refactoring.
8 years ago
Christian Decker
c2764c10c5
broadcast: Implement replacing messages in the broadcast queue
If type and tag match, then we replace any existing message in the
queue. This allows us to drop old announcements. Special care needs to
be taken so that dependent messages are not reordered, but for gossip
this is the case, since the `channel_announcement` cannot be updated.
8 years ago
Christian Decker
6e63429fab
gossip: Cleanup queued_message
The list and timestamp are no longer used since we are using the
intmap based broadcast queue.
8 years ago
Christian Decker
fb814a7a9e
gossip: Adding announcement handling to the gossip subdaemon.
We now have all the pieces to wire in the handling functionality to
the new gossip subdaemon.
8 years ago
Christian Decker
9de880dce7
refactor: Move the gossip handlers to routing
Moving the common functionality out of p2p_announce, sharing it
between legacy and subdaemon architecture.
8 years ago
Christian Decker
d966961fbe
gossip: Refactoring the gossip handlers to use the routing_state
8 years ago
Christian Decker
d200a16988
irc: Rename irc handlers to avoid name clash
8 years ago
Christian Decker
92bc0abdc3
refactor: Move JSONRPC methods to separate compilation unit
This allows us to not care too much about bringing JSON into the new
subdaemons.
8 years ago
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.
8 years ago
Christian Decker
3aa45a6d0b
refactor: Moving write_ip and read_ip into routing.h
Further reduction in things in p2p_message so we can deprecate it
later.
8 years ago
Christian Decker
2a7e757053
refactor: Moving functionality out of p2p_announce
Further decoupling the old daemons from the new daemons.
8 years ago
Christian Decker
2c06524165
refactor: Moving legacy sync method out of routing
This was the only time we actually reference non-routing structs in
routing, so moving this out should allow us to get it working in the
new subdaemons.
8 years ago
Christian Decker
5d10093da3
refactor: Moving the node_map definition into routing.h
This allows us to move some legacy functions closer to where they are
actually used, and not worry about them when including routing.h into
the new subdaemons. `struct peer` is the main culprit here.
8 years ago
Christian Decker
3cb576d69d
refactor: Moving gossip/routing specific state into its own struct
This used to be part of `lightningd_state` which is being split up for
the various subdaemons. The main change is the addition of the `struct
routing_state` in `routing.h` and the addition of `rstate` in `struct
lightningd_state` for backwards compatibility.
8 years ago
Rusty Russell
a600b1a30f
handshake: hand in client fd on exec instead of gratuitous fd passing.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
13a30ff79c
subdaemon: close unused fds when creating subdaemon.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
2f9b04b0d9
subdaemon: start fds at 3 not 4.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
940053d000
htlc: move enum side crom daemon/channel.h to daemon/htlc.h
lightningd wants htlcs, but not the old struct channel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
7d68554787
type_to_string: add secp256k1_ecdsa_signature.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
25a37fafae
type_to_string: add privkey.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
d97e3489a0
daemon/htlc_state: split off from daemon/htlc.
We want to use struct htlc inside lightningd, and we need the state
bits.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
c6997f15c7
bitcoin/preimage: struct preimage.
We had a hack for 'struct rval' in protobuf_convert.h; make an
explicit header and put it in bitcoin/preimage.h. It's not really
bitcoin-specific, but it's better than having bitcoin/script depend on
an external header.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
279f216208
gen_peer_wire_csv: update to latest spec.
In particular, 860990fa0afb55f839e882a5e9abe8abe6ccb981 reordered
channel_announcement and c93bf5cf8c48eab1b028e85214cb35feeeffcbb3
reordered the update_fail_malformed_htlc message.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
f9eea9041e
handshake: update for BOLT 8 latest revision.
This now matches commit fc4846a27bf420c591ba0b024cc34972816913c7,
and fixes "make check-source".
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
a02f1e10c4
make check: run all the tests.
We can't run them in parallel, but we can at least have 'make check'
run them all.
Developers should be running "make check-source && make check".
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Christian Decker
05cf3160d4
ccan: Added ccan/intmap
8 years ago
Rusty Russell
999472d99a
bitcoin: fix script number encoding.
Encodings are signed: we may need 5 bytes to encode giant u32s.
Reported-by: Fabrice Drouin <fabrice.drouin@acinq.fr>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
8522a5ea64
struct bitcoin_tx: remove explicit lengths, use tal_len()/tal_count()
They're always tal objects, so we can simply ask tal for the length,
simplifying the API.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
ad82d29379
ccan: update to get tal_len(NULL)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
8159c4458a
bitcoin/script.h: remove struct bitcoin_signature
Technically this incudes the sighash flags, but we only handle SIGHASH_ALL
anyway.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
1edce4878d
bitcoin/signature.h: remove struct signature.
It's a wrapper around secp256k1_ecdsa_signature, so use that directly.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
e3d966c102
type_to_string: add channel_id
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
a25e2816e9
type_to_string: add secp256k1_pubkey
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Christian Decker
66175c7361
Merge pull request #115 from ElementsProject/pytest-pathfix
pytest: don't assume paths of valgrind and bitcoind.
8 years ago
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>
8 years ago
Rusty Russell
1c49af7486
Merge pull request #114 from cdecker/pytest-new
pytest: Add support for both legacy and new daemons
8 years ago
Christian Decker
1948062250
pytest: Using python-bitcoinlib instead of python-bitcoinrpc
The latter is unmaintained and has a number of problems.
8 years ago
Christian Decker
180c96776b
pytest: Split the python integration tests into new and legacy
8 years ago
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.
8 years ago
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.
8 years ago
Christian Decker
7cc5e2fc7a
pytest: Added pytest target to Makefile
8 years ago
Christian Decker
cf1c03f4d9
pytest: Implemented initial python integration tests.
8 years ago
Christian Decker
41a5e74db9
pytest: Implement utilities for python unittests
8 years ago
Christian Decker
cd9bb9b014
contrib: Implemented python RPC client
8 years ago