mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Infrastructure for local transactions, wallet interface.
Transaction JSON code.
This commit is contained in:
15
Wallet.cpp
15
Wallet.cpp
@@ -4,6 +4,7 @@
|
||||
#include "openssl/rand.h"
|
||||
#include "openssl/ec.h"
|
||||
|
||||
#include "boost/foreach.hpp"
|
||||
#include "boost/lexical_cast.hpp"
|
||||
|
||||
#include "Wallet.h"
|
||||
@@ -361,6 +362,11 @@ std::string LocalAccount::getFullName() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool LocalAccount::isLocked() const
|
||||
{
|
||||
return mFamily->isLocked();
|
||||
}
|
||||
|
||||
std::string LocalAccount::getFamilyName() const
|
||||
{
|
||||
return mFamily->getShortName();
|
||||
@@ -549,6 +555,15 @@ LocalAccount::pointer Wallet::getLocalAccount(const uint160& acctID)
|
||||
return ait->second;
|
||||
}
|
||||
|
||||
LocalAccount::pointer Wallet::findAccountForTransaction(uint64 amount)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||
for(std::map<uint160, LocalAccount::pointer>::iterator it=mAccounts.begin(); it!=mAccounts.end(); ++it)
|
||||
if(!it->second->isLocked() && (it->second->getBalance()>=amount) )
|
||||
return it->second;
|
||||
return LocalAccount::pointer();
|
||||
}
|
||||
|
||||
LocalAccount::pointer Wallet::parseAccount(const std::string& specifier)
|
||||
{ // <family>:<seq> or <acct_id>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user