Skip to content

Commit 63c6674

Browse files
committed
rebase fixes 2021-09-07
1 parent 0c2ca74 commit 63c6674

File tree

5 files changed

+43
-11
lines changed

5 files changed

+43
-11
lines changed

channeld/commit_tx.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
268268
* `dust_limit_satoshis`, add a [`to_remote`
269269
* output](#to_remote-output).
270270
*/
271+
const u8 *redeem = NULL;
271272
if (amount_msat_greater_eq_sat(other_pay, dust_limit)) {
272273
struct amount_sat amount = amount_msat_to_sat_round_down(other_pay);
273274
u8 *scriptpubkey;
@@ -286,11 +287,10 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
286287
* Otherwise, this output is a simple P2WPKH to `remotepubkey`.
287288
*/
288289
if (option_anchor_outputs) {
289-
const u8 *redeem
290-
= anchor_to_remote_redeem(tmpctx,
291-
&keyset->other_payment_key,
292-
(!side) == lessor ?
293-
csv_lock : 1);
290+
redeem = anchor_to_remote_redeem(tmpctx,
291+
&keyset->other_payment_key,
292+
(!side) == lessor ?
293+
csv_lock : 1);
294294
/* BOLT- #3:
295295
* ##### Leased channel (`option_will_fund`)
296296
*
@@ -308,7 +308,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
308308
scriptpubkey = scriptpubkey_p2wpkh(tmpctx,
309309
&keyset->other_payment_key);
310310
}
311-
pos = bitcoin_tx_add_output(tx, scriptpubkey, redeem, amount);
311+
pos = bitcoin_tx_add_output(tx, scriptpubkey, (u8 *) redeem, amount);
312312
assert(pos == n);
313313
(*htlcmap)[n] = direct_outputs ? dummy_to_remote : NULL;
314314
/* We don't assign cltvs[n]: if we use it, order doesn't matter.

closingd/closingd.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,9 @@ static size_t closing_tx_weight_estimate(u8 *scriptpubkey[NUM_SIDES],
588588
const u8 *funding_wscript,
589589
const struct amount_sat *out,
590590
struct amount_sat funding_sats,
591-
struct amount_sat dust_limit)
591+
struct amount_sat dust_limit,
592+
u32 local_wallet_index,
593+
const struct ext_key *local_wallet_ext_key)
592594
{
593595
/* We create a dummy close */
594596
struct bitcoin_tx *tx;
@@ -600,6 +602,7 @@ static size_t closing_tx_weight_estimate(u8 *scriptpubkey[NUM_SIDES],
600602

601603
memset(&dummy_funding, 0, sizeof(dummy_funding));
602604
tx = create_close_tx(tmpctx, chainparams,
605+
local_wallet_index, local_wallet_ext_key,
603606
scriptpubkey[LOCAL], scriptpubkey[REMOTE],
604607
funding_wscript,
605608
&dummy_funding,

closingd/closingd_wire.csv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ msgdata,closingd_init,min_feerate_perksipa,u32,
2222
msgdata,closingd_init,preferred_feerate_perksipa,u32,
2323
msgdata,closingd_init,max_feerate_perksipa,?u32,
2424
msgdata,closingd_init,fee_limit_satoshi,amount_sat,
25-
msgdata,closingd_init,initial_fee_satoshi,amount_sat,
2625
msgdata,closingd_init,local_wallet_index,u32,
2726
msgdata,closingd_init,local_wallet_ext_key,ext_key,
2827
msgdata,closingd_init,local_scriptpubkey_len,u16,

common/initial_commit_tx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,19 +242,19 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx,
242242
*/
243243
u8 *scriptpubkey;
244244
int pos;
245+
const u8 *redeem = NULL;
245246

246247
amount = amount_msat_to_sat_round_down(other_pay);
247248
if (option_anchor_outputs) {
248-
const u8 *redeem
249-
= anchor_to_remote_redeem(tmpctx,
249+
redeem = anchor_to_remote_redeem(tmpctx,
250250
&keyset->other_payment_key,
251251
(!side) == lessor ? csv_lock : 1);
252252
scriptpubkey = scriptpubkey_p2wsh(tmpctx, redeem);
253253
} else {
254254
scriptpubkey = scriptpubkey_p2wpkh(tmpctx,
255255
&keyset->other_payment_key);
256256
}
257-
pos = bitcoin_tx_add_output(tx, scriptpubkey, redeem, amount);
257+
pos = bitcoin_tx_add_output(tx, scriptpubkey, (u8 *) redeem, amount);
258258
assert(pos == n);
259259
output_order[n] = dummy_remote;
260260
n++;

contrib/remote_hsmd/hsmd.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,6 +1593,28 @@ static struct io_plan *handle_sign_message(struct io_conn *conn,
15931593
take(towire_hsmd_sign_message_reply(NULL, &rsig)));
15941594
}
15951595

1596+
/*~ lightningd asks us to sign a liquidity ad offer */
1597+
static struct io_plan *handle_sign_option_will_fund_offer(struct io_conn *conn,
1598+
struct client *c,
1599+
const u8 *msg_in)
1600+
{
1601+
struct pubkey funding_pubkey;
1602+
u32 lease_expiry, channel_fee_base_max_msat;
1603+
u16 channel_fee_max_ppt;
1604+
1605+
if (!fromwire_hsmd_sign_option_will_fund_offer(msg_in,
1606+
&funding_pubkey,
1607+
&lease_expiry,
1608+
&channel_fee_base_max_msat,
1609+
&channel_fee_max_ppt))
1610+
return bad_req(conn, c, msg_in);
1611+
1612+
status_failed(STATUS_FAIL_INTERNAL_ERROR,
1613+
"handle_sign_option_will_fund_offer unimplemented");
1614+
return bad_req_fmt(conn, c, msg_in,
1615+
"handle_sign_option_will_fund_offer unimplemented");
1616+
}
1617+
15961618
/*~ lightningd asks us to sign a bolt12 (e.g. offer). */
15971619
static struct io_plan *handle_sign_bolt12(struct io_conn *conn,
15981620
struct client *c,
@@ -1688,6 +1710,9 @@ static bool check_client_capabilities(struct client *client,
16881710
case WIRE_HSMD_SIGN_MUTUAL_CLOSE_TX:
16891711
return (client->capabilities & HSM_CAP_SIGN_CLOSING_TX) != 0;
16901712

1713+
case WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER:
1714+
return (client->capabilities & HSM_CAP_SIGN_WILL_FUND_OFFER) != 0;
1715+
16911716
case WIRE_HSMD_INIT:
16921717
case WIRE_HSMD_NEW_CHANNEL:
16931718
case WIRE_HSMD_CLIENT_HSMFD:
@@ -1719,6 +1744,7 @@ static bool check_client_capabilities(struct client *client,
17191744
case WIRE_HSMD_VALIDATE_COMMITMENT_TX_REPLY:
17201745
case WIRE_HSMD_VALIDATE_REVOCATION_REPLY:
17211746
case WIRE_HSMD_SIGN_TX_REPLY:
1747+
case WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER_REPLY:
17221748
case WIRE_HSMD_GET_PER_COMMITMENT_POINT_REPLY:
17231749
case WIRE_HSMD_CHECK_FUTURE_SECRET_REPLY:
17241750
case WIRE_HSMD_GET_CHANNEL_BASEPOINTS_REPLY:
@@ -1830,6 +1856,9 @@ static struct io_plan *handle_client(struct io_conn *conn, struct client *c)
18301856
case WIRE_HSMD_SIGN_MESSAGE:
18311857
return handle_sign_message(conn, c, c->msg_in);
18321858

1859+
case WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER:
1860+
return handle_sign_option_will_fund_offer(conn, c, c->msg_in);
1861+
18331862
case WIRE_HSMD_SIGN_BOLT12:
18341863
return handle_sign_bolt12(conn, c, c->msg_in);
18351864
#if DEVELOPER
@@ -1853,6 +1882,7 @@ static struct io_plan *handle_client(struct io_conn *conn, struct client *c)
18531882
case WIRE_HSMD_VALIDATE_COMMITMENT_TX_REPLY:
18541883
case WIRE_HSMD_VALIDATE_REVOCATION_REPLY:
18551884
case WIRE_HSMD_SIGN_TX_REPLY:
1885+
case WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER_REPLY:
18561886
case WIRE_HSMD_GET_PER_COMMITMENT_POINT_REPLY:
18571887
case WIRE_HSMD_CHECK_FUTURE_SECRET_REPLY:
18581888
case WIRE_HSMD_GET_CHANNEL_BASEPOINTS_REPLY:

0 commit comments

Comments
 (0)