Skip to content

Commit d970a85

Browse files
committed
Move GetAllOutputTypes function from rpc/rawtransaction.cpp to rpc/util.{h|cpp}
1 parent 3ce40e6 commit d970a85

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -542,16 +542,6 @@ static RPCHelpMan decoderawtransaction()
542542
};
543543
}
544544

545-
static std::string GetAllOutputTypes()
546-
{
547-
std::vector<std::string> ret;
548-
using U = std::underlying_type<TxoutType>::type;
549-
for (U i = (U)TxoutType::NONSTANDARD; i <= (U)TxoutType::WITNESS_UNKNOWN; ++i) {
550-
ret.emplace_back(GetTxnOutputType(static_cast<TxoutType>(i)));
551-
}
552-
return Join(ret, ", ");
553-
}
554-
555545
static RPCHelpMan decodescript()
556546
{
557547
return RPCHelpMan{

src/rpc/util.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
const std::string UNIX_EPOCH_TIME = "UNIX epoch time";
2222
const std::string EXAMPLE_ADDRESS[2] = {"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl", "bc1q02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3"};
2323

24+
std::string GetAllOutputTypes()
25+
{
26+
std::vector<std::string> ret;
27+
using U = std::underlying_type<TxoutType>::type;
28+
for (U i = (U)TxoutType::NONSTANDARD; i <= (U)TxoutType::WITNESS_UNKNOWN; ++i) {
29+
ret.emplace_back(GetTxnOutputType(static_cast<TxoutType>(i)));
30+
}
31+
return Join(ret, ", ");
32+
}
33+
2434
void RPCTypeCheck(const UniValue& params,
2535
const std::list<UniValueType>& typesExpected,
2636
bool fAllowNull)

src/rpc/util.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ class CPubKey;
3939
class CScript;
4040
struct Sections;
4141

42+
/**
43+
* Gets all existing output types formatted for RPC help sections.
44+
*
45+
* @return Comma separated string representing output type names.
46+
*/
47+
std::string GetAllOutputTypes();
48+
4249
/** Wrapper for UniValue::VType, which includes typeAny:
4350
* Used to denote don't care type. */
4451
struct UniValueType {

0 commit comments

Comments
 (0)