lightningd: expose ignore_fee_limits field in listpeerchannels.

Changelog-Added: JSON-RPC: `listpeerchannels` has a new field `ignore_fee_limits`
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-07-21 16:47:22 +09:30
parent 472db2390f
commit 8910529e6a
11 changed files with 174 additions and 148 deletions

View File

@@ -1002,6 +1002,7 @@
"ListPeerChannels.channels[].funding_outnum": 11,
"ListPeerChannels.channels[].funding_txid": 10,
"ListPeerChannels.channels[].htlcs[]": 52,
"ListPeerChannels.channels[].ignore_fee_limits": 54,
"ListPeerChannels.channels[].in_fulfilled_msat": 47,
"ListPeerChannels.channels[].in_offered_msat": 45,
"ListPeerChannels.channels[].in_payments_fulfilled": 46,
@@ -3881,6 +3882,10 @@
"added": "v23.02",
"deprecated": false
},
"ListPeerChannels.channels[].ignore_fee_limits": {
"added": "v23.08",
"deprecated": false
},
"ListPeerChannels.channels[].in_fulfilled_msat": {
"added": "v23.02",
"deprecated": false

View File

@@ -1108,6 +1108,7 @@ message ListpeerchannelsChannels {
optional bool peer_connected = 2;
optional ListpeerchannelsChannelsState state = 3;
optional bytes scratch_txid = 4;
optional bool ignore_fee_limits = 54;
optional ListpeerchannelsChannelsFeerate feerate = 6;
optional string owner = 7;
optional string short_channel_id = 8;

View File

@@ -1003,6 +1003,7 @@ impl From<responses::ListpeerchannelsChannels> for pb::ListpeerchannelsChannels
peer_connected: c.peer_connected, // Rule #2 for type boolean?
state: c.state.map(|v| v as i32),
scratch_txid: c.scratch_txid.map(|v| hex::decode(v).unwrap()), // Rule #2 for type txid?
ignore_fee_limits: c.ignore_fee_limits, // Rule #2 for type boolean?
feerate: c.feerate.map(|v| v.into()),
owner: c.owner, // Rule #2 for type string?
short_channel_id: c.short_channel_id.map(|v| v.to_string()), // Rule #2 for type short_channel_id?

2
cln-rpc/src/model.rs generated
View File

@@ -3701,6 +3701,8 @@ pub mod responses {
#[serde(skip_serializing_if = "Option::is_none")]
pub scratch_txid: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ignore_fee_limits: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub feerate: Option<ListpeerchannelsChannelsFeerate>,
#[serde(skip_serializing_if = "Option::is_none")]
pub owner: Option<String>,

File diff suppressed because one or more lines are too long

View File

@@ -790,6 +790,7 @@ def listpeerchannels_channels2py(m):
"peer_connected": m.peer_connected, # PrimitiveField in generate_composite
"state": str(m.state), # EnumField in generate_composite
"scratch_txid": hexlify(m.scratch_txid), # PrimitiveField in generate_composite
"ignore_fee_limits": m.ignore_fee_limits, # PrimitiveField in generate_composite
"owner": m.owner, # PrimitiveField in generate_composite
"short_channel_id": m.short_channel_id, # PrimitiveField in generate_composite
"channel_id": hexlify(m.channel_id), # PrimitiveField in generate_composite

View File

@@ -36,6 +36,7 @@ On success, an object containing **channels** is returned. It is an array of ob
- Bit number
- **names** (array of strings): Feature name for each bit set in this channel\_type:
- Name of feature bit (one of "static\_remotekey/even", "anchor\_outputs/even", "anchors\_zero\_fee\_htlc\_tx/even", "scid\_alias/even", "zeroconf/even")
- **ignore\_fee\_limits** (boolean, optional): set if we allow this peer to set fees to anything they want *(added v23.08)*
- **feerate** (object, optional): Feerates for the current tx:
- **perkw** (u32): Feerate per 1000 weight (i.e kSipa)
- **perkb** (u32): Feerate per 1000 virtual bytes
@@ -194,4 +195,4 @@ Main web site: <https://github.com/ElementsProject/lightning> Lightning
RFC site (BOLT \#9):
<https://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md>
[comment]: # ( SHA256STAMP:f5103dae3b20a7d2a4112a368e753f1dd0518a269bd34c2fd17657c9f90596d7)
[comment]: # ( SHA256STAMP:c530e39c9144b5fbef0f6474170865095bd7b4c48e6378fdb7f9a7697b909473)

View File

@@ -250,6 +250,7 @@ The following tables are currently supported:
- `row` (reference to `peerchannels_channel_type.rowid`, sqltype `INTEGER`)
- `arrindex` (index within array, sqltype `INTEGER`)
- `names` (type `string`, sqltype `TEXT`)
- `ignore_fee_limits` (type `boolean`, sqltype `INTEGER`)
- `feerate_perkw` (type `u32`, sqltype `INTEGER`, from JSON object `feerate`)
- `feerate_perkb` (type `u32`, sqltype `INTEGER`, from JSON object `feerate`)
- `owner` (type `string`, sqltype `TEXT`)
@@ -510,4 +511,4 @@ RESOURCES
---------
Main web site: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:68c72c66bdc8b0515c6d5dddd5ffd14aa0342bd00f17a44929177c48c36a213f)
[comment]: # ( SHA256STAMP:4cfeeb2855f92a12d6a52d912a58df7573fc34f1f17a190bba26e46695f54de6)

View File

@@ -84,6 +84,11 @@
}
}
},
"ignore_fee_limits": {
"type": "boolean",
"added": "v23.08",
"description": "set if we allow this peer to set fees to anything they want"
},
"feerate": {
"type": "object",
"description": "Feerates for the current tx",
@@ -609,6 +614,7 @@
"scratch_txid": {},
"channel_type": {},
"feerate": {},
"ignore_fee_limits": {},
"owner": {},
"short_channel_id": {},
"channel_id": {},
@@ -699,6 +705,7 @@
"scratch_txid": {},
"channel_type": {},
"feerate": {},
"ignore_fee_limits": {},
"owner": {},
"short_channel_id": {},
"channel_id": {},
@@ -788,6 +795,7 @@
"scratch_txid": {},
"channel_type": {},
"feerate": {},
"ignore_fee_limits": {},
"owner": {},
"short_channel_id": {},
"channel_id": {},
@@ -878,6 +886,7 @@
"scratch_txid": {},
"channel_type": {},
"feerate": {},
"ignore_fee_limits": {},
"owner": {},
"alias": {},
"short_channel_id": {},

View File

@@ -748,6 +748,9 @@ static void json_add_channel(struct lightningd *ld,
json_add_node_id(response, "peer_id", &peer->id);
json_add_bool(response, "peer_connected", peer->connected == PEER_CONNECTED);
json_add_channel_type(response, "channel_type", channel->type);
if (channel->ignore_fee_limits) {
json_add_bool(response, "ignore_fee_limits", channel->ignore_fee_limits);
}
}
json_add_string(response, "state", channel_state_name(channel));
if (channel->last_tx && !invalid_last_tx(channel->last_tx)) {

View File

@@ -3762,6 +3762,8 @@ def test_sql(node_factory, bitcoind):
'type': 'string'},
{'name': 'scratch_txid',
'type': 'txid'},
{'name': 'ignore_fee_limits',
'type': 'boolean'},
{'name': 'feerate_perkw',
'type': 'u32'},
{'name': 'feerate_perkb',