Christian Decker
51a22c4274
doc: Fixed two small mistakes in the getroute
documentation
...
Two arguments were flipped and riskfactor was missing in the error
message returned from the JSON.
2017-02-22 21:46:07 +10:30
Christian Decker
26d4042436
bugfix: Assert was killing daemon
...
This seems rather easy to fix, the only case we do not want to set
`STATE_SHUTDOWN` us when we have updates which we have not committed
yet, which is handled separately in the other IF-branch.
2017-02-22 16:47:48 +10:30
Christian Decker
8912272983
gossip: Prevent normal messages to trigger the staggered broadcast
...
Only call `peer_dump_gossip` if the broadcast timer actually
expired. previously it could get triggered by any normal message.
2017-02-21 17:59:34 +01:00
Christian Decker
fccab6411d
gossip: Add timer and normal queue for messages
...
The peer is woken up every 30 seconds to deliver the backlog of
messages. Additionally I added the normal message queue to be able to
send non-gossip message to the peer.
2017-02-21 17:59:34 +01:00
Christian Decker
83f51fe965
gossip: Add timer support to the io_loop
2017-02-21 17:59:34 +01:00
Christian Decker
1c4c874d3f
refactor: Making timers independent of the lightningd_state
...
The `dstate` reference was only an indirection to the `timers`
sub-structure anyway, so removing this indirection allows us to reuse
the timers in the subdaemon arch.
2017-02-21 17:59:34 +01:00
Christian Decker
597687d1f0
Fix CI build
...
Extraneous whitespace in cryptomsg.h
2017-02-21 17:56:35 +01:00
Christian Decker
b901c68055
libwally: Re-adding missing gen_context file
...
This file was missed when checking in the libsecp256k1 tree in
libwally because one of the .gitignore rules matched it.
2017-02-21 16:54:05 +01:00
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
f66445c1d1
hsm: sign funding transactions.
...
The main daemon gives it to us to sign the inputs.
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
19f3b68d28
hsm: remove shutdown command.
...
We don't use it, and should shutdown when control fd goes away anyway.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:29 +10:30
Rusty Russell
ac1890136c
hsm: rename the hsmctl_hsmfd_ecdh_response to hsmctl_hsmfd_fd_response
...
We want to use it for other HSM fd requests.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:29 +10:30
Rusty Russell
82f5b3ad51
bitcoin/script: bitcoin_witness_p2wpkh()
...
For the wallet code to use for change.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:29 +10:30
Rusty Russell
08e95d59b5
permute_tx: generic pointer map.
...
Turns out we want to permute transactions for the wallet too, so we
use void ** rather than assume we're shuffling htlc ** (and do inputs,
too!).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:29 +10:30
Rusty Russell
4f6033ba29
bitcoin: fix building of submodules libbase58 submodule.
...
This does it properly, as learned from Stack Overflow.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +10:30
Rusty Russell
fb93503e6d
Makefile: fix libsodium build
...
eg:
gcc: error: libsodium.a: No such file or directory
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +10:30
Rusty Russell
b431443266
hsm: BIP32 seed for bitcoin keys.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +10:30
Rusty Russell
9624a1a10e
libwally: fix hmac_sha256 name clash.
...
This is a workaround; eventually libwally will be a nice shared library that
we won't have to bundle, and clashing with internal symbols won't be
a problem.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +10:30
Rusty Russell
1271ac8899
libwally-core: import version 3b025127cbf11912f8b95e7ff3c905d74e8433ce
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +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
ec4db39a8e
commit_tx: print HTLC id not amount when making test vectors.
...
For our test vectors there are two HTLCs with the same amount; this
is clearer.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +10:30
Rusty Russell
9284819f68
commit_tx: expose more internal functions.
...
without having to build it, which is needed for limit enforcement.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +10:30
Rusty Russell
e8e96e67d0
commit_tx: make interface side-agnostic.
...
It's currently written to produce "local" commit-txs, but of course we
need to produce remote ones too, for signing.
Thus instead of using "remote" and "local" we use "other" and "self",
and indicate with a single "side" flag which we're generating (because
that changes how HTLCs are interpreted).
This also adds to the tests: generate the remote view of the commit_tx
and make sure it matches!
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +10:30
Rusty Russell
068cdc825f
htlc_tx: fix fee for HTLC-timeout tx.
...
Reported-by: Fabrice Drouin <fabrice.drouin@acinq.fr>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +10:30
Rusty Russell
726e7226c4
commit_tx: update HTLC-tx fees to match latest BOLT.
...
As per lightning-rfc BOLT #3 ec99f893f320e8c88f564c1c8566f3454f0f1f5f:
"fixed htlc weight calculation"
Reported-by: Fabrice Drouin <fabrice.drouin@acinq.fr>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +10:30
Rusty Russell
35909ba94a
cryptomsg: wording fix with update to latest BOLT.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +10:30
Rusty Russell
f7cc079221
test/run-commit_tx: Fix derivation of BOLT #3 test vectors.
...
We were using the remote per_commitment_point instead of the local
per_commitment_point to generate the remotekey for the local transaction.
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
7cee3b0f68
wire: sha256_double, privkey and u64/u32/bool array support.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +10:30
Rusty Russell
9fd40da38c
generate-wire: don't hand unknown structures specially.
...
It's awkward to handle them differently. But this change means we
need to expose them to the generated code.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:19 +10:30
Rusty Russell
fd09345628
generate-wire: handle variable-size arrays of unknown types.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 14:59:14 +10:30
Christian Decker
c15511cf39
routing: Actually return the port when parsing node_announcements
...
We parsed it, but did not pass it back out.
2017-02-18 13:09:08 +01:00
Christian Decker
a6cf93782b
gitignore: Ignoring some more test-binaries.
2017-02-09 11:08:32 +01:00
Christian Decker
b5c2d7d47d
pytest: Gossip subdaemon had a flaky test
...
Whenever we were checking for the status before the daemon was
initialized the test would fail. Now just waiting for the state
transition.
2017-02-08 16:59:57 +01:00
Christian Decker
c7e6f197b0
pytest: Chaning startup sentinel for bitcoind.
...
By looking for 'Done loading' in the log output we should actually be
called after `SetRPCWarmupFinished` in bitcoind. Only then is it safe
to make RPC calls. This resulted in the test suite being a bit flaky.
2017-02-08 16:59:56 +01:00
Rusty Russell
66d122684d
lightningd/test/run-commit_tx: Creation of BOLT 3 test vectors.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-07 12:14:22 +10:30
Rusty Russell
0fe53cc8e7
permute_tx: reintroduce permute map.
...
We used to have a permutation map; this reintroduces a variant which
uses the htlc pointers directly.
We need this because we have to send the htlc-tx signatures in output
order as part of the protocol: without two-stage HTLCs we only needed
to wire them up in the unilateral spend case so we simply brute-forced
the ordering.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-07 12:14:22 +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
3e1ae177fb
bitcoin/script: BOLT 3 htlc transaction support.
...
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
6f3803aae7
bitcoin/script: BOLT 3 commitment transaction support.
...
This is a step away from the previous more generic script types into
specific helpers for each transaction type we need.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-07 12:14:21 +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
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>
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