Skip to content

Commit e7507f3

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#23639: doc: Extract CreateTxDoc in rawtransaction
c771ee8 doc: use BIP125-replaceable (fanquake) 36dc5bb doc: Extract CreateTxDoc in rawtransaction (fanquake) Pull request description: For the fields: inputs, outputs, locktime, replaceable. Similar to #23172. Can be reviewed with `--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space`. ACKs for top commit: MarcoFalke: ACK c771ee8 😸 Tree-SHA512: e6e4211b89bedec472f8381b3cbea5670f82b728955888c794f694164b8d8bdd51a99c64762b625357ac2171005712b82f81ee7c1b8f5c5620bdedeeefa2b9da
2 parents 205877e + c771ee8 commit e7507f3

File tree

2 files changed

+40
-67
lines changed

2 files changed

+40
-67
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 39 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,43 @@ static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue&
6969
}
7070
}
7171

72+
static std::vector<RPCArg> CreateTxDoc()
73+
{
74+
return {
75+
{"inputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The inputs",
76+
{
77+
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
78+
{
79+
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
80+
{"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
81+
{"sequence", RPCArg::Type::NUM, RPCArg::DefaultHint{"depends on the value of the 'replaceable' and 'locktime' arguments"}, "The sequence number"},
82+
},
83+
},
84+
},
85+
},
86+
{"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The outputs (key-value pairs), where none of the keys are duplicated.\n"
87+
"That is, each address can only appear once and there can only be one 'data' object.\n"
88+
"For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n"
89+
" accepted as second parameter.",
90+
{
91+
{"", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::OMITTED, "",
92+
{
93+
{"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT},
94+
},
95+
},
96+
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
97+
{
98+
{"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data"},
99+
},
100+
},
101+
},
102+
},
103+
{"locktime", RPCArg::Type::NUM, RPCArg::Default{0}, "Raw locktime. Non-0 value also locktime-activates inputs"},
104+
{"replaceable", RPCArg::Type::BOOL, RPCArg::Default{false}, "Marks this transaction as BIP125-replaceable.\n"
105+
"Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."},
106+
};
107+
}
108+
72109
static RPCHelpMan getrawtransaction()
73110
{
74111
return RPCHelpMan{
@@ -375,39 +412,7 @@ static RPCHelpMan createrawtransaction()
375412
"Returns hex-encoded raw transaction.\n"
376413
"Note that the transaction's inputs are not signed, and\n"
377414
"it is not stored in the wallet or transmitted to the network.\n",
378-
{
379-
{"inputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The inputs",
380-
{
381-
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
382-
{
383-
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
384-
{"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
385-
{"sequence", RPCArg::Type::NUM, RPCArg::DefaultHint{"depends on the value of the 'replaceable' and 'locktime' arguments"}, "The sequence number"},
386-
},
387-
},
388-
},
389-
},
390-
{"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The outputs (key-value pairs), where none of the keys are duplicated.\n"
391-
"That is, each address can only appear once and there can only be one 'data' object.\n"
392-
"For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n"
393-
" accepted as second parameter.",
394-
{
395-
{"", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::OMITTED, "",
396-
{
397-
{"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT},
398-
},
399-
},
400-
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
401-
{
402-
{"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data"},
403-
},
404-
},
405-
},
406-
},
407-
{"locktime", RPCArg::Type::NUM, RPCArg::Default{0}, "Raw locktime. Non-0 value also locktime-activates inputs"},
408-
{"replaceable", RPCArg::Type::BOOL, RPCArg::Default{false}, "Marks this transaction as BIP125-replaceable.\n"
409-
" Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."},
410-
},
415+
CreateTxDoc(),
411416
RPCResult{
412417
RPCResult::Type::STR_HEX, "transaction", "hex string of the transaction"
413418
},
@@ -1435,39 +1440,7 @@ static RPCHelpMan createpsbt()
14351440
return RPCHelpMan{"createpsbt",
14361441
"\nCreates a transaction in the Partially Signed Transaction format.\n"
14371442
"Implements the Creator role.\n",
1438-
{
1439-
{"inputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The json objects",
1440-
{
1441-
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
1442-
{
1443-
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
1444-
{"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
1445-
{"sequence", RPCArg::Type::NUM, RPCArg::DefaultHint{"depends on the value of the 'replaceable' and 'locktime' arguments"}, "The sequence number"},
1446-
},
1447-
},
1448-
},
1449-
},
1450-
{"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The outputs (key-value pairs), where none of the keys are duplicated.\n"
1451-
"That is, each address can only appear once and there can only be one 'data' object.\n"
1452-
"For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n"
1453-
" accepted as second parameter.",
1454-
{
1455-
{"", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::OMITTED, "",
1456-
{
1457-
{"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT},
1458-
},
1459-
},
1460-
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
1461-
{
1462-
{"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data"},
1463-
},
1464-
},
1465-
},
1466-
},
1467-
{"locktime", RPCArg::Type::NUM, RPCArg::Default{0}, "Raw locktime. Non-0 value also locktime-activates inputs"},
1468-
{"replaceable", RPCArg::Type::BOOL, RPCArg::Default{false}, "Marks this transaction as BIP125 replaceable.\n"
1469-
" Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."},
1470-
},
1443+
CreateTxDoc(),
14711444
RPCResult{
14721445
RPCResult::Type::STR, "", "The resulting raw transaction (base64-encoded string)"
14731446
},

src/wallet/rpcwallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3162,7 +3162,7 @@ static std::vector<RPCArg> FundTxDoc()
31623162
{"conf_target", RPCArg::Type::NUM, RPCArg::DefaultHint{"wallet -txconfirmtarget"}, "Confirmation target in blocks"},
31633163
{"estimate_mode", RPCArg::Type::STR, RPCArg::Default{"unset"}, std::string() + "The fee estimate mode, must be one of (case insensitive):\n"
31643164
" \"" + FeeModes("\"\n\"") + "\""},
3165-
{"replaceable", RPCArg::Type::BOOL, RPCArg::DefaultHint{"wallet default"}, "Marks this transaction as BIP125 replaceable.\n"
3165+
{"replaceable", RPCArg::Type::BOOL, RPCArg::DefaultHint{"wallet default"}, "Marks this transaction as BIP125-replaceable.\n"
31663166
"Allows this transaction to be replaced by a transaction with higher fees"},
31673167
{"solving_data", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "Keys and scripts needed for producing a final transaction with a dummy signature.\n"
31683168
"Used for fee estimation during coin selection.",

0 commit comments

Comments
 (0)