xrpld
Loading...
Searching...
No Matches
InboundLedger_test.cpp
1#include <test/app/AcquireTestHelpers.h>
2#include <test/jtx/Env.h>
3
4#include <xrpld/app/ledger/InboundLedger.h>
5#include <xrpld/app/ledger/InboundLedgers.h>
6#include <xrpld/app/ledger/LedgerMaster.h>
7
8#include <xrpl/basics/base_uint.h>
9#include <xrpl/basics/chrono.h>
10#include <xrpl/beast/unit_test/suite.h>
11#include <xrpl/ledger/Ledger.h>
12#include <xrpl/nodestore/NodeObject.h>
13#include <xrpl/protocol/HashPrefix.h>
14#include <xrpl/protocol/LedgerHeader.h>
15#include <xrpl/protocol/Serializer.h>
16#include <xrpl/protocol/jss.h>
17#include <xrpl/shamap/SHAMapNodeID.h>
18
19#include <xrpl.pb.h>
20
21#include <chrono>
22#include <memory>
23#include <mutex>
24#include <set>
25#include <utility>
26#include <vector>
27
28namespace xrpl::test {
29
35{
37
45 void
47 {
48 std::recursive_mutex collectionMutex;
49 ScopedLockType collectionLock(collectionMutex);
50 init(collectionLock);
51 }
52
60 [[nodiscard]] ScopedLockType
61 lock() const
62 {
63 return ScopedLockType(mtx_);
64 }
65
70 void
72 {
74 }
75
79 void
81 {
82 ScopedLockType const sl(mtx_);
83 complete_ = true;
84 }
85
89 void
91 {
92 ScopedLockType const sl(mtx_);
93 done();
94 }
95};
96
103[[nodiscard]] static std::shared_ptr<Ledger>
105{
106 // Sound because the acquisition holds a non-const ledger and only hands out a const view.
108}
109
111{
116 static constexpr auto kFastRetry = std::chrono::milliseconds{20};
117
127 [[nodiscard]] unsigned int
129 {
130 return ++seed_;
131 }
132
143 static LedgerHeader
144 makeHeader(UInt256 const& txHash, UInt256 const& accountHash)
145 {
146 LedgerHeader header;
147 header.seq = 2;
151 header.closeFlags = 0;
152 header.txHash = txHash;
153 header.accountHash = accountHash;
154 header.hash = calculateLedgerHash(header);
155 return header;
156 }
157
164 static LedgerHeader
165 makeHeader(DeepChain const& chain)
166 {
167 return makeHeader(UInt256{}, chain.rootHash.asUInt256());
168 }
169
178 static void
179 storeHeader(jtx::Env& env, LedgerHeader const& header)
180 {
181 Serializer s;
183 addRaw(header, s);
184
185 env.app().getNodeFamily().db().store(
186 NodeObjectType::Ledger, std::move(s.modData()), header.hash, header.seq);
187 }
188
199 static void
201 jtx::Env& env,
202 LedgerHeader const& header,
203 DeepChain const& chain,
204 unsigned int maxDepth)
205 {
206 auto& db = env.app().getNodeFamily().db();
207
208 for (auto depth = 0u; depth <= maxDepth; ++depth)
209 {
210 db.store(
212 chain.prefixedNodeAt(depth),
213 chain.nodeAt(depth)->getHash().asUInt256(),
214 header.seq);
215 }
216 }
217
228 {
229 Serializer s;
230 addRaw(header, s);
231
233 packet->set_ledgerhash(header.hash.data(), UInt256::size());
234 packet->set_ledgerseq(header.seq);
235 packet->set_type(protocol::liBASE);
236 packet->add_nodes()->set_nodedata(s.peekData().data(), s.peekData().size());
237 return packet;
238 }
239
250 {
252 env.app(),
253 header.hash,
254 header.seq,
256 stopwatch(),
258 acquire->startAcquire();
259 return acquire;
260 }
261
271 void
273 {
274 testcase("A ledger found locally completes the acquire");
275
276 // A chain ending in a real leaf, so the state map is complete rather than merely rooted.
277 // No transactions, so only the state map is in play.
278 auto const chain = DeepChain::toLeaf(2, nextSeed());
279 auto const header = makeHeader(chain);
280
281 storeHeader(env, header);
282 storeStateNodes(env, header, chain, chain.deepestDepth);
283
284 // acquire() returns the ledger only once the acquisition is complete and unfailed, so a
285 // non-null result shows tryDB() found it in the store.
286 auto const acquired = env.app().getInboundLedgers().acquire(
287 header.hash, header.seq, InboundLedger::Reason::GENERIC);
288
289 BEAST_EXPECT(acquired != nullptr);
290 if (acquired)
291 {
292 BEAST_EXPECT(acquired->isImmutable());
293 BEAST_EXPECT(acquired->header().hash == header.hash);
294 }
295
296 // init() hands a ledger it completed to LedgerMaster itself.
297 BEAST_EXPECT(env.app().getLedgerMaster().getLedgerByHash(header.hash) != nullptr);
298
299 // Nothing on init()'s path records a failure, since init() never reaches done(). This is
300 // the baseline for the check after checkLocal() below: an entry found there came from
301 // done().
302 BEAST_EXPECT(!env.app().getInboundLedgers().isFailure(header.hash));
303
304 // The reason decides where a settled ledger goes: HISTORY counts it toward the fetch rate
305 // instead of handing it to LedgerMaster.
306 {
307 auto const historyChain = DeepChain::toLeaf(2, nextSeed());
308 auto const historyHeader = makeHeader(historyChain);
309
310 storeHeader(env, historyHeader);
311 storeStateNodes(env, historyHeader, historyChain, historyChain.deepestDepth);
312
313 // onLedgerFetched() is the only writer of this rate, and done() calls it before it
314 // posts any work, so the read below is not racing the job queue.
315 auto const rateBefore = env.app().getInboundLedgers().fetchRate();
316
317 auto const history = std::make_shared<InboundLedger>(
318 env.app(),
319 historyHeader.hash,
320 historyHeader.seq,
322 stopwatch(),
324
325 BEAST_EXPECT(history->checkLocal());
326 BEAST_EXPECT(history->isComplete());
327 BEAST_EXPECT(!history->isFailed());
328
329 // The switch the rate check reads is reached only once the ledger has been settled.
330 auto const historyLedger = history->getLedger();
331 BEAST_EXPECT(historyLedger != nullptr);
332 if (historyLedger)
333 BEAST_EXPECT(historyLedger->isImmutable());
334
335 BEAST_EXPECT(env.app().getInboundLedgers().fetchRate() > rateBefore);
336 }
337
338 // The same ledger through checkLocal(), which unlike init() reaches done().
339 auto const again = std::make_shared<InboundLedger>(
340 env.app(),
341 header.hash,
342 header.seq,
344 stopwatch(),
346
347 // True because the acquisition ended, which it reports only after done() has run.
348 BEAST_EXPECT(again->checkLocal());
349 BEAST_EXPECT(again->isComplete());
350 BEAST_EXPECT(!again->isFailed());
351
352 auto const settled = again->getLedger();
353 BEAST_EXPECT(settled != nullptr);
354 if (settled)
355 BEAST_EXPECT(settled->isImmutable());
356
357 // done() records a failure only inside the AcqDone job it queues, and checkLocal() returns
358 // before that job runs. Wait for the job, so the list is read after done() has had its say.
359 env.app().getJobQueue().rendezvous();
360 BEAST_EXPECT(!env.app().getInboundLedgers().isFailure(header.hash));
361 }
362
373 void
375 {
376 testcase("A ledger invalidated on its way to being settled fails");
377
378 // The fabricated chain, so feeding it to the state map invalidates the map.
379 DeepChain const chain{nextSeed()};
380
381 // Only the header is local, so the acquisition holds a ledger with an empty state map.
382 auto const header = makeHeader(chain);
383 storeHeader(env, header);
384
385 auto const acquire = std::make_shared<TestableInboundLedger>(
386 env.app(),
387 header.hash,
388 header.seq,
390 stopwatch(),
392
393 BEAST_EXPECT(!acquire->checkLocal());
394 BEAST_EXPECT(!acquire->isFailed());
395 BEAST_EXPECT(!acquire->isComplete());
396
397 auto const ledger = mutableLedger(*acquire);
398 BEAST_EXPECT(ledger != nullptr);
399 if (!ledger)
400 return;
401
402 // The state of affairs done() is handed: every part fetched, as far as the caller can tell.
403 acquire->markComplete();
404
405 // And the walk that has since reached the verdict.
406 auto& stateMap = ledger->stateMap();
407 BEAST_EXPECT(stateMap.addRootNode(chain.rootHash, chain.nodeAt(0), nullptr).isGood());
408 for (auto const& [nodeID, node] : chain.nodesBelowRoot())
409 stateMap.addKnownNode(nodeID, node, nullptr);
410 BEAST_EXPECT(!stateMap.isValid());
411
412 acquire->signalDone();
413
414 // complete_ is withdrawn alongside the failure, or every guard that checks it before
415 // failed_ keeps treating this ledger as delivered.
416 BEAST_EXPECT(!acquire->isComplete());
417 BEAST_EXPECT(acquire->isFailed());
418
419 // This failure leaves ledger_ set, so only the failed_ guard in getLedger() withholds it.
420 BEAST_EXPECT(acquire->getLedger() == nullptr);
421
422 // getLedgerByHash answers null for the hash, and the hash is remembered as a failure,
423 // which defers re-acquisition.
424 BEAST_EXPECT(env.app().getLedgerMaster().getLedgerByHash(header.hash) == nullptr);
425 BEAST_EXPECT(waitFor([&] { return env.app().getInboundLedgers().isFailure(header.hash); }));
426 }
427
439 void
441 {
442 testcase("An acquisition that fails locally still signals");
443
444 // A zero account hash is a ledger no acquisition can ever finish, and tryDB() says so as
445 // soon as it has the header.
446 auto const header = makeHeader(UInt256{}, UInt256{});
447 storeHeader(env, header);
448
449 BEAST_EXPECT(!env.app().getInboundLedgers().isFailure(header.hash));
450
451 // acquire() is the only caller of init(), and returns nullptr for a failed acquisition.
452 BEAST_EXPECT(
454 header.hash, header.seq, InboundLedger::Reason::GENERIC) == nullptr);
455
456 // The failure reached recentFailures_, which is what stops the next round asking again.
457 BEAST_EXPECT(waitFor([&] { return env.app().getInboundLedgers().isFailure(header.hash); }));
458
459 // The other way tryDB() judges a ledger unobtainable: the header it found is not the one
460 // asked for. A non-zero account hash, so the route above cannot be what fails this one.
461 auto const strayHeader = makeHeader(UInt256{}, UInt256{2});
462 storeHeader(env, strayHeader);
463
464 BEAST_EXPECT(!env.app().getInboundLedgers().isFailure(strayHeader.hash));
465
466 // acquire() hands the sequence to the acquisition unscreened, so one past the stored
467 // header's is enough to make tryDB() reject what it reads.
468 auto const wrongSeq = strayHeader.seq + 1;
469
470 BEAST_EXPECT(
472 strayHeader.hash, wrongSeq, InboundLedger::Reason::GENERIC) == nullptr);
473
474 // tryDB() discards the ledger it built before it gives up, so done() runs here with none
475 // to report. The failure is recorded all the same, which is what the call is for.
476 BEAST_EXPECT(
477 waitFor([&] { return env.app().getInboundLedgers().isFailure(strayHeader.hash); }));
478
479 // The other route into tryDB(): a trigger() on an acquisition that has no header yet. A
480 // hash of its own, so this drives a fresh entry.
481 auto const otherHeader = makeHeader(UInt256{1}, UInt256{});
482 storeHeader(env, otherHeader);
483
484 auto const viaTrigger = std::make_shared<TestableInboundLedger>(
485 env.app(),
486 otherHeader.hash,
487 otherHeader.seq,
489 stopwatch(),
491
492 BEAST_EXPECT(!env.app().getInboundLedgers().isFailure(otherHeader.hash));
493
494 viaTrigger->triggerAdded();
495
496 // Failed before any header state was published: no ledger, and have_header false.
497 BEAST_EXPECT(viaTrigger->isFailed());
498 BEAST_EXPECT(!viaTrigger->isComplete());
499 BEAST_EXPECT(viaTrigger->getLedger() == nullptr);
500 BEAST_EXPECT(!viaTrigger->getJson(0)[jss::have_header].asBool());
501 BEAST_EXPECT(
502 waitFor([&] { return env.app().getInboundLedgers().isFailure(otherHeader.hash); }));
503 }
504
512 void
514 {
515 testcase("A peer header with a zero account hash fails the acquire");
516
517 // A real transaction root and a zero state root. Nothing is stored for this hash, so only a
518 // peer can supply the header.
519 auto const chain = DeepChain::toLeaf(2, nextSeed());
520 auto const header = makeHeader(chain.rootHash.asUInt256(), UInt256{});
521
522 BEAST_EXPECT(!env.app().getInboundLedgers().isFailure(header.hash));
523
524 auto const acquire = startPeerAcquire(env, header);
525 BEAST_EXPECT(!acquire->isFailed());
526 BEAST_EXPECT(!acquire->getJson(0)[jss::have_header].asBool());
527
528 auto const peer = std::make_shared<ChargeRecordingPeer>();
529 BEAST_EXPECT(acquire->gotData(peer, headerPacket(header)));
530 acquire->runData();
531
532 // Failed, not complete, and the header is dropped, as tryDB() leaves one.
533 BEAST_EXPECT(acquire->isFailed());
534 BEAST_EXPECT(!acquire->isComplete());
535 BEAST_EXPECT(acquire->getLedger() == nullptr);
536 BEAST_EXPECT(!acquire->getJson(0)[jss::have_header].asBool());
537
538 // The header is the one asked for, so the sender is not to blame.
539 BEAST_EXPECT(peer->charges().empty());
540
541 // done() ran, so the hash reached recentFailures_, which stops the next round asking again.
542 BEAST_EXPECT(waitFor([&] { return env.app().getInboundLedgers().isFailure(header.hash); }));
543 }
544
552 void
554 {
555 testcase("A peer header with no transactions completes the acquire");
556
557 // No transactions, and a state map that ends in a real leaf, so the acquisition can finish.
558 auto const chain = DeepChain::toLeaf(2, nextSeed());
559 auto const header = makeHeader(chain);
560
561 auto const acquire = startPeerAcquire(env, header);
562
563 auto const peer = std::make_shared<ChargeRecordingPeer>();
564 BEAST_EXPECT(acquire->gotData(peer, headerPacket(header)));
565 acquire->runData();
566
567 // The header is taken, the empty transaction map counts as fetched, and the state map is
568 // what remains.
569 BEAST_EXPECT(!acquire->isFailed());
570 BEAST_EXPECT(!acquire->isComplete());
571 auto const json = acquire->getJson(0);
572 BEAST_EXPECT(json[jss::have_header].asBool());
573 BEAST_EXPECT(json[jss::have_transactions].asBool());
574 BEAST_EXPECT(!json[jss::have_state].asBool());
575
576 // The whole state map as state-node replies, root first, which completes the acquisition.
577 // The second gotData() answers false, since the first already asked for a dispatch.
578 BEAST_EXPECT(acquire->gotData(
579 peer,
580 packetFor(
581 chain,
582 {{SHAMapNodeID{}, chain.nodeAt(0)}},
583 protocol::liAS_NODE,
584 header.hash,
585 header.seq)));
586 BEAST_EXPECT(!acquire->gotData(
587 peer,
588 packetFor(
589 chain, chain.nodesBelowRoot(), protocol::liAS_NODE, header.hash, header.seq)));
590 acquire->runData();
591
592 BEAST_EXPECT(acquire->isComplete());
593 BEAST_EXPECT(!acquire->isFailed());
594 BEAST_EXPECT(peer->charges().empty());
595
596 auto const settled = acquire->getLedger();
597 BEAST_EXPECT(settled != nullptr);
598 if (settled)
599 BEAST_EXPECT(settled->isImmutable());
600
601 BEAST_EXPECT(!env.app().getInboundLedgers().isFailure(header.hash));
602 }
603
621 void
623 {
624 testcase("The retry timer re-asks, then gives up");
625
626 UInt256 const kUnknownLedger{8};
627
628 // One candidate, which onTimer() re-offers on every tick.
629 auto const candidate = std::make_shared<ChargeRecordingPeer>();
630 auto peerSet =
632 auto const* const peerSetPtr = peerSet.get();
633
635 env.app(),
636 kUnknownLedger,
637 0,
639 stopwatch(),
640 std::move(peerSet),
641 kFastRetry);
642
643 BEAST_EXPECT(!env.app().getInboundLedgers().isFailure(kUnknownLedger));
644
645 // init() finds the hash absent from the store, so it asks the candidate and queues the
646 // first tick as a job at once rather than arming the timer. The case counts from here, past
647 // those first requests. The lock keeps the chain from running until the baseline is
648 // recorded. Without it the whole chain (kLedgerTimeoutRetriesMax + 1 ticks, the later ones
649 // at kFastRetry) can finish first, and the count below would have nothing to climb from.
650 int requestsFromInit = 0;
651 {
652 auto const held = acquire->lock();
653 acquire->startAcquire();
654 BEAST_EXPECT(!acquire->isFailed());
655 requestsFromInit = peerSetPtr->requests();
656 }
657 BEAST_EXPECT(requestsFromInit > 0);
658 BEAST_EXPECT(peerSetPtr->addedPeers() == std::set<Peer::ID>{candidate->id()});
659
660 // Every tick asks again, and past kLedgerTimeoutRetriesMax (6) the chain gives up.
661 BEAST_EXPECT(waitFor([&] { return acquire->isFailed(); }));
662 BEAST_EXPECT(!acquire->isComplete());
663 BEAST_EXPECT(peerSetPtr->requests() > requestsFromInit);
664
665 // done() remembered the hash, which is what stops the next round asking again.
666 BEAST_EXPECT(
667 waitFor([&] { return env.app().getInboundLedgers().isFailure(kUnknownLedger); }));
668 }
669
670 void
671 run() override
672 {
673 // One Env for the suite, since building one costs far more than any case here. Safe
674 // because every chain is seeded through nextSeed(): the node store, the fetch packs and
675 // the remembered failures are all shared, and all three are keyed by hash.
676 jtx::Env env{*this};
677
683
684 // Last: the only case that waits out a whole timeout chain.
686 }
687
688private:
689 unsigned int seed_{0};
690};
691
693
694} // namespace xrpl::test
A testsuite class.
Definition suite.h:52
TestcaseT testcase
Memberspace for declaring test cases.
Definition suite.h:155
pointer data()
Definition base_uint.h:117
static constexpr std::size_t size()
Definition base_uint.h:549
virtual node_store::Database & db()=0
InboundLedger(Application &app, UInt256 const &hash, std::uint32_t seq, Reason reason, ClockType &clock, std::unique_ptr< PeerSet > peerSet, std::chrono::milliseconds retryInterval=kRetryInterval)
void trigger(std::shared_ptr< Peer > const &peer, TriggerReason reason)
Ask for more nodes, or judge what has been collected.
void init(ScopedLockType &collectionLock)
void done()
Settle the acquisition and signal whatever is waiting on it.
std::shared_ptr< Ledger const > getLedger() const
The acquired ledger.
virtual std::size_t fetchRate()=0
Returns the rate of historical ledger fetches per minute.
virtual std::shared_ptr< Ledger const > acquire(UInt256 const &hash, std::uint32_t seq, InboundLedger::Reason)=0
virtual bool isFailure(UInt256 const &h)=0
void rendezvous()
Block until no jobs running.
Definition JobQueue.cpp:243
std::shared_ptr< Ledger const > getLedgerByHash(UInt256 const &hash)
std::chrono::time_point< NetClock > time_point
Definition chrono.h:48
std::chrono::duration< rep, period > duration
Definition chrono.h:47
UInt256 const & asUInt256() const
Definition SHAMapHash.h:26
Identifies a node inside a SHAMap.
Blob const & peekData() const
Definition Serializer.h:273
virtual JobQueue & getJobQueue()=0
virtual InboundLedgers & getInboundLedgers()=0
virtual LedgerMaster & getLedgerMaster()=0
virtual Family & getNodeFamily()=0
std::recursive_mutex mtx_
std::unique_lock< std::recursive_mutex > ScopedLockType
virtual void store(NodeObjectType type, Blob &&data, UInt256 const &hash, std::uint32_t ledgerSeq)=0
Store the object.
A transaction testing environment.
Definition Env.h:161
Application & app()
Definition Env.h:300
T data(T... args)
T make_shared(T... args)
T make_unique(T... args)
JSON (JavaScript Object Notation).
Definition json_errors.h:5
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
static std::shared_ptr< Ledger > mutableLedger(InboundLedger const &acquire)
The ledger an acquisition is assembling, as a pointer that can modify it.
bool waitFor(std::function< bool()> const &condition, std::chrono::steady_clock::duration deadline=std::chrono::seconds{10})
Poll until the condition holds, or give up.
std::shared_ptr< protocol::TMLedgerData > packetFor(DeepChain const &chain, std::vector< std::pair< SHAMapNodeID, SHAMapTreeNodePtr > > const &data, protocol::TMLedgerInfoType type=protocol::liTS_CANDIDATE, std::optional< UInt256 > const &ledgerHash=std::nullopt, std::uint32_t ledgerSeq=0)
The given nodes of a chain as a TMLedgerData, so a test can go through the real dispatch.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
Stopwatch & stopwatch()
Returns an instance of a wall clock.
Definition chrono.h:101
BaseUInt< 256 > UInt256
Definition base_uint.h:581
void addRaw(LedgerHeader const &, Serializer &, bool includeHash=false)
@ LedgerMaster
ledger master data for signing
Definition HashPrefix.h:59
UInt256 calculateLedgerHash(LedgerHeader const &info)
Calculate the hash of a ledger header.
T const_pointer_cast(T... args)
T size(T... args)
Information about the notional ledger backing the view.
NetClock::time_point parentCloseTime
NetClock::duration closeTimeResolution
NetClock::time_point closeTime
static DeepChain toLeaf(unsigned int depth, unsigned int seed=1)
A chain ending in a real transaction leaf, which completes an acquisition.
Definition DeepChain.h:95
void testInvalidatedLedgerFailsInDone(jtx::Env &env)
A ledger whose map goes invalid on the way to being settled must be discarded rather than delivered.
static void storeStateNodes(jtx::Env &env, LedgerHeader const &header, DeepChain const &chain, unsigned int maxDepth)
Put every node of a chain in the local store, so a state-map walk resolves the whole map from the sto...
void testLocalFailureSignalsDone(jtx::Env &env)
An acquisition that fails on local data must still signal.
void testPeerZeroAccountHashFails(jtx::Env &env)
A peer-supplied header whose account hash is zero fails the acquisition and signals,...
static std::shared_ptr< TestableInboundLedger > startPeerAcquire(jtx::Env &env, LedgerHeader const &header)
An acquisition started with nothing in the store for its hash, so it waits on its peers.
void testLocalLedgerCompletesAcquire(jtx::Env &env)
A ledger whose maps all resolve locally finishes on the spot, and the finished ledger is immutable an...
void testPeerHeaderWithoutTransactionsCompletes(jtx::Env &env)
A peer-supplied header with a zero transaction hash is taken, since that is an empty transaction set,...
static constexpr auto kFastRetry
A retry interval short enough that a whole timeout chain costs a fraction of a second.
void testTimerRetriesThenGivesUp(jtx::Env &env)
The retry timer re-asks, then gives up and signals.
unsigned int nextSeed()
A seed unique to this chain within the suite.
static std::shared_ptr< protocol::TMLedgerData > headerPacket(LedgerHeader const &header)
The header alone as a liBASE reply, so takeHeader() alone judges the packet.
static LedgerHeader makeHeader(DeepChain const &chain)
The common shape: no transactions, so only the state map is in play.
static LedgerHeader makeHeader(UInt256 const &txHash, UInt256 const &accountHash)
A ledger header naming the given map roots, with a hash derived from the fields, so an acquisition ac...
static void storeHeader(jtx::Env &env, LedgerHeader const &header)
Put the header in the local store, which is the first place tryDB() looks.
void run() override
Runs the suite.
An acquisition that exposes the entry points its bases keep protected, so a case can reach them throu...
InboundLedger(Application &app, UInt256 const &hash, std::uint32_t seq, Reason reason, ClockType &clock, std::unique_ptr< PeerSet > peerSet, std::chrono::milliseconds retryInterval=kRetryInterval)
void markComplete()
Record that every part has been fetched.
void triggerAdded()
Ask for more nodes, or judge what has been collected, as a fresh acquisition does.
void startAcquire()
Look for the ledger locally, ask the peers being tracked for the rest, and arm the timer,...
void signalDone()
Settle the acquisition and signal whatever is waiting on it.
ScopedLockType lock() const
Hold the acquisition's own lock.
A chain of inner nodes in wire form, from the root down to one deepest node, each with one real child...
Definition DeepChain.h:38
Blob prefixedNodeAt(unsigned int depth) const
The same node in the prefixed form used for storage and fetch packs, which is what hashes to the node...
Definition DeepChain.h:135
std::vector< std::pair< SHAMapNodeID, SHAMapTreeNodePtr > > nodesBelowRoot(unsigned int firstDepth=1) const
Every node below the root, down to and including the deepest one.
Definition DeepChain.h:150
SHAMapTreeNodePtr nodeAt(unsigned int depth) const
The node the chain holds at the given depth, root first.
Definition DeepChain.h:109