本文整理汇总了C++中ledger::ref::getBaseFee方法的典型用法代码示例。如果您正苦于以下问题:C++ ref::getBaseFee方法的具体用法?C++ ref::getBaseFee怎么用?C++ ref::getBaseFee使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ledger::ref
的用法示例。
在下文中一共展示了ref::getBaseFee方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
FeeVoteImpl::doValidation (Ledger::ref lastClosedLedger,
STObject& baseValidation)
{
if (lastClosedLedger->getBaseFee () != target_.reference_fee)
{
if (journal_.info) journal_.info <<
"Voting for base fee of " << target_.reference_fee;
baseValidation.setFieldU64 (sfBaseFee, target_.reference_fee);
}
if (lastClosedLedger->getReserve (0) != target_.account_reserve)
{
if (journal_.info) journal_.info <<
"Voting for base resrve of " << target_.account_reserve;
baseValidation.setFieldU32(sfReserveBase, target_.account_reserve);
}
if (lastClosedLedger->getReserveInc () != target_.owner_reserve)
{
if (journal_.info) journal_.info <<
"Voting for reserve increment of " << target_.owner_reserve;
baseValidation.setFieldU32 (sfReserveIncrement,
target_.owner_reserve);
}
}
示例2: trans
void
FeeVoteImpl::doVoting (Ledger::ref lastClosedLedger,
std::shared_ptr<SHAMap> const& initialPosition)
{
// LCL must be flag ledger
assert ((lastClosedLedger->getLedgerSeq () % 256) == 0);
detail::VotableInteger<std::uint64_t> baseFeeVote (
lastClosedLedger->getBaseFee (), target_.reference_fee);
detail::VotableInteger<std::uint32_t> baseReserveVote (
lastClosedLedger->getReserve (0), target_.account_reserve);
detail::VotableInteger<std::uint32_t> incReserveVote (
lastClosedLedger->getReserveInc (), target_.owner_reserve);
// get validations for ledger before flag
ValidationSet const set =
getApp().getValidations ().getValidations (
lastClosedLedger->getParentHash ());
for (auto const& e : set)
{
STValidation const& val = *e.second;
if (val.isTrusted ())
{
if (val.isFieldPresent (sfBaseFee))
{
baseFeeVote.addVote (val.getFieldU64 (sfBaseFee));
}
else
{
baseFeeVote.noVote ();
}
if (val.isFieldPresent (sfReserveBase))
{
baseReserveVote.addVote (val.getFieldU32 (sfReserveBase));
}
else
{
baseReserveVote.noVote ();
}
if (val.isFieldPresent (sfReserveIncrement))
{
incReserveVote.addVote (val.getFieldU32 (sfReserveIncrement));
}
else
{
incReserveVote.noVote ();
}
}
}
// choose our positions
std::uint64_t const baseFee = baseFeeVote.getVotes ();
std::uint32_t const baseReserve = baseReserveVote.getVotes ();
std::uint32_t const incReserve = incReserveVote.getVotes ();
// add transactions to our position
if ((baseFee != lastClosedLedger->getBaseFee ()) ||
(baseReserve != lastClosedLedger->getReserve (0)) ||
(incReserve != lastClosedLedger->getReserveInc ()))
{
if (journal_.warning) journal_.warning <<
"We are voting for a fee change: " << baseFee <<
"/" << baseReserve <<
"/" << incReserve;
STTx trans (ttFEE);
trans.setFieldAccount (sfAccount, AccountID ());
trans.setFieldU64 (sfBaseFee, baseFee);
trans.setFieldU32 (sfReferenceFeeUnits, 10);
trans.setFieldU32 (sfReserveBase, baseReserve);
trans.setFieldU32 (sfReserveIncrement, incReserve);
uint256 txID = trans.getTransactionID ();
if (journal_.warning)
journal_.warning << "Vote: " << txID;
Serializer s;
trans.add (s);
auto tItem = std::make_shared<SHAMapItem> (txID, s.peekData ());
if (!initialPosition->addGiveItem (tItem, true, false))
{
if (journal_.warning) journal_.warning <<
"Ledger already had fee change";
}
}
}