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>
This commit is contained in:
Rusty Russell
2015-07-29 16:16:24 +09:30
parent eac3af06f1
commit 3260fb2ed1
20 changed files with 115 additions and 28 deletions

View File

@@ -127,6 +127,10 @@ struct _OpenChannel
*/
protobuf_c_boolean has_min_depth;
uint32_t min_depth;
/*
* How much fee would I like on commitment tx?
*/
uint64_t commitment_fee;
OpenChannel__LocktimeCase locktime_case;
union {
uint32_t locktime_seconds;
@@ -135,7 +139,7 @@ struct _OpenChannel
};
#define OPEN_CHANNEL__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&open_channel__descriptor) \
, NULL, NULL, NULL, 0, 0,0u, OPEN_CHANNEL__LOCKTIME__NOT_SET, {} }
, NULL, NULL, NULL, 0, 0,0u, 0, OPEN_CHANNEL__LOCKTIME__NOT_SET, {} }
/*