Skip to content

Commit

Permalink
fixup! [FOLD] Review feedback from Nik:
Browse files Browse the repository at this point in the history
* Structured binding declared variables can't be passed to a lambda
  capture list in clang 14 (and maybe others). Noted in the code.
  • Loading branch information
ximinez committed Oct 17, 2022
1 parent 8607bd5 commit 71ca946
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/ripple/app/misc/FeeVoteImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,37 +277,42 @@ FeeVoteImpl::doVoting(
}

// choose our positions
auto const [baseFee, baseFeeChanged] = baseFeeVote.getVotes();
auto const [baseReserve, baseReserveChanged] = baseReserveVote.getVotes();
auto const [incReserve, incReserveChanged] = incReserveVote.getVotes();
// TODO: Use structured binding once LLVM issue
// https://github.com/llvm/llvm-project/issues/48582
// is fixed.
auto const baseFee = baseFeeVote.getVotes();
auto const baseReserve = baseReserveVote.getVotes();
auto const incReserve = incReserveVote.getVotes();

auto const seq = lastClosedLedger->info().seq + 1;

// add transactions to our position
if (baseFeeChanged || baseReserveChanged || incReserveChanged)
if (baseFee.second || baseReserve.second || incReserve.second)
{
JLOG(journal_.warn()) << "We are voting for a fee change: " << baseFee
<< "/" << baseReserve << "/" << incReserve;
JLOG(journal_.warn())
<< "We are voting for a fee change: " << baseFee.first << "/"
<< baseReserve.first << "/" << incReserve.first;

STTx feeTx(ttFEE, [&](auto& obj) {
STTx feeTx(ttFEE, [=, &rules](auto& obj) {
obj[sfAccount] = AccountID();
obj[sfLedgerSequence] = seq;
if (rules.enabled(featureXRPFees))
{
obj[sfBaseFeeDrops] = baseFee;
obj[sfReserveBaseDrops] = baseReserve;
obj[sfReserveIncrementDrops] = incReserve;
obj[sfBaseFeeDrops] = baseFee.first;
obj[sfReserveBaseDrops] = baseReserve.first;
obj[sfReserveIncrementDrops] = incReserve.first;
}
else
{
// Without the featureXRPFees amendment, these fields are
// required.
obj[sfBaseFee] =
baseFee.dropsAs<std::uint64_t>(baseFeeVote.current());
obj[sfReserveBase] = baseReserve.dropsAs<std::uint32_t>(
baseFee.first.dropsAs<std::uint64_t>(baseFeeVote.current());
obj[sfReserveBase] = baseReserve.first.dropsAs<std::uint32_t>(
baseReserveVote.current());
obj[sfReserveIncrement] =
incReserve.dropsAs<std::uint32_t>(incReserveVote.current());
incReserve.first.dropsAs<std::uint32_t>(
incReserveVote.current());
obj[sfReferenceFeeUnits] = Config::FEE_UNITS_DEPRECATED;
}
});
Expand Down

0 comments on commit 71ca946

Please sign in to comment.