Skip to content

Commit 4501198

Browse files
committed
[Refactoring] Move non-throwing ParseHashStr from rest to core_read
1 parent 29e23bf commit 4501198

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/core_io.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ extern bool DecodeHexTx(CMutableTransaction& tx, const std::string& strHexTx);
2323
extern bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
2424
extern uint256 ParseHashUV(const UniValue& v, const std::string& strName);
2525
extern uint256 ParseHashStr(const std::string&, const std::string& strName);
26+
extern bool ParseHashStr(const std::string& strReq, uint256& v);
2627
extern std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName);
2728

2829
// core_write.cpp

src/core_read.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@ uint256 ParseHashStr(const std::string& strHex, const std::string& strName)
124124
return result;
125125
}
126126

127+
bool ParseHashStr(const std::string& strReq, uint256& v)
128+
{
129+
if (!IsHex(strReq) || (strReq.size() != 64))
130+
return false;
131+
132+
v.SetHex(strReq);
133+
return true;
134+
}
135+
127136
std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName)
128137
{
129138
std::string strHex;

src/rest.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,6 @@ static std::string AvailableDataFormatsString()
101101
return formats;
102102
}
103103

104-
static bool ParseHashStr(const std::string& strReq, uint256& v)
105-
{
106-
if (!IsHex(strReq) || (strReq.size() != 64))
107-
return false;
108-
109-
v.SetHex(strReq);
110-
return true;
111-
}
112-
113104
static bool CheckWarmup(HTTPRequest* req)
114105
{
115106
std::string statusmessage;

0 commit comments

Comments
 (0)