mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
channel lease: set csv_lock for commitment transactions
If the channel is under lease, the lessor's (accepter, really) funds have a CSV lock that reflects the length of the remainder of the lease.
This commit is contained in:
@@ -98,6 +98,7 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx,
|
||||
bool to_local, to_remote;
|
||||
struct amount_msat total_pay;
|
||||
struct amount_sat amount;
|
||||
enum side lessor = !opener;
|
||||
u32 sequence;
|
||||
void *dummy_local = (void *)LOCAL, *dummy_remote = (void *)REMOTE;
|
||||
const void *output_order[NUM_SIDES];
|
||||
@@ -211,7 +212,8 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx,
|
||||
*/
|
||||
if (amount_msat_greater_eq_sat(self_pay, dust_limit)) {
|
||||
u8 *wscript = to_self_wscript(tmpctx,
|
||||
to_self_delay, csv_lock,
|
||||
to_self_delay,
|
||||
side == lessor ? csv_lock : 0,
|
||||
keyset);
|
||||
amount = amount_msat_to_sat_round_down(self_pay);
|
||||
int pos = bitcoin_tx_add_output(
|
||||
@@ -245,8 +247,11 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx,
|
||||
|
||||
amount = amount_msat_to_sat_round_down(other_pay);
|
||||
if (option_anchor_outputs) {
|
||||
scriptpubkey = scriptpubkey_p2wsh(tmpctx,
|
||||
anchor_to_remote_redeem(tmpctx, &keyset->other_payment_key, csv_lock));
|
||||
const u8 *redeem
|
||||
= anchor_to_remote_redeem(tmpctx,
|
||||
&keyset->other_payment_key,
|
||||
(!side) == lessor ? csv_lock : 1);
|
||||
scriptpubkey = scriptpubkey_p2wsh(tmpctx, redeem);
|
||||
} else {
|
||||
scriptpubkey = scriptpubkey_p2wpkh(tmpctx,
|
||||
&keyset->other_payment_key);
|
||||
|
||||
Reference in New Issue
Block a user