Commit Graph

28 Commits

Author SHA1 Message Date
Rusty Russell ea41386ed3 daemon: rename all the low-level commands to dev-
Rename the structs to match (and remove dev-echo).

This makes it clear that they're not the normal API.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-09-06 16:47:49 +09:30
Rusty Russell c83fb1a2dd waitinvoice: RPC call for processing incoming invoices.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-09-06 16:47:49 +09:30
Rusty Russell 0761c12381 delinvoice: routine to remove an unpaid invoice.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-09-06 16:47:49 +09:30
Rusty Russell f6a0ea0b66 listinvoices: RPC command to show one or all invoices.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-09-06 16:47:49 +09:30
Rusty Russell 060ff29b45 Rename payment to invoice.
And rename JSON's accept-payment command to invoice.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-09-06 16:47:49 +09:30
Rusty Russell 2610799bda pay: split into getroute and sendpay
This is less convenient to use, but makes far more sense for a real
user (like a wallet).  It can ask about the route, then decide whether
to use it or not.

This will make even more sense once we add a parameter to control how
long we let the HTLC be delayed for, so a client can query for high,
medium and low tolerances and compare results.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-31 16:06:08 +09:30
Rusty Russell 7550ec23ec daemon: new command gethtlcs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-30 20:09:57 +09:30
Rusty Russell 72a9cfbbe2 test: test feerate changes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-26 15:33:47 +09:30
Rusty Russell 3866d7605c daemon: reconnect support.
To do this we keep an order counter so we know how to retransmit.  We
could simply keep old packets, but this is a little clearer for now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-18 14:25:08 +09:30
Rusty Russell 69a8ea2ad9 daemon: pay command.
This is the command an actual user would use: it figures out the fee
and route, and pays it if it can.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-07-01 12:00:17 +09:30
Rusty Russell f4f0c1aa18 daemon: add dev-routefail command.
We're about to change the code so that if it can't route, it will fail
the HTLC.  The current low-level tests will hate this, so have a dev switch
to turn that off.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-07-01 12:00:17 +09:30
Rusty Russell b1ac490bea daemon: add-route RPC command.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-07-01 12:00:17 +09:30
Rusty Russell 5027410ab1 daemon: payment infrastructure.
A new 'accept-payment' command tells the node to fulfill HTLCs using
the R value if the amount is correct.  It's not wired in yet.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-07-01 11:59:15 +09:30
Rusty Russell b9d4f7c0ab daemon: dev-output command.
Useful for controlling conversations between two nodes, by
blocking one's output.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-26 15:25:24 +09:30
Rusty Russell e1c6f2d630 daemon: dev-signcommit command to sign the current commit tx.
Do not use this!  We use it to test stealing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-06 11:54:49 +09:30
Rusty Russell 76cb195ea1 daemon: dev-disconnect command.
This lets one end experience a disconnect without the other noticing.
Good for testing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-03 11:27:56 +09:30
Rusty Russell 51de503096 daemon: keep track of simple addresses for injecting funds.
We need to control the *inputs* to the anchor tx, to make sure they
pay to witness scripts (thus the anchor is immalleable).  The easiest
way to do this is to hand out P2SH addresses for the user, and have
them pay into those.  Then they hand us that tx and we use it to
create the anchor.

This is not a long-term solution!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-12 13:07:03 +09:30
Rusty Russell 5e7b3d02a1 daemon: batching of changes as per BOLT #2.
We now keep a list of commitment transaction states for "us" and
"them", as well as a "struct channel_state" for staged changes.

We manipulate these structures as we send out packets, receive
packets, or receive acknowledgement of packets.  In particular, we
update the other nodes' staging_cstate as we send out our requests,
and update our own staging_cstate are we receive acks.  When we
receive a request, we update both (as we immediately send out our
ack).

The RPC output is changed; rather than expose the complexity, we
expose our last committed state: what would happen if we have to drop
to the blockchain now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-31 17:13:20 +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 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 2346f6bf14 daemon: routefail command.
This should be renamed: it's actually any kind of after-the-fact failure.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell 1e82799852 daemon: fulfillhtlc command
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell 6bdaa5d1ca daemon: newhtlc command.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:27 +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 08ccb4b6f0 getpeers: new command.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:48 +10:30
Rusty Russell d68ae0b612 jsonrpc: adapt it to be async.
This allows for JSON commands which aren't instantaneous.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:48 +10:30
Rusty Russell 2df28021ac daemon: command to connect
Now we can connect two daemons to each other.  Who both say Hello! and
close.

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