Change signature of SHAMap::getFetchPack to use SHAMapHash

This commit is contained in:
Howard Hinnant
2015-11-30 16:02:31 -05:00
committed by Nik Bougalis
parent 493752e1c6
commit 0dbacedb58
3 changed files with 5 additions and 5 deletions

View File

@@ -1915,12 +1915,12 @@ void LedgerMasterImp::makeFetchPack (
auto fpAppender = []( auto fpAppender = [](
protocol::TMGetObjectByHash* reply, protocol::TMGetObjectByHash* reply,
std::uint32_t ledgerSeq, std::uint32_t ledgerSeq,
uint256 const& hash, SHAMapHash const& hash,
const Blob& blob) const Blob& blob)
{ {
protocol::TMIndexedObject& newObj = * (reply->add_objects ()); protocol::TMIndexedObject& newObj = * (reply->add_objects ());
newObj.set_ledgerseq (ledgerSeq); newObj.set_ledgerseq (ledgerSeq);
newObj.set_hash (hash.begin (), 256 / 8); newObj.set_hash (hash.as_uint256().begin (), 256 / 8);
newObj.set_data (&blob[0], blob.size ()); newObj.set_data (&blob[0], blob.size ());
}; };

View File

@@ -215,7 +215,7 @@ public:
void visitDifferences(SHAMap* have, std::function<bool(SHAMapAbstractNode&)>) const; void visitDifferences(SHAMap* have, std::function<bool(SHAMapAbstractNode&)>) const;
void getFetchPack (SHAMap * have, bool includeLeaves, int max, void getFetchPack (SHAMap * have, bool includeLeaves, int max,
std::function<void (uint256 const&, const Blob&)>) const; std::function<void (SHAMapHash const&, const Blob&)>) const;
void setUnbacked (); void setUnbacked ();

View File

@@ -711,7 +711,7 @@ Note: a caller should set includeLeaves to false for transaction trees.
There's no point in including the leaves of transaction trees. There's no point in including the leaves of transaction trees.
*/ */
void SHAMap::getFetchPack (SHAMap* have, bool includeLeaves, int max, void SHAMap::getFetchPack (SHAMap* have, bool includeLeaves, int max,
std::function<void (uint256 const&, const Blob&)> func) const std::function<void (SHAMapHash const&, const Blob&)> func) const
{ {
visitDifferences (have, visitDifferences (have,
[includeLeaves, &max, &func] (SHAMapAbstractNode& smn) -> bool [includeLeaves, &max, &func] (SHAMapAbstractNode& smn) -> bool
@@ -720,7 +720,7 @@ void SHAMap::getFetchPack (SHAMap* have, bool includeLeaves, int max,
{ {
Serializer s; Serializer s;
smn.addRaw (s, snfPREFIX); smn.addRaw (s, snfPREFIX);
func (smn.getNodeHash().as_uint256(), s.peekData()); func (smn.getNodeHash(), s.peekData());
if (--max <= 0) if (--max <= 0)
return false; return false;