From 590f12145b058a3224ed1fee1be70d767dde4217 Mon Sep 17 00:00:00 2001 From: niftynei Date: Tue, 8 Feb 2022 14:43:51 -0600 Subject: [PATCH] listpeers: include the `pushed_msat` amount Useful for accounting for missed/historical channel opens, to figure out what the actual sat contribution from each peer is at a utxo level Changelog-Added: JSONRPC: `listpeers` now includes a `pushed_msat` value. For leased channels, is the total lease_fee. --- doc/lightning-listpeers.7.md | 3 ++- doc/schemas/listpeers.schema.json | 7 ++++++- lightningd/peer_control.c | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/lightning-listpeers.7.md b/doc/lightning-listpeers.7.md index 8e4862b1e..b90d112e7 100644 --- a/doc/lightning-listpeers.7.md +++ b/doc/lightning-listpeers.7.md @@ -73,6 +73,7 @@ On success, an object containing **peers** is returned. It is an array of objec - **funding** (object, optional): - **local_msat** (msat): Amount of channel we funded - **remote_msat** (msat): Amount of channel they funded + - **pushed_msat** (msat): Amount pushed from opener to peer - **to_us_msat** (msat, optional): how much of channel is owed to us - **min_to_us_msat** (msat, optional): least amount owed to us ever - **max_to_us_msat** (msat, optional): most amount owed to us ever @@ -377,4 +378,4 @@ Main web site: Lightning RFC site (BOLT \#9): -[comment]: # ( SHA256STAMP:d45de73a968bcc3e7fb699f0acd7a27a4c70d9e9fded8af8c684a71fe012f1ce) +[comment]: # ( SHA256STAMP:001e3cf495571bb09fe29f74adde8a6e40e69ddb1169934924eaf901a1e5f3c0) diff --git a/doc/schemas/listpeers.schema.json b/doc/schemas/listpeers.schema.json index 74a7f782e..e25ef39ac 100644 --- a/doc/schemas/listpeers.schema.json +++ b/doc/schemas/listpeers.schema.json @@ -342,7 +342,8 @@ "additionalProperties": false, "required": [ "local_msat", - "remote_msat" + "remote_msat", + "pushed_msat" ], "properties": { "local_msat": { @@ -352,6 +353,10 @@ "remote_msat": { "type": "msat", "description": "Amount of channel they funded" + }, + "pushed_msat": { + "type": "msat", + "description": "Amount pushed from opener to peer" } } }, diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 212208467..20d4c238e 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -791,6 +791,7 @@ static void json_add_channel(struct lightningd *ld, json_object_start(response, "funding"); json_add_sat_only(response, "local_msat", channel->our_funds); json_add_sat_only(response, "remote_msat", peer_funded_sats); + json_add_amount_msat_only(response, "pushed_msat", channel->push); json_object_end(response); if (!amount_sat_to_msat(&funding_msat, channel->funding_sats)) {