Simplify SHAMapItem construction:

The existing class offered several constructors which were mostly
unnecessary. This commit eliminates all existing constructors and
introduces a single new one, taking a `Slice`.

The internal buffer is switched from `std::vector` to `Buffer` to
save a minimum of 8 bytes (plus the buffer slack that is inherent
in `std::vector`) per SHAMapItem instance.
This commit is contained in:
Nik Bougalis
2021-01-30 23:26:38 -08:00
parent f91b568069
commit 27d978b891
27 changed files with 91 additions and 151 deletions

View File

@@ -25,6 +25,7 @@
#include <ripple/app/ledger/impl/LedgerDeltaAcquire.h>
#include <ripple/app/ledger/impl/LedgerReplayMsgHandler.h>
#include <ripple/app/ledger/impl/SkipListAcquire.h>
#include <ripple/basics/Slice.h>
#include <ripple/overlay/PeerSet.h>
#include <ripple/overlay/impl/PeerImp.h>
#include <test/jtx.h>
@@ -1276,7 +1277,11 @@ struct LedgerReplayer_test : public beast::unit_test::suite
InboundLedger::Reason::GENERIC, finalHash, totalReplay);
auto skipList = net.client.findSkipListAcquire(finalHash);
auto item = std::make_shared<SHAMapItem>(uint256(12345), Blob(55, 55));
std::uint8_t payload[55] = {
0x6A, 0x09, 0xE6, 0x67, 0xF3, 0xBC, 0xC9, 0x08, 0xB2};
auto item = std::make_shared<SHAMapItem>(
uint256(12345), Slice(payload, sizeof(payload)));
skipList->processData(l->seq(), item);
std::vector<TaskStatus> deltaStatuses;