listpeers: add 'scratch_txid' for the tx we would broadcast if necessary.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-09-19 12:26:54 +09:30 committed by Christian Decker
parent 5f059ef3fe
commit 7744c41521
2 changed files with 8 additions and 0 deletions

View File

@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- JSON API: `listpeers` has new field `scratch_txid`: the latest tx in channel.
### Changed
### Deprecated

View File

@ -642,6 +642,12 @@ static void json_add_peer(struct lightningd *ld,
json_object_start(response, NULL);
json_add_string(response, "state",
channel_state_name(channel));
if (channel->last_tx) {
struct bitcoin_txid txid;
bitcoin_txid(channel->last_tx, &txid);
json_add_txid(response, "scratch_txid", &txid);
}
if (channel->owner)
json_add_string(response, "owner",
channel->owner->name);