0

我有一个STTx和一个Ledger。我怎样才能得到一个新Ledger的交易应用(或者甚至只是一个ReadView最新的交易.info().accountHash)?

4

1 回答 1

0
# include <ripple/app/ledger/BuildLedger.h>
# include <ripple/app/misc/CanonicalTXSet.h>
# include <ripple/consensus/LedgerTiming.h> // ledgerDefaultTimeResolution

// Start with what you have.
Application const& app = ...
beast::Journal journal = ...
std::shared_ptr<Ledger const> const& parent = ...
std::shared_ptr<STTx const> const& transaction = ...

// Massage them into parameters for buildLedger.
NetClock::time_point const closeTime = app.timeKeeper().closeTime();
bool const closeTimeCorrect = false;
NetClock::duration closeTimeResolution = ledgerDefaultTimeResolution;
CanonicalTXSet const transactions{parent->info().hash};
transactions.insert(transaction);
std::set<TXID> failedTransactions; // Leave empty.

std::shared_ptr<Ledger> child = buildLedger(
    parent,
    closeTime,
    closeTimeCorrect ,
    closeTimeResolution,
    app,
    transactions,
    failedTransactions,
    journal);
于 2020-03-13T19:48:07.983 回答