listfunds: add 'blockheight' for confirmed transactions

Needed to calculate the value of all inputs for 'all' in
externalized fundchannel
This commit is contained in:
lisa neigut 2019-08-29 10:54:26 -05:00 committed by Christian Decker
parent 76f27f47dc
commit 5663ecc599
3 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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;

View File

@ -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);