mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -147,7 +146,7 @@ void LedgerAcquire::sendRequest(boost::shared_ptr<newcoin::TMGetLedger> tmGL)
|
|||||||
PackedMessage::pointer packet = boost::make_shared<PackedMessage>(tmGL, newcoin::mtGET_LEDGER);
|
PackedMessage::pointer packet = boost::make_shared<PackedMessage>(tmGL, newcoin::mtGET_LEDGER);
|
||||||
|
|
||||||
std::list<boost::weak_ptr<Peer> >::iterator it = mPeers.begin();
|
std::list<boost::weak_ptr<Peer> >::iterator it = mPeers.begin();
|
||||||
while(it!=mPeers.end())
|
while(it != mPeers.end())
|
||||||
{
|
{
|
||||||
if (it->expired())
|
if (it->expired())
|
||||||
mPeers.erase(it++);
|
mPeers.erase(it++);
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user