void closeLedger(vector<Simulation::TxInfo> txs)
    {
        auto baseFee = mApp->getConfig().DESIRED_BASE_FEE;
        TxSetFramePtr txSet = make_shared<TxSetFrame>(mApp->getLedgerManager().getLastClosedLedgerHeader().hash);
        for (auto& tx : txs)
        {
            txSet->add(tx.createPaymentTx());
            tx.recordExecution(baseFee);
        }

        LedgerCloseData ledgerData(mApp->getLedgerManager().getLedgerNum(),
            txSet,
            VirtualClock::to_time_t(mApp->getClock().now()),
            baseFee);

        mApp->getLedgerManager().closeLedger(ledgerData);
    }
Beispiel #2
0
void
Peer::recvGetTxSet(StellarMessage const& msg)
{
    TxSetFramePtr txSet = mApp.getHerder().fetchTxSet(msg.txSetHash(), false);
    if (txSet)
    {
        StellarMessage newMsg;
        newMsg.type(TX_SET);
        txSet->toXDR(newMsg.txSet());

        sendMessage(newMsg);
    }
    else
    {
        sendDontHave(TX_SET, msg.txSetHash());
    }
}
static void
closeLedgerOn(Application& app, uint32 ledgerSeq, int day, int month, int year,
              TransactionFramePtr tx = nullptr)
{
    TxSetFramePtr txSet = std::make_shared<TxSetFrame>(
        app.getLedgerManager().getLastClosedLedgerHeader().hash);
    if (tx)
    {
        txSet->add(tx);
        txSet->sortForHash();
    }

    LedgerCloseData ledgerData(ledgerSeq, txSet, getTestDate(day, month, year),
                               10);
    app.getLedgerManager().closeLedger(ledgerData);

    REQUIRE(app.getLedgerManager().getLedgerNum() == (ledgerSeq + 1));
}
    void
    closeLedger(vector<Simulation::TxInfo> txs)
    {
        auto baseFee = mApp->getConfig().DESIRED_BASE_FEE;
        LoadGenerator::TxMetrics txm(mApp->getMetrics());
        TxSetFramePtr txSet = make_shared<TxSetFrame>(
            mApp->getLedgerManager().getLastClosedLedgerHeader().hash);
        for (auto& tx : txs)
        {
            std::vector<TransactionFramePtr> txfs;
            tx.toTransactionFrames(*mApp, txfs, txm);
            for (auto f : txfs)
                txSet->add(f);
            tx.recordExecution(baseFee);
        }

        StellarValue sv(txSet->getContentsHash(),
                        VirtualClock::to_time_t(mApp->getClock().now()),
                        emptyUpgradeSteps, 0);
        LedgerCloseData ledgerData(mApp->getLedgerManager().getLedgerNum(),
                                   txSet, sv);

        mApp->getLedgerManager().closeLedger(ledgerData);
    }