Skip to content

Commit

Permalink
listtransactions: don't create a msat field called "satoshis".
Browse files Browse the repository at this point in the history
That's a terrible, terrible idea.  (Documentation comes in later patch
which has the schema).

Also, blockheight is a u32, so simplify.

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Deprecated: JSON-RPC: `listtransactions` `outputs` `satoshis` field (use `msat` instead).
  • Loading branch information
rustyrussell committed Jun 25, 2021
1 parent d8136d8 commit 0a99b8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/test_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ def test_transaction_annotations(node_factory, bitcoind):
assert(len(txs) == 1)
tx = txs[0]
output = tx['outputs'][idx]
assert(output['type'] == 'deposit' and output['satoshis'] == '1000000000msat')
assert(output['type'] == 'deposit' and output['msat'] == Millisatoshi(1000000000))

# ... and all other output should be change, and have no annotations
types = []
Expand Down
6 changes: 4 additions & 2 deletions wallet/walletrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ static void json_transaction_details(struct json_stream *response,
json_object_start(response, NULL);
json_add_txid(response, "hash", &tx->id);
json_add_hex_talarr(response, "rawtx", tx->rawtx);
json_add_u64(response, "blockheight", tx->blockheight);
json_add_num(response, "blockheight", tx->blockheight);
json_add_num(response, "txindex", tx->txindex);
#if EXPERIMENTAL_FEATURES
if (tx->annotation.type != 0)
Expand Down Expand Up @@ -556,7 +556,9 @@ static void json_transaction_details(struct json_stream *response,
json_object_start(response, NULL);

json_add_u32(response, "index", i);
json_add_amount_sat_only(response, "satoshis", sat);
if (deprecated_apis)
json_add_amount_sat_only(response, "satoshis", sat);
json_add_amount_sat_only(response, "msat", sat);

#if EXPERIMENTAL_FEATURES
struct tx_annotation *ann = &tx->output_annotations[i];
Expand Down

0 comments on commit 0a99b8c

Please sign in to comment.