Skip to content

Commit 3530108

Browse files
author
Antoine Riard
committed
MOVEONLY : move RPC wallets helpers to TransactionDescriptionString
1 parent e173d58 commit 3530108

File tree

1 file changed

+22
-34
lines changed

1 file changed

+22
-34
lines changed

src/wallet/rpcwallet.cpp

+22-34
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,22 @@ 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+
" \"trusted\": xxx, (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.\n"
1367+
" \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction.\n"
1368+
" \"blockindex\": n, (numeric) The index of the transaction in the block that includes it.\n"
1369+
" \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n"
1370+
" \"txid\": \"transactionid\", (string) The transaction id.\n"
1371+
" \"time\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n"
1372+
" \"timereceived\": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT).\n"
1373+
" \"comment\": \"...\", (string) If a comment is associated with the transaction, only present if not empty.\n"
1374+
" \"bip125-replaceable\": \"yes|no|unknown\", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);\n"
1375+
" may be unknown for unconfirmed transactions not in the mempool\n";
1376+
}
1377+
13621378
UniValue listtransactions(const JSONRPCRequest& request)
13631379
{
13641380
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
@@ -1394,19 +1410,8 @@ UniValue listtransactions(const JSONRPCRequest& request)
13941410
" \"vout\": n, (numeric) the vout value\n"
13951411
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
13961412
" '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"
1413+
+ TransactionDescriptionString()
1414+
+ " \"abandoned\": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n"
14101415
" 'send' category of transactions.\n"
14111416
" }\n"
14121417
"]\n"
@@ -1526,17 +1531,8 @@ static UniValue listsinceblock(const JSONRPCRequest& request)
15261531
" for all other categories\n"
15271532
" \"vout\" : n, (numeric) the vout value\n"
15281533
" \"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"
1534+
+ TransactionDescriptionString()
1535+
+ " \"abandoned\": xxx, (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the 'send' category of transactions.\n"
15401536
" \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
15411537
" \"label\" : \"label\" (string) A comment for the address/transaction, if any\n"
15421538
" \"to\": \"...\", (string) If a comment to is associated with the transaction.\n"
@@ -1658,16 +1654,8 @@ static UniValue gettransaction(const JSONRPCRequest& request)
16581654
" \"amount\" : x.xxx, (numeric) The transaction amount in " + CURRENCY_UNIT + "\n"
16591655
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
16601656
" '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"
1657+
+ TransactionDescriptionString()
1658+
+ " \"details\" : [\n"
16711659
" {\n"
16721660
" \"address\" : \"address\", (string) The bitcoin address involved in the transaction\n"
16731661
" \"category\" : (string) The transaction category.\n"

0 commit comments

Comments
 (0)