Skip to content

Commit 2b77008

Browse files
author
MarcoFalke
committed
Merge bitcoin#13422: Drop ParseHashUV in favor of calling ParseHashStr
abd2678 Drop ParseHashUV in favor of calling ParseHashStr (Ben Woosley) Pull request description: The one existing call already validates `get_str` will pass via `checkObject`: https://github.com/bitcoin/bitcoin/pull/13422/files#diff-8fe4d6985ee4acf8bfc1ed8db1e83cb5L586 Split from bitcoin#13420 Tree-SHA512: 35dfa8c28d0c3ceac7a6de7f4eb4a44d912f4c31f5d21c9438f899566ca2b34851f1a58c3417355e55d0c33abb97385f4a47e034bfc8e3cdbbf5f73813ca0582
2 parents 1939536 + abd2678 commit 2b77008

File tree

3 files changed

+1
-10
lines changed

3 files changed

+1
-10
lines changed

src/bitcoin-tx.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
591591
if (!prevOut.checkObject(types))
592592
throw std::runtime_error("prevtxs internal object typecheck fail");
593593

594-
uint256 txid = ParseHashUV(prevOut["txid"], "txid");
594+
uint256 txid = ParseHashStr(prevOut["txid"].get_str(), "txid");
595595

596596
int nOut = atoi(prevOut["vout"].getValStr());
597597
if (nOut < 0)

src/core_io.h

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ CScript ParseScript(const std::string& s);
2222
std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode = false);
2323
bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx, bool try_no_witness = false, bool try_witness = true);
2424
bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
25-
uint256 ParseHashUV(const UniValue& v, const std::string& strName);
2625
uint256 ParseHashStr(const std::string&, const std::string& strName);
2726
std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName);
2827

src/core_read.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,6 @@ bool DecodeHexBlk(CBlock& block, const std::string& strHexBlk)
160160
return true;
161161
}
162162

163-
uint256 ParseHashUV(const UniValue& v, const std::string& strName)
164-
{
165-
std::string strHex;
166-
if (v.isStr())
167-
strHex = v.getValStr();
168-
return ParseHashStr(strHex, strName); // Note: ParseHashStr("") throws a runtime_error
169-
}
170-
171163
uint256 ParseHashStr(const std::string& strHex, const std::string& strName)
172164
{
173165
if (!IsHex(strHex)) // Note: IsHex("") is false

0 commit comments

Comments
 (0)