Commit Graph

10 Commits

Author SHA1 Message Date
Rusty Russell cc1b1d7de7 funding: adjust_fee() to allow fee alterations.
This is used for figuring out the close transaction balances,
but can also be used in the future for dynamic fee support.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:47 +10:30
Rusty Russell d5c30ee30b funding: funding_find_htlc and funding_remove_htlc.
Helpers for daemon.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:47 +10:30
Rusty Russell 6d6abd57e7 funding: remove protobufs.
Use our own structure with the information we need about HTLCs,
and remove protobufs from the API.

The is_funder() helper goes inside gather_updates.h.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:47 +10:30
Rusty Russell d733e82352 header cleanup: sort include lines into alpha order, after config.h
This makes merging easier in future.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:38:08 +10: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 f0df2b7930 channel_state: add htlcs array.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-08-07 12:45:30 +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