mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
liquidity-ad: request amount, pass through to dualopend
Changelog-Experimental: EXPERIMENTAL-DUAL-FUND: JSON-RPC: openchannel_init now takes a `requested_amt`, which is an amount to request from peer
This commit is contained in:
parent
f1b7e5fffe
commit
e41d2dc0e6
@ -1009,7 +1009,7 @@ class LightningRpc(UnixDomainSocketRpc):
|
|||||||
}
|
}
|
||||||
return self.call("pay", payload)
|
return self.call("pay", payload)
|
||||||
|
|
||||||
def openchannel_init(self, node_id, channel_amount, psbt, feerate=None, funding_feerate=None, announce=True, close_to=None, *args, **kwargs):
|
def openchannel_init(self, node_id, channel_amount, psbt, feerate=None, funding_feerate=None, announce=True, close_to=None, request_amt=None, *args, **kwargs):
|
||||||
"""Initiate an openchannel with a peer """
|
"""Initiate an openchannel with a peer """
|
||||||
payload = {
|
payload = {
|
||||||
"id": node_id,
|
"id": node_id,
|
||||||
@ -1019,6 +1019,7 @@ class LightningRpc(UnixDomainSocketRpc):
|
|||||||
"funding_feerate": funding_feerate,
|
"funding_feerate": funding_feerate,
|
||||||
"announce": announce,
|
"announce": announce,
|
||||||
"close_to": close_to,
|
"close_to": close_to,
|
||||||
|
"request_amt": request_amt,
|
||||||
}
|
}
|
||||||
return self.call("openchannel_init", payload)
|
return self.call("openchannel_init", payload)
|
||||||
|
|
||||||
|
18
doc/lightning-openchannel_init.7
generated
18
doc/lightning-openchannel_init.7
generated
@ -3,7 +3,7 @@
|
|||||||
lightning-openchannel_init - Command to initiate a channel to a peer
|
lightning-openchannel_init - Command to initiate a channel to a peer
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|
||||||
\fBopenchannel_init\fR \fIid\fR \fIamount\fR \fIinitalpsbt\fR [\fIcommitment_feerate\fR] [\fIfunding_feerate\fR] [\fIannounce\fR] [\fIclose_to\fR]
|
\fBopenchannel_init\fR \fIid\fR \fIamount\fR \fIinitalpsbt\fR [\fIcommitment_feerate\fR] [\fIfunding_feerate\fR] [\fIannounce\fR] [\fIclose_to\fR] [\fIrequest_amt\fR]
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
|
||||||
@ -43,6 +43,11 @@ funding transaction\. Defaults to 'opening' feerate\.
|
|||||||
sent on close\. Only valid if both peers have negotiated
|
sent on close\. Only valid if both peers have negotiated
|
||||||
\fBoption_upfront_shutdown_script\fR\.
|
\fBoption_upfront_shutdown_script\fR\.
|
||||||
|
|
||||||
|
|
||||||
|
\fIrequest_amt\fR is an amount of liquidity you'd like to lease from the peer\.
|
||||||
|
If peer supports \fBoption_will_fund\fR, indicates to them to include this
|
||||||
|
much liquidity into the channel\.
|
||||||
|
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
|
|
||||||
On success, an object is returned, containing:
|
On success, an object is returned, containing:
|
||||||
@ -63,6 +68,15 @@ If the peer does not support \fBoption_dual_fund\fR, this command
|
|||||||
will return an error\.
|
will return an error\.
|
||||||
|
|
||||||
|
|
||||||
|
If you sent a \fIrequest_amt\fR and the peer supports \fBoption_will_fund\fR and is
|
||||||
|
interested in leasing you liquidity in this channel, returns their updated
|
||||||
|
channel fee max (\fIchannel_fee_proportional_basis\fR, \fIchannel_fee_base_msat\fR),
|
||||||
|
updated rate card for the lease fee (\fIlease_fee_proportional_basis\fR,
|
||||||
|
\fIlease_fee_base_sat\fR) and their on-chain weight \fIweight_charge\fR, which will
|
||||||
|
be added to the lease fee at a rate of \fIfunding_feerate\fR \fI \fRweight_charge*
|
||||||
|
/ 1000\.
|
||||||
|
|
||||||
|
|
||||||
On error the returned object will contain \fBcode\fR and \fBmessage\fR properties,
|
On error the returned object will contain \fBcode\fR and \fBmessage\fR properties,
|
||||||
with \fBcode\fR being one of the following:
|
with \fBcode\fR being one of the following:
|
||||||
|
|
||||||
@ -105,4 +119,4 @@ lightning-fundchannel_\fBcomplete\fR(7), \fBlightning-fundchannel\fR(7),
|
|||||||
|
|
||||||
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
||||||
|
|
||||||
\" SHA256STAMP:ba03cf64c3578303a0cdfcf94546bb94d86ecf3d6187b16871a39c08b3a40f38
|
\" SHA256STAMP:13023bb80ee4a7f6a94a168399a01e05c6c5ab68e9eec5795ebd5f49207a03ac
|
||||||
|
@ -4,7 +4,7 @@ lightning-openchannel\_init -- Command to initiate a channel to a peer
|
|||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
**openchannel_init** *id* *amount* *initalpsbt* \[*commitment_feerate*\] \[*funding_feerate*\] \[*announce*\] \[*close_to*\]
|
**openchannel_init** *id* *amount* *initalpsbt* \[*commitment_feerate*\] \[*funding_feerate*\] \[*announce*\] \[*close_to*\] \[*request_amt*\]
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
@ -38,6 +38,10 @@ funding transaction. Defaults to 'opening' feerate.
|
|||||||
sent on close. Only valid if both peers have negotiated
|
sent on close. Only valid if both peers have negotiated
|
||||||
`option_upfront_shutdown_script`.
|
`option_upfront_shutdown_script`.
|
||||||
|
|
||||||
|
*request_amt* is an amount of liquidity you'd like to lease from the peer.
|
||||||
|
If peer supports `option_will_fund`, indicates to them to include this
|
||||||
|
much liquidity into the channel.
|
||||||
|
|
||||||
|
|
||||||
RETURN VALUE
|
RETURN VALUE
|
||||||
------------
|
------------
|
||||||
@ -53,6 +57,14 @@ On success, an object is returned, containing:
|
|||||||
If the peer does not support `option_dual_fund`, this command
|
If the peer does not support `option_dual_fund`, this command
|
||||||
will return an error.
|
will return an error.
|
||||||
|
|
||||||
|
If you sent a *request_amt* and the peer supports `option_will_fund` and is
|
||||||
|
interested in leasing you liquidity in this channel, returns their updated
|
||||||
|
channel fee max (*channel_fee_proportional_basis*, *channel_fee_base_msat*),
|
||||||
|
updated rate card for the lease fee (*lease_fee_proportional_basis*,
|
||||||
|
*lease_fee_base_sat*) and their on-chain weight *weight_charge*, which will
|
||||||
|
be added to the lease fee at a rate of *funding_feerate* * *weight_charge*
|
||||||
|
/ 1000.
|
||||||
|
|
||||||
On error the returned object will contain `code` and `message` properties,
|
On error the returned object will contain `code` and `message` properties,
|
||||||
with `code` being one of the following:
|
with `code` being one of the following:
|
||||||
|
|
||||||
|
@ -701,7 +701,8 @@ openchannel2_hook_cb(struct openchannel2_payload *payload STEALS)
|
|||||||
msg = towire_dualopend_got_offer_reply(NULL,
|
msg = towire_dualopend_got_offer_reply(NULL,
|
||||||
payload->accepter_funding,
|
payload->accepter_funding,
|
||||||
payload->psbt,
|
payload->psbt,
|
||||||
payload->our_shutdown_scriptpubkey);
|
payload->our_shutdown_scriptpubkey,
|
||||||
|
payload->rates);
|
||||||
|
|
||||||
subd_send_msg(dualopend, take(msg));
|
subd_send_msg(dualopend, take(msg));
|
||||||
}
|
}
|
||||||
@ -1733,7 +1734,9 @@ static void accepter_got_offer(struct subd *dualopend,
|
|||||||
&payload->max_accepted_htlcs,
|
&payload->max_accepted_htlcs,
|
||||||
&payload->channel_flags,
|
&payload->channel_flags,
|
||||||
&payload->locktime,
|
&payload->locktime,
|
||||||
&payload->shutdown_scriptpubkey)) {
|
&payload->shutdown_scriptpubkey,
|
||||||
|
&payload->requested_lease_amt,
|
||||||
|
&payload->lease_blockheight_start)) {
|
||||||
channel_internal_error(channel, "Bad DUALOPEND_GOT_OFFER: %s",
|
channel_internal_error(channel, "Bad DUALOPEND_GOT_OFFER: %s",
|
||||||
tal_hex(tmpctx, msg));
|
tal_hex(tmpctx, msg));
|
||||||
return;
|
return;
|
||||||
@ -2343,7 +2346,7 @@ static struct command_result *json_openchannel_init(struct command *cmd,
|
|||||||
bool *announce_channel;
|
bool *announce_channel;
|
||||||
u32 *feerate_per_kw_funding;
|
u32 *feerate_per_kw_funding;
|
||||||
u32 *feerate_per_kw;
|
u32 *feerate_per_kw;
|
||||||
struct amount_sat *amount, psbt_val;
|
struct amount_sat *amount, psbt_val, *request_amt;
|
||||||
struct wally_psbt *psbt;
|
struct wally_psbt *psbt;
|
||||||
const u8 *our_upfront_shutdown_script;
|
const u8 *our_upfront_shutdown_script;
|
||||||
struct open_attempt *oa;
|
struct open_attempt *oa;
|
||||||
@ -2357,6 +2360,7 @@ static struct command_result *json_openchannel_init(struct command *cmd,
|
|||||||
p_opt("funding_feerate", param_feerate, &feerate_per_kw_funding),
|
p_opt("funding_feerate", param_feerate, &feerate_per_kw_funding),
|
||||||
p_opt_def("announce", param_bool, &announce_channel, true),
|
p_opt_def("announce", param_bool, &announce_channel, true),
|
||||||
p_opt("close_to", param_bitcoin_address, &our_upfront_shutdown_script),
|
p_opt("close_to", param_bitcoin_address, &our_upfront_shutdown_script),
|
||||||
|
p_opt_def("request_amt", param_sat, &request_amt, AMOUNT_SAT(0)),
|
||||||
NULL))
|
NULL))
|
||||||
return command_param_failed();
|
return command_param_failed();
|
||||||
|
|
||||||
@ -2488,7 +2492,9 @@ static struct command_result *json_openchannel_init(struct command *cmd,
|
|||||||
oa->our_upfront_shutdown_script,
|
oa->our_upfront_shutdown_script,
|
||||||
*feerate_per_kw,
|
*feerate_per_kw,
|
||||||
*feerate_per_kw_funding,
|
*feerate_per_kw_funding,
|
||||||
channel->channel_flags);
|
channel->channel_flags,
|
||||||
|
*request_amt,
|
||||||
|
get_block_height(cmd->ld->topology));
|
||||||
|
|
||||||
subd_send_msg(channel->owner, take(msg));
|
subd_send_msg(channel->owner, take(msg));
|
||||||
return command_still_pending(cmd);
|
return command_still_pending(cmd);
|
||||||
|
@ -119,6 +119,9 @@ struct tx_state {
|
|||||||
|
|
||||||
/* Have we gotten the peer's tx-sigs yet? */
|
/* Have we gotten the peer's tx-sigs yet? */
|
||||||
bool remote_funding_sigs_rcvd;
|
bool remote_funding_sigs_rcvd;
|
||||||
|
|
||||||
|
/* Rates that we're using for this open... */
|
||||||
|
struct lease_rates *rates;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct tx_state *new_tx_state(const tal_t *ctx)
|
static struct tx_state *new_tx_state(const tal_t *ctx)
|
||||||
@ -1908,7 +1911,8 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
|
|||||||
struct channel_id cid, full_cid;
|
struct channel_id cid, full_cid;
|
||||||
char *err_reason;
|
char *err_reason;
|
||||||
u8 *msg;
|
u8 *msg;
|
||||||
struct amount_sat total;
|
struct amount_sat total, requested_amt;
|
||||||
|
u32 lease_blockheight_start;
|
||||||
enum dualopend_wire msg_type;
|
enum dualopend_wire msg_type;
|
||||||
struct tx_state *tx_state = state->tx_state;
|
struct tx_state *tx_state = state->tx_state;
|
||||||
|
|
||||||
@ -1943,6 +1947,19 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
|
|||||||
} else
|
} else
|
||||||
state->upfront_shutdown_script[REMOTE] = NULL;
|
state->upfront_shutdown_script[REMOTE] = NULL;
|
||||||
|
|
||||||
|
/* This is an `option_will_fund` request */
|
||||||
|
if (open_tlv->request_funds) {
|
||||||
|
/* FIXME: Do we support this? */
|
||||||
|
requested_amt
|
||||||
|
= amount_sat(open_tlv->request_funds->requested_sats);
|
||||||
|
lease_blockheight_start
|
||||||
|
= open_tlv->request_funds->blockheight;
|
||||||
|
} else {
|
||||||
|
requested_amt = AMOUNT_SAT(0);
|
||||||
|
lease_blockheight_start = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* BOLT-* #2
|
/* BOLT-* #2
|
||||||
* If the peer's revocation basepoint is unknown (e.g.
|
* If the peer's revocation basepoint is unknown (e.g.
|
||||||
* `open_channel2`), a temporary `channel_id` should be found
|
* `open_channel2`), a temporary `channel_id` should be found
|
||||||
@ -2006,7 +2023,9 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
|
|||||||
tx_state->remoteconf.max_accepted_htlcs,
|
tx_state->remoteconf.max_accepted_htlcs,
|
||||||
state->channel_flags,
|
state->channel_flags,
|
||||||
tx_state->tx_locktime,
|
tx_state->tx_locktime,
|
||||||
state->upfront_shutdown_script[REMOTE]);
|
state->upfront_shutdown_script[REMOTE],
|
||||||
|
requested_amt,
|
||||||
|
lease_blockheight_start);
|
||||||
|
|
||||||
wire_sync_write(REQ_FD, take(msg));
|
wire_sync_write(REQ_FD, take(msg));
|
||||||
msg = wire_sync_read(tmpctx, REQ_FD);
|
msg = wire_sync_read(tmpctx, REQ_FD);
|
||||||
@ -2021,7 +2040,8 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
|
|||||||
if (!fromwire_dualopend_got_offer_reply(state, msg,
|
if (!fromwire_dualopend_got_offer_reply(state, msg,
|
||||||
&tx_state->accepter_funding,
|
&tx_state->accepter_funding,
|
||||||
&tx_state->psbt,
|
&tx_state->psbt,
|
||||||
&state->upfront_shutdown_script[LOCAL]))
|
&state->upfront_shutdown_script[LOCAL],
|
||||||
|
&tx_state->rates))
|
||||||
master_badmsg(WIRE_DUALOPEND_GOT_OFFER_REPLY, msg);
|
master_badmsg(WIRE_DUALOPEND_GOT_OFFER_REPLY, msg);
|
||||||
|
|
||||||
if (!tx_state->psbt)
|
if (!tx_state->psbt)
|
||||||
@ -2031,6 +2051,19 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
|
|||||||
/* Locktimes must match! */
|
/* Locktimes must match! */
|
||||||
tx_state->psbt->tx->locktime = tx_state->tx_locktime;
|
tx_state->psbt->tx->locktime = tx_state->tx_locktime;
|
||||||
|
|
||||||
|
/* BOLT- #2:
|
||||||
|
*
|
||||||
|
* - if they decide to accept the offer:
|
||||||
|
* ...
|
||||||
|
* - MUST set `funding_satoshis` to a value greater than 0msat
|
||||||
|
*/
|
||||||
|
if (tx_state->rates && amount_sat_zero(tx_state->accepter_funding)) {
|
||||||
|
status_broken("opt_will_fund ad passed in, but no funding");
|
||||||
|
negotiation_failed(state, "We're unable to accept"
|
||||||
|
" your lease offer.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check that total funding doesn't overflow */
|
/* Check that total funding doesn't overflow */
|
||||||
if (!amount_sat_add(&total, tx_state->opener_funding,
|
if (!amount_sat_add(&total, tx_state->opener_funding,
|
||||||
tx_state->accepter_funding))
|
tx_state->accepter_funding))
|
||||||
@ -2400,7 +2433,8 @@ static void opener_start(struct state *state, u8 *msg)
|
|||||||
struct tlv_accept_tlvs *a_tlv;
|
struct tlv_accept_tlvs *a_tlv;
|
||||||
struct channel_id cid;
|
struct channel_id cid;
|
||||||
char *err_reason;
|
char *err_reason;
|
||||||
struct amount_sat total;
|
struct amount_sat total, requested_sats;
|
||||||
|
u32 current_blockheight;
|
||||||
struct tx_state *tx_state = state->tx_state;
|
struct tx_state *tx_state = state->tx_state;
|
||||||
|
|
||||||
if (!fromwire_dualopend_opener_init(state, msg,
|
if (!fromwire_dualopend_opener_init(state, msg,
|
||||||
@ -2409,7 +2443,9 @@ static void opener_start(struct state *state, u8 *msg)
|
|||||||
&state->upfront_shutdown_script[LOCAL],
|
&state->upfront_shutdown_script[LOCAL],
|
||||||
&state->feerate_per_kw_commitment,
|
&state->feerate_per_kw_commitment,
|
||||||
&tx_state->feerate_per_kw_funding,
|
&tx_state->feerate_per_kw_funding,
|
||||||
&state->channel_flags))
|
&state->channel_flags,
|
||||||
|
&requested_sats,
|
||||||
|
¤t_blockheight))
|
||||||
master_badmsg(WIRE_DUALOPEND_OPENER_INIT, msg);
|
master_badmsg(WIRE_DUALOPEND_OPENER_INIT, msg);
|
||||||
|
|
||||||
state->our_role = TX_INITIATOR;
|
state->our_role = TX_INITIATOR;
|
||||||
@ -2438,6 +2474,14 @@ static void opener_start(struct state *state, u8 *msg)
|
|||||||
state->upfront_shutdown_script[LOCAL];
|
state->upfront_shutdown_script[LOCAL];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!amount_sat_zero(requested_sats)) {
|
||||||
|
open_tlv->request_funds =
|
||||||
|
tal(open_tlv, struct tlv_opening_tlvs_request_funds);
|
||||||
|
open_tlv->request_funds->requested_sats =
|
||||||
|
requested_sats.satoshis; /* Raw: struct -> wire */
|
||||||
|
open_tlv->request_funds->blockheight = current_blockheight;
|
||||||
|
}
|
||||||
|
|
||||||
msg = towire_open_channel2(NULL,
|
msg = towire_open_channel2(NULL,
|
||||||
&chainparams->genesis_blockhash,
|
&chainparams->genesis_blockhash,
|
||||||
&state->channel_id,
|
&state->channel_id,
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <common/htlc_wire.h>
|
#include <common/htlc_wire.h>
|
||||||
#include <common/penalty_base.h>
|
#include <common/penalty_base.h>
|
||||||
#include <common/per_peer_state.h>
|
#include <common/per_peer_state.h>
|
||||||
|
#include <wire/peer_wire.h>
|
||||||
|
|
||||||
msgtype,dualopend_init,7000
|
msgtype,dualopend_init,7000
|
||||||
# Which network are we configured for?
|
# Which network are we configured for?
|
||||||
@ -79,6 +80,8 @@ msgdata,dualopend_got_offer,channel_flags,u8,
|
|||||||
msgdata,dualopend_got_offer,locktime,u32,
|
msgdata,dualopend_got_offer,locktime,u32,
|
||||||
msgdata,dualopend_got_offer,shutdown_len,u16,
|
msgdata,dualopend_got_offer,shutdown_len,u16,
|
||||||
msgdata,dualopend_got_offer,shutdown_scriptpubkey,u8,shutdown_len
|
msgdata,dualopend_got_offer,shutdown_scriptpubkey,u8,shutdown_len
|
||||||
|
msgdata,dualopend_got_offer,requested_amt,amount_sat,
|
||||||
|
msgdata,dualopend_got_offer,lease_blockheight_start,u32,
|
||||||
|
|
||||||
# master->dualopend: reply back with our first funding info/contribs
|
# master->dualopend: reply back with our first funding info/contribs
|
||||||
msgtype,dualopend_got_offer_reply,7105
|
msgtype,dualopend_got_offer_reply,7105
|
||||||
@ -86,6 +89,7 @@ msgdata,dualopend_got_offer_reply,accepter_funding,amount_sat,
|
|||||||
msgdata,dualopend_got_offer_reply,psbt,wally_psbt,
|
msgdata,dualopend_got_offer_reply,psbt,wally_psbt,
|
||||||
msgdata,dualopend_got_offer_reply,shutdown_len,u16,
|
msgdata,dualopend_got_offer_reply,shutdown_len,u16,
|
||||||
msgdata,dualopend_got_offer_reply,our_shutdown_scriptpubkey,?u8,shutdown_len
|
msgdata,dualopend_got_offer_reply,our_shutdown_scriptpubkey,?u8,shutdown_len
|
||||||
|
msgdata,dualopend_got_offer_reply,lease_rates,?lease_rates,
|
||||||
|
|
||||||
# dualopend->master: they offered a RBF, should we continue?
|
# dualopend->master: they offered a RBF, should we continue?
|
||||||
msgtype,dualopend_got_rbf_offer,7500
|
msgtype,dualopend_got_rbf_offer,7500
|
||||||
@ -161,6 +165,8 @@ msgdata,dualopend_opener_init,local_shutdown_scriptpubkey,u8,local_shutdown_len
|
|||||||
msgdata,dualopend_opener_init,feerate_per_kw,u32,
|
msgdata,dualopend_opener_init,feerate_per_kw,u32,
|
||||||
msgdata,dualopend_opener_init,feerate_per_kw_funding,u32,
|
msgdata,dualopend_opener_init,feerate_per_kw_funding,u32,
|
||||||
msgdata,dualopend_opener_init,channel_flags,u8,
|
msgdata,dualopend_opener_init,channel_flags,u8,
|
||||||
|
msgdata,dualopend_opener_init,requested_sats,amount_sat,
|
||||||
|
msgdata,dualopend_opener_init,blockheight,u32,
|
||||||
|
|
||||||
# dualopend->master received tx_sigs from peer
|
# dualopend->master received tx_sigs from peer
|
||||||
msgtype,dualopend_funding_sigs,7010
|
msgtype,dualopend_funding_sigs,7010
|
||||||
|
Can't render this file because it has a wrong number of fields in line 14.
|
34
openingd/dualopend_wiregen.c
generated
34
openingd/dualopend_wiregen.c
generated
@ -247,7 +247,7 @@ bool fromwire_dualopend_reinit(const tal_t *ctx, const void *p, const struct cha
|
|||||||
|
|
||||||
/* WIRE: DUALOPEND_GOT_OFFER */
|
/* WIRE: DUALOPEND_GOT_OFFER */
|
||||||
/* dualopend->master: they offered channel */
|
/* dualopend->master: they offered channel */
|
||||||
u8 *towire_dualopend_got_offer(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat opener_funding, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_msat htlc_minimum_msat, u32 feerate_per_kw_funding, u32 feerate_per_kw_commitment, u16 to_self_delay, u16 max_accepted_htlcs, u8 channel_flags, u32 locktime, const u8 *shutdown_scriptpubkey)
|
u8 *towire_dualopend_got_offer(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat opener_funding, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_msat htlc_minimum_msat, u32 feerate_per_kw_funding, u32 feerate_per_kw_commitment, u16 to_self_delay, u16 max_accepted_htlcs, u8 channel_flags, u32 locktime, const u8 *shutdown_scriptpubkey, struct amount_sat requested_amt, u32 lease_blockheight_start)
|
||||||
{
|
{
|
||||||
u16 shutdown_len = tal_count(shutdown_scriptpubkey);
|
u16 shutdown_len = tal_count(shutdown_scriptpubkey);
|
||||||
u8 *p = tal_arr(ctx, u8, 0);
|
u8 *p = tal_arr(ctx, u8, 0);
|
||||||
@ -266,10 +266,12 @@ u8 *towire_dualopend_got_offer(const tal_t *ctx, const struct channel_id *channe
|
|||||||
towire_u32(&p, locktime);
|
towire_u32(&p, locktime);
|
||||||
towire_u16(&p, shutdown_len);
|
towire_u16(&p, shutdown_len);
|
||||||
towire_u8_array(&p, shutdown_scriptpubkey, shutdown_len);
|
towire_u8_array(&p, shutdown_scriptpubkey, shutdown_len);
|
||||||
|
towire_amount_sat(&p, requested_amt);
|
||||||
|
towire_u32(&p, lease_blockheight_start);
|
||||||
|
|
||||||
return memcheck(p, tal_count(p));
|
return memcheck(p, tal_count(p));
|
||||||
}
|
}
|
||||||
bool fromwire_dualopend_got_offer(const tal_t *ctx, const void *p, struct channel_id *channel_id, struct amount_sat *opener_funding, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_msat *htlc_minimum_msat, u32 *feerate_per_kw_funding, u32 *feerate_per_kw_commitment, u16 *to_self_delay, u16 *max_accepted_htlcs, u8 *channel_flags, u32 *locktime, u8 **shutdown_scriptpubkey)
|
bool fromwire_dualopend_got_offer(const tal_t *ctx, const void *p, struct channel_id *channel_id, struct amount_sat *opener_funding, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_msat *htlc_minimum_msat, u32 *feerate_per_kw_funding, u32 *feerate_per_kw_commitment, u16 *to_self_delay, u16 *max_accepted_htlcs, u8 *channel_flags, u32 *locktime, u8 **shutdown_scriptpubkey, struct amount_sat *requested_amt, u32 *lease_blockheight_start)
|
||||||
{
|
{
|
||||||
u16 shutdown_len;
|
u16 shutdown_len;
|
||||||
|
|
||||||
@ -293,12 +295,14 @@ bool fromwire_dualopend_got_offer(const tal_t *ctx, const void *p, struct channe
|
|||||||
// 2nd case shutdown_scriptpubkey
|
// 2nd case shutdown_scriptpubkey
|
||||||
*shutdown_scriptpubkey = shutdown_len ? tal_arr(ctx, u8, shutdown_len) : NULL;
|
*shutdown_scriptpubkey = shutdown_len ? tal_arr(ctx, u8, shutdown_len) : NULL;
|
||||||
fromwire_u8_array(&cursor, &plen, *shutdown_scriptpubkey, shutdown_len);
|
fromwire_u8_array(&cursor, &plen, *shutdown_scriptpubkey, shutdown_len);
|
||||||
|
*requested_amt = fromwire_amount_sat(&cursor, &plen);
|
||||||
|
*lease_blockheight_start = fromwire_u32(&cursor, &plen);
|
||||||
return cursor != NULL;
|
return cursor != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WIRE: DUALOPEND_GOT_OFFER_REPLY */
|
/* WIRE: DUALOPEND_GOT_OFFER_REPLY */
|
||||||
/* master->dualopend: reply back with our first funding info/contribs */
|
/* master->dualopend: reply back with our first funding info/contribs */
|
||||||
u8 *towire_dualopend_got_offer_reply(const tal_t *ctx, struct amount_sat accepter_funding, const struct wally_psbt *psbt, const u8 *our_shutdown_scriptpubkey)
|
u8 *towire_dualopend_got_offer_reply(const tal_t *ctx, struct amount_sat accepter_funding, const struct wally_psbt *psbt, const u8 *our_shutdown_scriptpubkey, const struct lease_rates *lease_rates)
|
||||||
{
|
{
|
||||||
u16 shutdown_len = tal_count(our_shutdown_scriptpubkey);
|
u16 shutdown_len = tal_count(our_shutdown_scriptpubkey);
|
||||||
u8 *p = tal_arr(ctx, u8, 0);
|
u8 *p = tal_arr(ctx, u8, 0);
|
||||||
@ -308,10 +312,16 @@ u8 *towire_dualopend_got_offer_reply(const tal_t *ctx, struct amount_sat accepte
|
|||||||
towire_wally_psbt(&p, psbt);
|
towire_wally_psbt(&p, psbt);
|
||||||
towire_u16(&p, shutdown_len);
|
towire_u16(&p, shutdown_len);
|
||||||
towire_u8_array(&p, our_shutdown_scriptpubkey, shutdown_len);
|
towire_u8_array(&p, our_shutdown_scriptpubkey, shutdown_len);
|
||||||
|
if (!lease_rates)
|
||||||
|
towire_bool(&p, false);
|
||||||
|
else {
|
||||||
|
towire_bool(&p, true);
|
||||||
|
towire_lease_rates(&p, lease_rates);
|
||||||
|
}
|
||||||
|
|
||||||
return memcheck(p, tal_count(p));
|
return memcheck(p, tal_count(p));
|
||||||
}
|
}
|
||||||
bool fromwire_dualopend_got_offer_reply(const tal_t *ctx, const void *p, struct amount_sat *accepter_funding, struct wally_psbt **psbt, u8 **our_shutdown_scriptpubkey)
|
bool fromwire_dualopend_got_offer_reply(const tal_t *ctx, const void *p, struct amount_sat *accepter_funding, struct wally_psbt **psbt, u8 **our_shutdown_scriptpubkey, struct lease_rates **lease_rates)
|
||||||
{
|
{
|
||||||
u16 shutdown_len;
|
u16 shutdown_len;
|
||||||
|
|
||||||
@ -326,6 +336,12 @@ bool fromwire_dualopend_got_offer_reply(const tal_t *ctx, const void *p, struct
|
|||||||
// 2nd case our_shutdown_scriptpubkey
|
// 2nd case our_shutdown_scriptpubkey
|
||||||
*our_shutdown_scriptpubkey = shutdown_len ? tal_arr(ctx, u8, shutdown_len) : NULL;
|
*our_shutdown_scriptpubkey = shutdown_len ? tal_arr(ctx, u8, shutdown_len) : NULL;
|
||||||
fromwire_u8_array(&cursor, &plen, *our_shutdown_scriptpubkey, shutdown_len);
|
fromwire_u8_array(&cursor, &plen, *our_shutdown_scriptpubkey, shutdown_len);
|
||||||
|
if (!fromwire_bool(&cursor, &plen))
|
||||||
|
*lease_rates = NULL;
|
||||||
|
else {
|
||||||
|
*lease_rates = tal(ctx, struct lease_rates);
|
||||||
|
fromwire_lease_rates(&cursor, &plen, *lease_rates);
|
||||||
|
}
|
||||||
return cursor != NULL;
|
return cursor != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -605,7 +621,7 @@ bool fromwire_dualopend_fail(const tal_t *ctx, const void *p, wirestring **reaso
|
|||||||
|
|
||||||
/* WIRE: DUALOPEND_OPENER_INIT */
|
/* WIRE: DUALOPEND_OPENER_INIT */
|
||||||
/* master->dualopend: hello */
|
/* master->dualopend: hello */
|
||||||
u8 *towire_dualopend_opener_init(const tal_t *ctx, const struct wally_psbt *psbt, struct amount_sat funding_amount, const u8 *local_shutdown_scriptpubkey, u32 feerate_per_kw, u32 feerate_per_kw_funding, u8 channel_flags)
|
u8 *towire_dualopend_opener_init(const tal_t *ctx, const struct wally_psbt *psbt, struct amount_sat funding_amount, const u8 *local_shutdown_scriptpubkey, u32 feerate_per_kw, u32 feerate_per_kw_funding, u8 channel_flags, struct amount_sat requested_sats, u32 blockheight)
|
||||||
{
|
{
|
||||||
u16 local_shutdown_len = tal_count(local_shutdown_scriptpubkey);
|
u16 local_shutdown_len = tal_count(local_shutdown_scriptpubkey);
|
||||||
u8 *p = tal_arr(ctx, u8, 0);
|
u8 *p = tal_arr(ctx, u8, 0);
|
||||||
@ -618,10 +634,12 @@ u8 *towire_dualopend_opener_init(const tal_t *ctx, const struct wally_psbt *psbt
|
|||||||
towire_u32(&p, feerate_per_kw);
|
towire_u32(&p, feerate_per_kw);
|
||||||
towire_u32(&p, feerate_per_kw_funding);
|
towire_u32(&p, feerate_per_kw_funding);
|
||||||
towire_u8(&p, channel_flags);
|
towire_u8(&p, channel_flags);
|
||||||
|
towire_amount_sat(&p, requested_sats);
|
||||||
|
towire_u32(&p, blockheight);
|
||||||
|
|
||||||
return memcheck(p, tal_count(p));
|
return memcheck(p, tal_count(p));
|
||||||
}
|
}
|
||||||
bool fromwire_dualopend_opener_init(const tal_t *ctx, const void *p, struct wally_psbt **psbt, struct amount_sat *funding_amount, u8 **local_shutdown_scriptpubkey, u32 *feerate_per_kw, u32 *feerate_per_kw_funding, u8 *channel_flags)
|
bool fromwire_dualopend_opener_init(const tal_t *ctx, const void *p, struct wally_psbt **psbt, struct amount_sat *funding_amount, u8 **local_shutdown_scriptpubkey, u32 *feerate_per_kw, u32 *feerate_per_kw_funding, u8 *channel_flags, struct amount_sat *requested_sats, u32 *blockheight)
|
||||||
{
|
{
|
||||||
u16 local_shutdown_len;
|
u16 local_shutdown_len;
|
||||||
|
|
||||||
@ -639,6 +657,8 @@ bool fromwire_dualopend_opener_init(const tal_t *ctx, const void *p, struct wall
|
|||||||
*feerate_per_kw = fromwire_u32(&cursor, &plen);
|
*feerate_per_kw = fromwire_u32(&cursor, &plen);
|
||||||
*feerate_per_kw_funding = fromwire_u32(&cursor, &plen);
|
*feerate_per_kw_funding = fromwire_u32(&cursor, &plen);
|
||||||
*channel_flags = fromwire_u8(&cursor, &plen);
|
*channel_flags = fromwire_u8(&cursor, &plen);
|
||||||
|
*requested_sats = fromwire_amount_sat(&cursor, &plen);
|
||||||
|
*blockheight = fromwire_u32(&cursor, &plen);
|
||||||
return cursor != NULL;
|
return cursor != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -912,4 +932,4 @@ bool fromwire_dualopend_dev_memleak_reply(const void *p, bool *leak)
|
|||||||
*leak = fromwire_bool(&cursor, &plen);
|
*leak = fromwire_bool(&cursor, &plen);
|
||||||
return cursor != NULL;
|
return cursor != NULL;
|
||||||
}
|
}
|
||||||
// SHA256STAMP:2aa38c967abfcd0110b6c65f62b13aa77cefacaf5f036a9217bb5d63220f1e1f
|
// SHA256STAMP:d8a31a5de292561ccfb5b7050c911b590db44a50209e02469179904708328861
|
||||||
|
15
openingd/dualopend_wiregen.h
generated
15
openingd/dualopend_wiregen.h
generated
@ -18,6 +18,7 @@
|
|||||||
#include <common/htlc_wire.h>
|
#include <common/htlc_wire.h>
|
||||||
#include <common/penalty_base.h>
|
#include <common/penalty_base.h>
|
||||||
#include <common/per_peer_state.h>
|
#include <common/per_peer_state.h>
|
||||||
|
#include <wire/peer_wire.h>
|
||||||
|
|
||||||
enum dualopend_wire {
|
enum dualopend_wire {
|
||||||
WIRE_DUALOPEND_INIT = 7000,
|
WIRE_DUALOPEND_INIT = 7000,
|
||||||
@ -96,13 +97,13 @@ bool fromwire_dualopend_reinit(const tal_t *ctx, const void *p, const struct cha
|
|||||||
|
|
||||||
/* WIRE: DUALOPEND_GOT_OFFER */
|
/* WIRE: DUALOPEND_GOT_OFFER */
|
||||||
/* dualopend->master: they offered channel */
|
/* dualopend->master: they offered channel */
|
||||||
u8 *towire_dualopend_got_offer(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat opener_funding, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_msat htlc_minimum_msat, u32 feerate_per_kw_funding, u32 feerate_per_kw_commitment, u16 to_self_delay, u16 max_accepted_htlcs, u8 channel_flags, u32 locktime, const u8 *shutdown_scriptpubkey);
|
u8 *towire_dualopend_got_offer(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat opener_funding, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_msat htlc_minimum_msat, u32 feerate_per_kw_funding, u32 feerate_per_kw_commitment, u16 to_self_delay, u16 max_accepted_htlcs, u8 channel_flags, u32 locktime, const u8 *shutdown_scriptpubkey, struct amount_sat requested_amt, u32 lease_blockheight_start);
|
||||||
bool fromwire_dualopend_got_offer(const tal_t *ctx, const void *p, struct channel_id *channel_id, struct amount_sat *opener_funding, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_msat *htlc_minimum_msat, u32 *feerate_per_kw_funding, u32 *feerate_per_kw_commitment, u16 *to_self_delay, u16 *max_accepted_htlcs, u8 *channel_flags, u32 *locktime, u8 **shutdown_scriptpubkey);
|
bool fromwire_dualopend_got_offer(const tal_t *ctx, const void *p, struct channel_id *channel_id, struct amount_sat *opener_funding, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_msat *htlc_minimum_msat, u32 *feerate_per_kw_funding, u32 *feerate_per_kw_commitment, u16 *to_self_delay, u16 *max_accepted_htlcs, u8 *channel_flags, u32 *locktime, u8 **shutdown_scriptpubkey, struct amount_sat *requested_amt, u32 *lease_blockheight_start);
|
||||||
|
|
||||||
/* WIRE: DUALOPEND_GOT_OFFER_REPLY */
|
/* WIRE: DUALOPEND_GOT_OFFER_REPLY */
|
||||||
/* master->dualopend: reply back with our first funding info/contribs */
|
/* master->dualopend: reply back with our first funding info/contribs */
|
||||||
u8 *towire_dualopend_got_offer_reply(const tal_t *ctx, struct amount_sat accepter_funding, const struct wally_psbt *psbt, const u8 *our_shutdown_scriptpubkey);
|
u8 *towire_dualopend_got_offer_reply(const tal_t *ctx, struct amount_sat accepter_funding, const struct wally_psbt *psbt, const u8 *our_shutdown_scriptpubkey, const struct lease_rates *lease_rates);
|
||||||
bool fromwire_dualopend_got_offer_reply(const tal_t *ctx, const void *p, struct amount_sat *accepter_funding, struct wally_psbt **psbt, u8 **our_shutdown_scriptpubkey);
|
bool fromwire_dualopend_got_offer_reply(const tal_t *ctx, const void *p, struct amount_sat *accepter_funding, struct wally_psbt **psbt, u8 **our_shutdown_scriptpubkey, struct lease_rates **lease_rates);
|
||||||
|
|
||||||
/* WIRE: DUALOPEND_GOT_RBF_OFFER */
|
/* WIRE: DUALOPEND_GOT_RBF_OFFER */
|
||||||
/* dualopend->master: they offered a RBF */
|
/* dualopend->master: they offered a RBF */
|
||||||
@ -152,8 +153,8 @@ bool fromwire_dualopend_fail(const tal_t *ctx, const void *p, wirestring **reaso
|
|||||||
|
|
||||||
/* WIRE: DUALOPEND_OPENER_INIT */
|
/* WIRE: DUALOPEND_OPENER_INIT */
|
||||||
/* master->dualopend: hello */
|
/* master->dualopend: hello */
|
||||||
u8 *towire_dualopend_opener_init(const tal_t *ctx, const struct wally_psbt *psbt, struct amount_sat funding_amount, const u8 *local_shutdown_scriptpubkey, u32 feerate_per_kw, u32 feerate_per_kw_funding, u8 channel_flags);
|
u8 *towire_dualopend_opener_init(const tal_t *ctx, const struct wally_psbt *psbt, struct amount_sat funding_amount, const u8 *local_shutdown_scriptpubkey, u32 feerate_per_kw, u32 feerate_per_kw_funding, u8 channel_flags, struct amount_sat requested_sats, u32 blockheight);
|
||||||
bool fromwire_dualopend_opener_init(const tal_t *ctx, const void *p, struct wally_psbt **psbt, struct amount_sat *funding_amount, u8 **local_shutdown_scriptpubkey, u32 *feerate_per_kw, u32 *feerate_per_kw_funding, u8 *channel_flags);
|
bool fromwire_dualopend_opener_init(const tal_t *ctx, const void *p, struct wally_psbt **psbt, struct amount_sat *funding_amount, u8 **local_shutdown_scriptpubkey, u32 *feerate_per_kw, u32 *feerate_per_kw_funding, u8 *channel_flags, struct amount_sat *requested_sats, u32 *blockheight);
|
||||||
|
|
||||||
/* WIRE: DUALOPEND_FUNDING_SIGS */
|
/* WIRE: DUALOPEND_FUNDING_SIGS */
|
||||||
/* dualopend->master received tx_sigs from peer */
|
/* dualopend->master received tx_sigs from peer */
|
||||||
@ -216,4 +217,4 @@ bool fromwire_dualopend_dev_memleak_reply(const void *p, bool *leak);
|
|||||||
|
|
||||||
|
|
||||||
#endif /* LIGHTNING_OPENINGD_DUALOPEND_WIREGEN_H */
|
#endif /* LIGHTNING_OPENINGD_DUALOPEND_WIREGEN_H */
|
||||||
// SHA256STAMP:2aa38c967abfcd0110b6c65f62b13aa77cefacaf5f036a9217bb5d63220f1e1f
|
// SHA256STAMP:d8a31a5de292561ccfb5b7050c911b590db44a50209e02469179904708328861
|
||||||
|
Loading…
Reference in New Issue
Block a user