aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-07-18 22:54:38 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-07-24 17:40:18 +0200
commitfa7b57e5f5a6dafbbadc361ffd27b58afff1ed59 (patch)
tree7fed09f6280c0e6cfcbb7bc075a804426c3a785a /src/rpc
parentfa9077724507faad207f29509a8202fc6ac9d502 (diff)
refactor: Replace ParseHashStr with FromHex
No need to have two functions with different names that achieve the exact same thing.
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/mining.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp
index 8482ce6eb2..d41ec5bdc6 100644
--- a/src/rpc/mining.cpp
+++ b/src/rpc/mining.cpp
@@ -345,13 +345,11 @@ static RPCHelpMan generateblock()
std::vector<CTransactionRef> txs;
const auto raw_txs_or_txids = request.params[1].get_array();
for (size_t i = 0; i < raw_txs_or_txids.size(); i++) {
- const auto str(raw_txs_or_txids[i].get_str());
+ const auto& str{raw_txs_or_txids[i].get_str()};
- uint256 hash;
CMutableTransaction mtx;
- if (ParseHashStr(str, hash)) {
-
- const auto tx = mempool.get(hash);
+ if (auto hash{uint256::FromHex(str)}) {
+ const auto tx{mempool.get(*hash)};
if (!tx) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Transaction %s not in mempool.", str));
}