mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-22 12:05:53 +00:00
Finish "txn <id>" RPC command.
This commit is contained in:
@@ -400,6 +400,16 @@ Json::Value RPCServer::doTx(Json::Value& params)
|
|||||||
|
|
||||||
if(Transaction::isHexTxID(param1))
|
if(Transaction::isHexTxID(param1))
|
||||||
{ // transaction by ID
|
{ // transaction by ID
|
||||||
|
Json::Value ret;
|
||||||
|
uint256 txid(param1);
|
||||||
|
if(theApp->getWallet().getTxJson(txid, ret))
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
Transaction::pointer txn=theApp->getMasterLedger().getCurrentLedger()->getTransaction(txid);
|
||||||
|
if(!txn) txn=theApp->getMasterLedger().getClosingLedger()->getTransaction(txid);
|
||||||
|
if(!txn) txn=Transaction::load(txid);
|
||||||
|
if(!txn) return JSONRPCError(500, "Transaction not found");
|
||||||
|
return txn->getJson(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(extractString(param2, params, 1))
|
if(extractString(param2, params, 1))
|
||||||
|
|||||||
@@ -890,3 +890,12 @@ void Wallet::addLocalTransactions(Json::Value& ret)
|
|||||||
it!=mTransactions.end(); ++it)
|
it!=mTransactions.end(); ++it)
|
||||||
ret[it->first.GetHex()]=it->second->getJson();
|
ret[it->first.GetHex()]=it->second->getJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Wallet::getTxJson(const uint256& txn, Json::Value& ret)
|
||||||
|
{
|
||||||
|
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||||
|
std::map<uint256, LocalTransaction::pointer>::iterator it=mTransactions.find(txn);
|
||||||
|
if(it==mTransactions.end()) return false;
|
||||||
|
ret=it->second->getJson();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
2
Wallet.h
2
Wallet.h
@@ -71,7 +71,9 @@ public:
|
|||||||
bool getFamilyInfo(const uint160& family, std::string& name, std::string& comment);
|
bool getFamilyInfo(const uint160& family, std::string& name, std::string& comment);
|
||||||
bool getFullFamilyInfo(const uint160& family, std::string& name, std::string& comment,
|
bool getFullFamilyInfo(const uint160& family, std::string& name, std::string& comment,
|
||||||
std::string& pubGen, bool& isLocked);
|
std::string& pubGen, bool& isLocked);
|
||||||
|
|
||||||
Json::Value getFamilyJson(const uint160& family);
|
Json::Value getFamilyJson(const uint160& family);
|
||||||
|
bool getTxJson(const uint256& txid, Json::Value& value);
|
||||||
void addLocalTransactions(Json::Value&);
|
void addLocalTransactions(Json::Value&);
|
||||||
|
|
||||||
static bool isHexPrivateKey(const std::string&);
|
static bool isHexPrivateKey(const std::string&);
|
||||||
|
|||||||
Reference in New Issue
Block a user