mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Reduce Transaction public interface
This commit is contained in:
@@ -189,18 +189,4 @@ Json::Value Transaction::getJson (int options, bool binary) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Transaction::isHexTxID (std::string const& txid)
|
||||
{
|
||||
if (txid.size () != 64)
|
||||
return false;
|
||||
|
||||
auto const ret = std::find_if (txid.begin (), txid.end (),
|
||||
[](std::string::value_type c)
|
||||
{
|
||||
return !std::isxdigit (c);
|
||||
});
|
||||
|
||||
return (ret == txid.end ());
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -119,8 +119,6 @@ public:
|
||||
|
||||
static Transaction::pointer load (uint256 const& id);
|
||||
|
||||
static bool isHexTxID (std::string const&);
|
||||
|
||||
private:
|
||||
uint256 mTransactionID;
|
||||
RippleAddress mAccountFrom;
|
||||
|
||||
@@ -25,6 +25,23 @@ namespace ripple {
|
||||
// {
|
||||
// transaction: <hex>
|
||||
// }
|
||||
|
||||
static
|
||||
bool
|
||||
isHexTxID (std::string const& txid)
|
||||
{
|
||||
if (txid.size () != 64)
|
||||
return false;
|
||||
|
||||
auto const ret = std::find_if (txid.begin (), txid.end (),
|
||||
[](std::string::value_type c)
|
||||
{
|
||||
return !std::isxdigit (c);
|
||||
});
|
||||
|
||||
return (ret == txid.end ());
|
||||
}
|
||||
|
||||
Json::Value doTx (RPC::Context& context)
|
||||
{
|
||||
if (!context.params.isMember (jss::transaction))
|
||||
@@ -35,7 +52,7 @@ Json::Value doTx (RPC::Context& context)
|
||||
|
||||
auto const txid = context.params[jss::transaction].asString ();
|
||||
|
||||
if (!Transaction::isHexTxID (txid))
|
||||
if (!isHexTxID (txid))
|
||||
return rpcError (rpcNOT_IMPL);
|
||||
|
||||
auto txn = getApp().getMasterTransaction ().fetch (uint256 (txid), true);
|
||||
|
||||
Reference in New Issue
Block a user