mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +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:
@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
||||
errx(1, "Private key '%s' not on testnet!", argv[4]);
|
||||
|
||||
/* Now create THEIR commitment tx to spend 2/2 output of anchor. */
|
||||
if (!initial_funding(o1, o2, a, &to_us, &to_them))
|
||||
if (!initial_funding(o1, o2, a, commit_fee(o1, o2), &to_us, &to_them))
|
||||
errx(1, "Invalid open combination (need 1 anchor offer)");
|
||||
|
||||
proto_to_sha256(o2->revocation_hash, &rhash);
|
||||
|
||||
Reference in New Issue
Block a user