From 25589bacea9708e84eb889854b61420ee89c271b Mon Sep 17 00:00:00 2001 From: David Schwartz Date: Tue, 16 Feb 2016 10:05:57 -0800 Subject: [PATCH] Ensure fee change transactions have a unique transaction ID Include the ledger sequence number in fee change transactions to ensure each such transaction has a unique transaction ID. We tolerate the absence of a ledger sequence in fee change transactions so that past fee change transactions remain parseable. Since no live amendment transactions have yet happened, there is no need to tolerate an absent ledger sequence there. --- src/ripple/app/misc/FeeVoteImpl.cpp | 4 +++- src/ripple/protocol/impl/TxFormats.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ripple/app/misc/FeeVoteImpl.cpp b/src/ripple/app/misc/FeeVoteImpl.cpp index 49a6caaf7..6669eea2a 100644 --- a/src/ripple/app/misc/FeeVoteImpl.cpp +++ b/src/ripple/app/misc/FeeVoteImpl.cpp @@ -202,6 +202,7 @@ FeeVoteImpl::doVoting (Ledger::ref lastClosedLedger, std::uint32_t const baseReserve = baseReserveVote.getVotes (); std::uint32_t const incReserve = incReserveVote.getVotes (); std::uint32_t const feeUnits = target_.reference_fee_units; + auto const seq = lastClosedLedger->info().seq + 1; // add transactions to our position if ((baseFee != lastClosedLedger->fees().base) || @@ -214,9 +215,10 @@ FeeVoteImpl::doVoting (Ledger::ref lastClosedLedger, "/" << incReserve; STTx feeTx (ttFEE, - [baseFee,baseReserve,incReserve,feeUnits](auto& obj) + [seq,baseFee,baseReserve,incReserve,feeUnits](auto& obj) { obj[sfAccount] = AccountID(); + obj[sfLedgerSequence] = seq; obj[sfBaseFee] = baseFee; obj[sfReserveBase] = baseReserve; obj[sfReserveIncrement] = incReserve; diff --git a/src/ripple/protocol/impl/TxFormats.cpp b/src/ripple/protocol/impl/TxFormats.cpp index 6ca6a66f4..85e213b83 100644 --- a/src/ripple/protocol/impl/TxFormats.cpp +++ b/src/ripple/protocol/impl/TxFormats.cpp @@ -86,7 +86,7 @@ TxFormats::TxFormats () SOElement (sfOfferSequence, SOE_REQUIRED); add ("EnableAmendment", ttAMENDMENT) - << SOElement (sfLedgerSequence, SOE_OPTIONAL) + << SOElement (sfLedgerSequence, SOE_REQUIRED) << SOElement (sfAmendment, SOE_REQUIRED) ;