Rusty Russell
8c468c1e15
daemon: use fee rates rather than absolute fees (BOLT #2 )
...
And divide fees as specified there.
We still use fixed values rather than floating, and we don't send or
handle update_fee messages.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-24 12:12:43 +10:30
Rusty Russell
b423b33236
protocol: implement close as per BOLT #2 .
...
We don't actually implement closing when we have HTLCs (we should
allow it, as that's what the clearing phase is for), since soon we'll
rewrite HTLC to match the async HTLC protocol of BOLT #2 .
Note that this folds the close paths, using a simple check if we have
a close transaction. That's a slight state layer violation, but
reduces code duplication.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-24 12:09:41 +10:30
Rusty Russell
6a062d8527
daemon: check protobuf-c version, report failure.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-15 17:09:42 +10:30
Rusty Russell
8f2e66089b
daemon: add --bitcoin-datadir for bitcoin-cli.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-15 17:08:40 +10:30
Rusty Russell
168ed96b12
daemon: close command.
...
This performs a mutual close.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
45c5c83d6f
daemon: exit main loop to free dead peers.
...
When a peer is finally to be freed (ie. STATE_CLOSED), doing this
inside the state logic is a bit fraught. We're better off exiting the
io loop and freeing it there.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
1018823f97
daemon: HTLC expiry limits.
...
Don't accept an HTLC which is about to expire, nor one which will take
too long to expire.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
a3e3f83d9f
daemon: dev-mocktime command
...
Useful for precise timing control for testing.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
9f560a9494
daemon: --closing-fee
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:27 +10:30
Rusty Russell
8f0e10309a
daemon: --bitcoind-poll=<seconds>
...
Speeds up testing significantly.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:27 +10:30
Rusty Russell
5b9f8d8bbd
bitcoind: serialize requests.
...
bitcoind has a limit of 16 requests at once, by default, so our simplest
solution is to serialize them.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:49 +10:30
Rusty Russell
34e32978b8
bitcoind: warn if their bitcoin config doesn't have walletbroadcast=0.
...
Because we use the bitcoin wallet to create the anchor transaction, we
need to make sure it doesn't broadcast it; safest to check their config
for the option.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:49 +10:30
Rusty Russell
fc49e3fd74
daemon: rename 'state' to 'dstate' everywhere.
...
This is the daemon state, not the state machine state.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:49 +10:30
Rusty Russell
e9237f94b1
daemon/watch: API to watch various bitcoin transactions.
...
This uses the functions in bitcoind to provide callbacks when various
things happen.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:49 +10:30
Rusty Russell
5ec8ff91e4
daemon/bitcoind: communication with bitcoind.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:49 +10:30
Rusty Russell
24602459b1
daemon/config: add testnet.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:49 +10:30
Rusty Russell
a5aa7b9abd
daemon: config file support.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:49 +10:30
Rusty Russell
9449f387ac
daemon: primitive privkey handling.
...
Eventually this will be in a separate process, etc.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:48 +10:30
Rusty Russell
14cbcd467f
daemon: add global secp256k1 context for easy access.
...
This caches the tables, so you're not supposed to regenerate it all
the time.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:48 +10:30
Rusty Russell
469401610f
daemon: socket code.
...
At the moment, if you connect it just says Hello! and closes the socket.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:48 +10:30
Rusty Russell
9ccb51c93f
daemon: UNIX domain socket for JSON-based control.
...
Also taken from pettycoin.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:48 +10:30
Rusty Russell
6ccfcf4477
daemon: timeout structure for IO.
...
For better or worse, the ccan/timer structure is completely minimal,
and designed to be wrapped inside a container structure.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:48 +10:30
Rusty Russell
378dadc371
daemon: configuration directory (default ~/.lightning).
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:48 +10:30
Rusty Russell
89f1f1548e
daemon: dump logs on crash.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:47 +10:30
Rusty Russell
117cf6b02d
daemon: add logging options.
...
Particularly logging to file.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:47 +10:30
Rusty Russell
dd35260ce8
daemon: first code.
...
Logging code based heavily on pettycoin's.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:47 +10:30