diff --git a/CHANGELOG.md b/CHANGELOG.md index 39b11ed80..db1a501cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index cba4f5130..4dc9fa945 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -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);