Fix the 'getAccountHash() == mAccountStateMap->getHash()' bug.

'getNeededHashes' can do the wrong thing (report no needed hashes when we
need them all) if we have a ledger's root node but not the root node of the
tree we're querying.
This commit is contained in:
JoelKatz
2013-03-17 22:04:34 -07:00
parent 9edfd51430
commit 00913f838f
3 changed files with 36 additions and 4 deletions

View File

@@ -1614,6 +1614,32 @@ uint64 Ledger::scaleFeeLoad(uint64 fee)
return theApp->getFeeTrack().scaleFeeLoad(fee, mBaseFee, mReferenceFeeUnits);
}
std::vector<uint256> Ledger::getNeededTransactionHashes(int max)
{
std::vector<uint256> ret;
if (mTransHash.isNonZero())
{
if (mTransactionMap->getHash().isZero())
ret.push_back(mTransHash);
else
ret = mTransactionMap->getNeededHashes(max);
}
return ret;
}
std::vector<uint256> Ledger::getNeededAccountStateHashes(int max)
{
std::vector<uint256> ret;
if (mAccountHash.isNonZero())
{
if (mAccountStateMap->getHash().isZero())
ret.push_back(mAccountHash);
else
ret = mAccountStateMap->getNeededHashes(max);
}
return ret;
}
BOOST_AUTO_TEST_SUITE(quality)
BOOST_AUTO_TEST_CASE( getquality )