mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Replace base_uint(string) with from_hex_text<> (RIPD-897)
Removes the base_uint constructor that took a string. Replaces
that functionality with two free functions named from_hex_text<>.
Use of from_hex_text<> looks like this:
auto v = from_hex_text<uint256>("AAA555");
static_assert (std::is_same<decltype(v), uint256>::value, "Huh!");
from_hex_text<> only operates on base_uint types. At the moment the
list of those types include:
o uint128,
o uint160,
o uint256,
o Directory,
o Account,
o Currency, and
o NodeID.
Using from_hex_text<> with any other types will not compile due to
an enable_if.
This commit is contained in:
committed by
Vinnie Falco
parent
d7def5509d
commit
4515ac0bca
@@ -70,9 +70,9 @@ Json::Value doCanDelete (RPC::Context& context)
|
||||
canDeleteStr.find_first_not_of("0123456789abcdef") ==
|
||||
std::string::npos)
|
||||
{
|
||||
uint256 ledgerHash (canDeleteStr);
|
||||
Ledger::pointer ledger =
|
||||
context.netOps.getLedgerByHash (ledgerHash);
|
||||
Ledger::pointer ledger = context.netOps.getLedgerByHash (
|
||||
from_hex_text<uint256>(canDeleteStr));
|
||||
|
||||
if (!ledger)
|
||||
return RPC::make_error(rpcLGR_NOT_FOUND, "ledgerNotFound");
|
||||
|
||||
|
||||
@@ -55,7 +55,8 @@ Json::Value doTx (RPC::Context& context)
|
||||
if (!isHexTxID (txid))
|
||||
return rpcError (rpcNOT_IMPL);
|
||||
|
||||
auto txn = getApp().getMasterTransaction ().fetch (uint256 (txid), true);
|
||||
auto txn = getApp().getMasterTransaction ().fetch (
|
||||
from_hex_text<uint256>(txid), true);
|
||||
|
||||
if (!txn)
|
||||
return rpcError (rpcTXN_NOT_FOUND);
|
||||
|
||||
Reference in New Issue
Block a user