mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-03 21:24:22 +01:00
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:
@@ -16,6 +16,7 @@
|
||||
#include "find_p2sh_out.h"
|
||||
#include "protobuf_convert.h"
|
||||
#include "gather_updates.h"
|
||||
#include "funding.h"
|
||||
#include <unistd.h>
|
||||
|
||||
/* FIXME: this code doesn't work if we're not the ones proposing the delta */
|
||||
@@ -65,7 +66,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
sig2.stype = SIGHASH_ALL;
|
||||
|
||||
gather_updates(o1, o2, a, argv + 5, &our_amount, &their_amount,
|
||||
gather_updates(o1, o2, a, commit_fee(o1, o2), argv + 5,
|
||||
&our_amount, &their_amount,
|
||||
&rhash, NULL, &sig2.sig);
|
||||
|
||||
redeemscript = bitcoin_redeem_2of2(ctx, &pubkey1, &pubkey2);
|
||||
|
||||
Reference in New Issue
Block a user