From 5dfd2436db93928e69bd327750bfb96fb20581a1 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Fri, 22 May 2020 11:08:06 +0200 Subject: [PATCH] wallet: show input txid in little endian for json_listtransactions Changelog-Fixed: jsonrpc: `listtransactions` now displays all txids as little endian Signed-off-by: Antoine Poinsot --- tests/test_misc.py | 1 - wallet/walletrpc.c | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_misc.py b/tests/test_misc.py index c941bba8b..159e50fb1 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -2390,7 +2390,6 @@ def test_commitfee_option(node_factory): assert l1_commit_fees == 2 * l2_commit_fees == 2 * 4 * mock_wu # WU->VB -@pytest.mark.xfail(strict=True) def test_listtransactions(node_factory): """Sanity check for the listtransactions RPC command""" l1, l2 = node_factory.get_nodes(2, opts=[{}, {}]) diff --git a/wallet/walletrpc.c b/wallet/walletrpc.c index e308e933c..189c97a08 100644 --- a/wallet/walletrpc.c +++ b/wallet/walletrpc.c @@ -1035,9 +1035,12 @@ static void json_transaction_details(struct json_stream *response, json_array_start(response, "inputs"); for (size_t i = 0; i < wtx->num_inputs; i++) { + struct bitcoin_txid prevtxid; struct wally_tx_input *in = &wtx->inputs[i]; + bitcoin_tx_input_get_txid(tx->tx, i, &prevtxid); + json_object_start(response, NULL); - json_add_hex(response, "txid", in->txhash, sizeof(in->txhash)); + json_add_txid(response, "txid", &prevtxid); json_add_u32(response, "index", in->index); json_add_u32(response, "sequence", in->sequence); #if EXPERIMENTAL_FEATURES