Helper function to parse families. Code to issue new accounts.

This commit is contained in:
JoelKatz
2012-01-07 13:58:52 -08:00
parent 89495d2047
commit 3d8e7027e4
4 changed files with 60 additions and 9 deletions

View File

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