Commit Graph

10 Commits

Author SHA1 Message Date
Rusty Russell 31459d6cd2 protocol: rename update_complete_htlc to update_fulfill_htlc.
Complete was an overloaded word.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-09-25 11:51:18 +09:30
Rusty Russell f0cab4e74b gather_updates: fix rebase error.
Didn't update amount field in d00eeded9f.
Didn't compile test either :(

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-09-25 11:50:24 +09:30
Rusty Russell d00eeded9f protocol: split message update_remove_htlc into update_timedout_htlc and update_routefail_htlc, remove update_remove_htlc_delay.
For the moment, there's no way to remove an in-progress HTLC before
it's timed out.  The other side can remove it with a routefail, but
you can't push for it to be removed.

We may add that later, but by definition it's only a polited request, and
normally we should rely on timeouts.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-09-24 15:02:49 +09:30
Rusty Russell 5bc22f0368 protocol: increase HTLC precision to 1/1000 satoshi.
This gets truncated for on-chain transactions (thus, rounding may
contribute to fees).

This also means we currently have an upper bound of 0.04 BTC per HTLC;
this can be increased later if required.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-09-24 15:00:47 +09:30
Rusty Russell 106c447d17 gather_updates: handle HTLC updates.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-08-07 14:13:35 +09:30
Rusty Russell 769f9f1cc5 gather_updates: extract some update logic into update_rhash.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-08-07 14:13:29 +09:30
Rusty Russell a09c0a9fa7 funding: take into account HTLC add/remove.
Enhance funding_delta() to have an HTLC delta as well as an A->B delta.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-08-07 12:45:30 +09:30
Rusty Russell a4dfe3ad72 channel_state: encapsulate funding of channel in one place.
This shows where funds are going at any time (fees vs to each side).
funding.c is mainly rewritten, and should be clearer now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-08-07 12:45:30 +09:30
Rusty Russell 3260fb2ed1 protocol: add commitment fee logic.
Both sides elect a commitment fee, and the lowest is chosen.  That means
you can't game the other side (but if you offer too low, then can error
out of course).

Fees are split 50-50 if possible: originally the whole fee has to be
paid by the (single) funder.  Neither side can withdraw funds which
would make them unable to pay fees.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-07-29 16:16:24 +09:30
Rusty Russell eac3af06f1 protocol: switch to single-funder anchor model.
Most complex change was gather_updates(), which handles all the "what
is the current state of the channel" logic for our dumb test utils.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-07-29 16:14:28 +09:30