lightningd: put ignore_fee_limits bool into channel struct.

For now, it's set from the global config.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-07-21 16:45:22 +09:30
parent 5471289b39
commit 95b69c2cf8
5 changed files with 18 additions and 6 deletions

View File

@ -262,6 +262,7 @@ struct channel *new_unsaved_channel(struct peer *peer,
channel->future_per_commitment_point = NULL;
channel->lease_commit_sig = NULL;
channel->ignore_fee_limits = ld->config.ignore_fee_limits;
/* No shachain yet */
channel->their_shachain.id = 0;
@ -393,7 +394,8 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
u32 lease_chan_max_msat,
u16 lease_chan_max_ppt,
struct amount_msat htlc_minimum_msat,
struct amount_msat htlc_maximum_msat)
struct amount_msat htlc_maximum_msat,
bool ignore_fee_limits)
{
struct channel *channel = tal(peer->ld, struct channel);
struct amount_msat htlc_min, htlc_max;
@ -541,6 +543,7 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
channel->closer = closer;
channel->close_blockheight = NULL;
channel->state_change_cause = reason;
channel->ignore_fee_limits = ignore_fee_limits;
/* Make sure we see any spends using this key */
if (!local_shutdown_scriptpubkey) {

View File

@ -269,6 +269,9 @@ struct channel {
/* `Channel-shell` of this channel
* (Minimum information required to backup this channel). */
struct scb_chan *scb;
/* Do we allow the peer to set any fee it wants? */
bool ignore_fee_limits;
};
bool channel_is_connected(const struct channel *channel);
@ -345,7 +348,8 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
u32 lease_chan_max_msat,
u16 lease_chan_max_ppt,
struct amount_msat htlc_minimum_msat,
struct amount_msat htlc_maximum_msat);
struct amount_msat htlc_maximum_msat,
bool ignore_fee_limits);
/* new_inflight - Create a new channel_inflight for a channel */
struct channel_inflight *

View File

@ -231,7 +231,8 @@ wallet_commit_channel(struct lightningd *ld,
&lease_start_blockheight)),
0, NULL, 0, 0, /* No leases on v1s */
ld->config.htlc_minimum_msat,
ld->config.htlc_maximum_msat);
ld->config.htlc_maximum_msat,
ld->config.ignore_fee_limits);
/* Now we finally put it in the database. */
wallet_channel_insert(ld->wallet, channel);
@ -1464,7 +1465,8 @@ static struct channel *stub_chan(struct command *cmd,
&blockht)),
0, NULL, 0, 0, /* No leases on v1s */
ld->config.htlc_minimum_msat,
ld->config.htlc_maximum_msat);
ld->config.htlc_maximum_msat,
false);
return channel;
}

View File

@ -1672,7 +1672,8 @@ static bool test_channel_inflight_crud(struct lightningd *ld, const tal_t *ctx)
lease_commit_sig,
7777, 22,
AMOUNT_MSAT(0),
AMOUNT_MSAT(-1ULL));
AMOUNT_MSAT(-1ULL),
false);
db_begin_transaction(w->db);
CHECK(!wallet_err);
wallet_channel_insert(w, chan);

View File

@ -1619,7 +1619,9 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm
lease_chan_max_msat,
lease_chan_max_ppt,
htlc_minimum_msat,
htlc_maximum_msat);
htlc_maximum_msat,
/* FIXME: load from db! */
false);
if (!wallet_channel_load_inflights(w, chan)) {
tal_free(chan);