mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 02:55:50 +00:00
Helper function to parse families. Code to issue new accounts.
This commit is contained in:
23
Wallet.cpp
23
Wallet.cpp
@@ -350,6 +350,11 @@ std::string LocalAccount::getFullName() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string LocalAccount::getFamilyName() const
|
||||
{
|
||||
return mFamily->getShortName();
|
||||
}
|
||||
|
||||
bool LocalAccount::isIssued() const
|
||||
{
|
||||
return mSeq < mFamily->getSeq();
|
||||
@@ -471,6 +476,24 @@ std::string Wallet::getShortName(const uint160& famBase)
|
||||
return fit->second->getShortName();
|
||||
}
|
||||
|
||||
LocalAccount::pointer Wallet::getNewLocalAccount(const uint160& family)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||
std::map<uint160, LocalAccountFamily::pointer>::iterator fit=mFamilies.find(family);
|
||||
if(fit==mFamilies.end()) return LocalAccount::pointer();
|
||||
|
||||
uint32 seq=fit->second->getSeq();
|
||||
uint160 acct=fit->second->getAccount(seq, true);
|
||||
fit->second->setSeq(seq+1); // FIXME: writeout new seq
|
||||
|
||||
std::map<uint160, LocalAccount::pointer>::iterator ait=mAccounts.find(acct);
|
||||
if(ait!=mAccounts.end()) return ait->second;
|
||||
|
||||
LocalAccount::pointer lac(new LocalAccount(fit->second, seq));
|
||||
mAccounts.insert(std::make_pair(acct, lac));
|
||||
return lac;
|
||||
}
|
||||
|
||||
LocalAccount::pointer Wallet::getLocalAccount(const uint160& family, int seq)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||
|
||||
Reference in New Issue
Block a user