Reduce Transaction public interface

This commit is contained in:
Nik Bougalis
2015-03-15 19:43:20 -07:00
parent 8a1081f9ef
commit 45070d0e51
3 changed files with 18 additions and 17 deletions

View File

@@ -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

View File

@@ -119,8 +119,6 @@ public:
static Transaction::pointer load (uint256 const& id);
static bool isHexTxID (std::string const&);
private:
uint256 mTransactionID;
RippleAddress mAccountFrom;

View File

@@ -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);