mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Support "tx <family> <seq>" RPC command.
This commit is contained in:
@@ -414,9 +414,18 @@ Json::Value RPCServer::doTx(Json::Value& params)
|
|||||||
|
|
||||||
if(extractString(param2, params, 1))
|
if(extractString(param2, params, 1))
|
||||||
{ // family seq
|
{ // family seq
|
||||||
|
LocalAccount::pointer account=theApp->getWallet().parseAccount(param1+":"+param2);
|
||||||
|
if(!account)
|
||||||
|
return JSONRPCError(500, "Account not found");
|
||||||
|
Json::Value ret;
|
||||||
|
if(!theApp->getWallet().getTxsJson(account->getAddress(), ret))
|
||||||
|
return JSONRPCError(500, "Unable to get wallet transactions");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// account
|
||||||
}
|
}
|
||||||
|
|
||||||
// account
|
|
||||||
|
|
||||||
return "not implemented";
|
return "not implemented";
|
||||||
}
|
}
|
||||||
|
|||||||
13
Wallet.cpp
13
Wallet.cpp
@@ -899,3 +899,16 @@ bool Wallet::getTxJson(const uint256& txn, Json::Value& ret)
|
|||||||
ret=it->second->getJson();
|
ret=it->second->getJson();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Wallet::getTxsJson(const uint160& account, Json::Value& ret)
|
||||||
|
{
|
||||||
|
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||||
|
for(std::map<uint256, LocalTransaction::pointer>::iterator it=mTransactions.begin();
|
||||||
|
it!=mTransactions.end(); ++it)
|
||||||
|
{
|
||||||
|
Transaction::pointer txn=it->second->getTransaction();
|
||||||
|
if(txn && ((account==txn->getFromAccount())||(account==txn->getToAccount())) )
|
||||||
|
ret[it->first.GetHex()]=it->second->getJson();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
1
Wallet.h
1
Wallet.h
@@ -74,6 +74,7 @@ public:
|
|||||||
|
|
||||||
Json::Value getFamilyJson(const uint160& family);
|
Json::Value getFamilyJson(const uint160& family);
|
||||||
bool getTxJson(const uint256& txid, Json::Value& value);
|
bool getTxJson(const uint256& txid, Json::Value& value);
|
||||||
|
bool getTxsJson(const uint160& acctid, 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