mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
listfunds: add 'blockheight' for confirmed transactions
Needed to calculate the value of all inputs for 'all' in externalized fundchannel
This commit is contained in:
parent
76f27f47dc
commit
5663ecc599
@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- JSON API: `listfunds` now lists a blockheight for confirmed transactions
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -310,7 +310,7 @@ static const struct utxo **wallet_select(const tal_t *ctx, struct wallet *w,
|
||||
|
||||
/* If we require confirmations check that we have a
|
||||
* confirmation height and that it is below the required
|
||||
* maxheight (current_height - minconf */
|
||||
* maxheight (current_height - minconf) */
|
||||
if (maxheight != 0 &&
|
||||
(!u->blockheight || *u->blockheight > maxheight))
|
||||
continue;
|
||||
|
@ -629,9 +629,10 @@ static struct command_result *json_listfunds(struct command *cmd,
|
||||
|
||||
if (utxos[i]->spendheight)
|
||||
json_add_string(response, "status", "spent");
|
||||
else if (utxos[i]->blockheight)
|
||||
else if (utxos[i]->blockheight) {
|
||||
json_add_string(response, "status", "confirmed");
|
||||
else
|
||||
json_add_num(response, "blockheight", *utxos[i]->blockheight);
|
||||
} else
|
||||
json_add_string(response, "status", "unconfirmed");
|
||||
|
||||
json_object_end(response);
|
||||
|
Loading…
Reference in New Issue
Block a user