Merge branch 'master' of github.com:jedmccaleb/NewCoin

This commit is contained in:
Arthur Britto
2012-05-09 17:05:47 -07:00
2 changed files with 8 additions and 8 deletions

View File

@@ -116,7 +116,7 @@ void Application::run()
rootAddress.setAccountPublic(rootFamilyGenerator, 0); rootAddress.setAccountPublic(rootFamilyGenerator, 0);
std::cerr << "Root account: " << rootAddress.humanAccountID() << std::endl; std::cerr << "Root account: " << rootAddress.humanAccountID() << std::endl;
Ledger::pointer firstLedger(new Ledger(rootAddress, 100000000)); Ledger::pointer firstLedger = boost::make_shared<Ledger>(rootAddress, 100000000);
assert(!!firstLedger->getAccountState(rootAddress)); assert(!!firstLedger->getAccountState(rootAddress));
firstLedger->updateHash(); firstLedger->updateHash();
firstLedger->setClosed(); firstLedger->setClosed();

View File

@@ -48,7 +48,6 @@ void LedgerAcquire::trigger(bool timer)
if (!mHaveBase) if (!mHaveBase)
{ {
// WRITEME: Do we need to search for peers?
boost::shared_ptr<newcoin::TMGetLedger> tmGL = boost::make_shared<newcoin::TMGetLedger>(); boost::shared_ptr<newcoin::TMGetLedger> tmGL = boost::make_shared<newcoin::TMGetLedger>();
tmGL->set_ledgerhash(mHash.begin(), mHash.size()); tmGL->set_ledgerhash(mHash.begin(), mHash.size());
tmGL->set_itype(newcoin::liBASE); tmGL->set_itype(newcoin::liBASE);
@@ -203,15 +202,16 @@ bool LedgerAcquire::takeBase(const std::string& data)
{ // Return value: true=normal, false=bad data { // Return value: true=normal, false=bad data
boost::recursive_mutex::scoped_lock sl(mLock); boost::recursive_mutex::scoped_lock sl(mLock);
if (mHaveBase) return true; if (mHaveBase) return true;
Ledger* ledger = new Ledger(data); mLedger = boost::make_shared<Ledger>(data);
if (ledger->getHash() != mHash) if (mLedger->getHash() != mHash)
{ {
delete ledger; mLedger = Ledger::pointer();
return false; return false;
} }
mLedger = Ledger::pointer(ledger);
mLedger->setAcquiring();
mHaveBase = true; mHaveBase = true;
if (!mLedger->getTransHash()) mHaveTransactions = true;
if (!mLedger->getAccountHash()) mHaveState = true;
mLedger->setAcquiring();
return true; return true;
} }