Skip to content

Commit 2a01640

Browse files
author
MarcoFalke
committed
Merge bitcoin#16689: rpc: add missing fields to wallet rpc help output
f4c8953 Add missing fields in TransactionDescriptionString and others (Antoine Riard) 3530108 MOVEONLY : move RPC wallets helpers to TransactionDescriptionString (Antoine Riard) Pull request description: Knowledge of `walletconflicts` field existence is really nice when you're debugging conflicts. Was added in bitcoin#3671 but never documented in RPC helps. Others were added after a quick skim, we may still have missing ones in wallet rpcs. ACKs for top commit: MarcoFalke: re-ACK f4c8953 (only change is addressing my nits) kristapsk: ACK f4c8953 Tree-SHA512: 2bea4d8743399fb152f942df7454548b896b2ad5654fd4bf60253afec1a5387ef8797ced97776dc7ba4912291263c08abe7c2b608c6a28f9a0df67be4ebc4635
2 parents 2352aec + f4c8953 commit 2a01640

File tree

1 file changed

+53
-57
lines changed

1 file changed

+53
-57
lines changed

src/wallet/rpcwallet.cpp

+53-57
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ static UniValue listreceivedbyaddress(const JSONRPCRequest& request)
11901190
RPCResult{
11911191
"[\n"
11921192
" {\n"
1193-
" \"involvesWatchonly\" : true, (bool) Only returned if imported addresses were involved in transaction\n"
1193+
" \"involvesWatchonly\" : true, (bool) Only returns true if imported addresses were involved in transaction.\n"
11941194
" \"address\" : \"receivingaddress\", (string) The receiving address\n"
11951195
" \"amount\" : x.xxx, (numeric) The total amount in " + CURRENCY_UNIT + " received by the address\n"
11961196
" \"confirmations\" : n, (numeric) The number of confirmations of the most recent transaction included\n"
@@ -1240,7 +1240,7 @@ static UniValue listreceivedbylabel(const JSONRPCRequest& request)
12401240
RPCResult{
12411241
"[\n"
12421242
" {\n"
1243-
" \"involvesWatchonly\" : true, (bool) Only returned if imported addresses were involved in transaction\n"
1243+
" \"involvesWatchonly\" : true, (bool) Only returns true if imported addresses were involved in transaction.\n"
12441244
" \"amount\" : x.xxx, (numeric) The total amount received by addresses with this label\n"
12451245
" \"confirmations\" : n, (numeric) The number of confirmations of the most recent transaction included\n"
12461246
" \"label\" : \"label\" (string) The label of the receiving address. The default label is \"\".\n"
@@ -1359,6 +1359,27 @@ static void ListTransactions(interfaces::Chain::Lock& locked_chain, CWallet* con
13591359
}
13601360
}
13611361

1362+
static const std::string TransactionDescriptionString()
1363+
{
1364+
return " \"confirmations\": n, (numeric) The number of confirmations for the transaction. Negative confirmations means the\n"
1365+
" transaction conflicted that many blocks ago.\n"
1366+
" \"generated\": xxx, (bool) Only present if transaction only input is a coinbase one.\n"
1367+
" \"trusted\": xxx, (bool) Only present if we consider transaction to be trusted and so safe to spend from.\n"
1368+
" \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction.\n"
1369+
" \"blockindex\": n, (numeric) The index of the transaction in the block that includes it.\n"
1370+
" \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n"
1371+
" \"txid\": \"transactionid\", (string) The transaction id.\n"
1372+
" \"walletconflicts\": [ (array) Conflicting transaction ids.\n"
1373+
" \"txid\", (string) The transaction id.\n"
1374+
" ...\n"
1375+
" ],\n"
1376+
" \"time\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n"
1377+
" \"timereceived\": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT).\n"
1378+
" \"comment\": \"...\", (string) If a comment is associated with the transaction, only present if not empty.\n"
1379+
" \"bip125-replaceable\": \"yes|no|unknown\", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);\n"
1380+
" may be unknown for unconfirmed transactions not in the mempool\n";
1381+
}
1382+
13621383
UniValue listtransactions(const JSONRPCRequest& request)
13631384
{
13641385
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
@@ -1381,6 +1402,7 @@ UniValue listtransactions(const JSONRPCRequest& request)
13811402
RPCResult{
13821403
"[\n"
13831404
" {\n"
1405+
" \"involvesWatchonly\": xxx, (bool) Only returns true if imported addresses were involved in transaction.\n"
13841406
" \"address\":\"address\", (string) The bitcoin address of the transaction.\n"
13851407
" \"category\": (string) The transaction category.\n"
13861408
" \"send\" Transactions sent.\n"
@@ -1394,19 +1416,8 @@ UniValue listtransactions(const JSONRPCRequest& request)
13941416
" \"vout\": n, (numeric) the vout value\n"
13951417
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
13961418
" 'send' category of transactions.\n"
1397-
" \"confirmations\": n, (numeric) The number of confirmations for the transaction. Negative confirmations indicate the\n"
1398-
" transaction conflicts with the block chain\n"
1399-
" \"trusted\": xxx, (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.\n"
1400-
" \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction.\n"
1401-
" \"blockindex\": n, (numeric) The index of the transaction in the block that includes it.\n"
1402-
" \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n"
1403-
" \"txid\": \"transactionid\", (string) The transaction id.\n"
1404-
" \"time\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n"
1405-
" \"timereceived\": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT).\n"
1406-
" \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
1407-
" \"bip125-replaceable\": \"yes|no|unknown\", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);\n"
1408-
" may be unknown for unconfirmed transactions not in the mempool\n"
1409-
" \"abandoned\": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n"
1419+
+ TransactionDescriptionString()
1420+
+ " \"abandoned\": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n"
14101421
" 'send' category of transactions.\n"
14111422
" }\n"
14121423
"]\n"
@@ -1515,6 +1526,7 @@ static UniValue listsinceblock(const JSONRPCRequest& request)
15151526
RPCResult{
15161527
"{\n"
15171528
" \"transactions\": [\n"
1529+
" \"involvesWatchonly\": xxx, (bool) Only returns true if imported addresses were involved in transaction.\n"
15181530
" \"address\":\"address\", (string) The bitcoin address of the transaction.\n"
15191531
" \"category\": (string) The transaction category.\n"
15201532
" \"send\" Transactions sent.\n"
@@ -1526,17 +1538,8 @@ static UniValue listsinceblock(const JSONRPCRequest& request)
15261538
" for all other categories\n"
15271539
" \"vout\" : n, (numeric) the vout value\n"
15281540
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the 'send' category of transactions.\n"
1529-
" \"confirmations\": n, (numeric) The number of confirmations for the transaction.\n"
1530-
" When it's < 0, it means the transaction conflicted that many blocks ago.\n"
1531-
" \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction.\n"
1532-
" \"blockindex\": n, (numeric) The index of the transaction in the block that includes it.\n"
1533-
" \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n"
1534-
" \"txid\": \"transactionid\", (string) The transaction id.\n"
1535-
" \"time\": xxx, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT).\n"
1536-
" \"timereceived\": xxx, (numeric) The time received in seconds since epoch (Jan 1 1970 GMT).\n"
1537-
" \"bip125-replaceable\": \"yes|no|unknown\", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);\n"
1538-
" may be unknown for unconfirmed transactions not in the mempool\n"
1539-
" \"abandoned\": xxx, (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the 'send' category of transactions.\n"
1541+
+ TransactionDescriptionString()
1542+
+ " \"abandoned\": xxx, (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the 'send' category of transactions.\n"
15401543
" \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
15411544
" \"label\" : \"label\" (string) A comment for the address/transaction, if any\n"
15421545
" \"to\": \"...\", (string) If a comment to is associated with the transaction.\n"
@@ -1655,40 +1658,33 @@ static UniValue gettransaction(const JSONRPCRequest& request)
16551658
},
16561659
RPCResult{
16571660
"{\n"
1658-
" \"amount\" : x.xxx, (numeric) The transaction amount in " + CURRENCY_UNIT + "\n"
1659-
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
1661+
" \"amount\" : x.xxx, (numeric) The transaction amount in " + CURRENCY_UNIT + "\n"
1662+
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
16601663
" 'send' category of transactions.\n"
1661-
" \"confirmations\" : n, (numeric) The number of confirmations\n"
1662-
" \"blockhash\" : \"hash\", (string) The block hash\n"
1663-
" \"blockindex\" : xx, (numeric) The index of the transaction in the block that includes it\n"
1664-
" \"blocktime\" : ttt, (numeric) The time in seconds since epoch (1 Jan 1970 GMT)\n"
1665-
" \"txid\" : \"transactionid\", (string) The transaction id.\n"
1666-
" \"time\" : ttt, (numeric) The transaction time in seconds since epoch (1 Jan 1970 GMT)\n"
1667-
" \"timereceived\" : ttt, (numeric) The time received in seconds since epoch (1 Jan 1970 GMT)\n"
1668-
" \"bip125-replaceable\": \"yes|no|unknown\", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);\n"
1669-
" may be unknown for unconfirmed transactions not in the mempool\n"
1670-
" \"details\" : [\n"
1671-
" {\n"
1672-
" \"address\" : \"address\", (string) The bitcoin address involved in the transaction\n"
1673-
" \"category\" : (string) The transaction category.\n"
1674-
" \"send\" Transactions sent.\n"
1675-
" \"receive\" Non-coinbase transactions received.\n"
1676-
" \"generate\" Coinbase transactions received with more than 100 confirmations.\n"
1677-
" \"immature\" Coinbase transactions received with 100 or fewer confirmations.\n"
1678-
" \"orphan\" Orphaned coinbase transactions received.\n"
1679-
" \"amount\" : x.xxx, (numeric) The amount in " + CURRENCY_UNIT + "\n"
1680-
" \"label\" : \"label\", (string) A comment for the address/transaction, if any\n"
1681-
" \"vout\" : n, (numeric) the vout value\n"
1682-
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
1664+
+ TransactionDescriptionString()
1665+
+ " \"details\" : [\n"
1666+
" {\n"
1667+
" \"involvesWatchonly\": xxx, (bool) Only returns true if imported addresses were involved in transaction.\n"
1668+
" \"address\" : \"address\", (string) The bitcoin address involved in the transaction\n"
1669+
" \"category\" : (string) The transaction category.\n"
1670+
" \"send\" Transactions sent.\n"
1671+
" \"receive\" Non-coinbase transactions received.\n"
1672+
" \"generate\" Coinbase transactions received with more than 100 confirmations.\n"
1673+
" \"immature\" Coinbase transactions received with 100 or fewer confirmations.\n"
1674+
" \"orphan\" Orphaned coinbase transactions received.\n"
1675+
" \"amount\" : x.xxx, (numeric) The amount in " + CURRENCY_UNIT + "\n"
1676+
" \"label\" : \"label\", (string) A comment for the address/transaction, if any\n"
1677+
" \"vout\" : n, (numeric) the vout value\n"
1678+
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
16831679
" 'send' category of transactions.\n"
1684-
" \"abandoned\": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n"
1680+
" \"abandoned\": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n"
16851681
" 'send' category of transactions.\n"
1686-
" }\n"
1687-
" ,...\n"
1688-
" ],\n"
1689-
" \"hex\" : \"data\" (string) Raw data for transaction\n"
1690-
" \"decoded\" : transaction (json object) Optional, the decoded transaction (only present when `verbose` is passed), equivalent to the\n"
1691-
" RPC decoderawtransaction method, or the RPC getrawtransaction method when `verbose` is passed.\n"
1682+
" }\n"
1683+
" ,...\n"
1684+
" ],\n"
1685+
" \"hex\" : \"data\" (string) Raw data for transaction\n"
1686+
" \"decoded\" : transaction (json object) Optional, the decoded transaction (only present when `verbose` is passed), equivalent to the\n"
1687+
" RPC decoderawtransaction method, or the RPC getrawtransaction method when `verbose` is passed.\n"
16921688
"}\n"
16931689
},
16941690
RPCExamples{

0 commit comments

Comments
 (0)