mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-07 03:03:58 +01:00
refactor: Replace ParseHashStr with FromHex
No need to have two functions with different names that achieve the exact same thing.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user