mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 19:15:54 +00:00
Put OfferCreate bug fix on a ledger switch:
The fix for an off-by one bug that overstates the account reserve during OfferCreate is set to become active on August 3rd. Before this date, the program will exhibit the old behavior.
This commit is contained in:
@@ -421,6 +421,13 @@ CreateOffer::format_amount (STAmount const& amount)
|
|||||||
STAmount
|
STAmount
|
||||||
CreateOffer::getAccountReserve (SLE::pointer account)
|
CreateOffer::getAccountReserve (SLE::pointer account)
|
||||||
{
|
{
|
||||||
|
// Mon Aug 3 11:00:00am PDT
|
||||||
|
static NetClock::time_point const switchoverTime (
|
||||||
|
std::chrono::seconds (491940000));
|
||||||
|
if (ctx_.view().info().parentCloseTime <=
|
||||||
|
switchoverTime.time_since_epoch().count())
|
||||||
|
return STAmount (ctx_.view().fees().accountReserve(
|
||||||
|
deprecatedWrongOwnerCount_+1));
|
||||||
return STAmount (ctx_.view().fees().accountReserve(
|
return STAmount (ctx_.view().fees().accountReserve(
|
||||||
account->getFieldU32 (sfOwnerCount) + 1));
|
account->getFieldU32 (sfOwnerCount) + 1));
|
||||||
}
|
}
|
||||||
@@ -559,6 +566,8 @@ CreateOffer::applyGuts (ApplyView& view, ApplyView& view_cancel)
|
|||||||
auto const sleCreator = view.peek (
|
auto const sleCreator = view.peek (
|
||||||
keylet::account(account_));
|
keylet::account(account_));
|
||||||
|
|
||||||
|
deprecatedWrongOwnerCount_ = sleCreator->getFieldU32(sfOwnerCount);
|
||||||
|
|
||||||
std::uint32_t const uAccountSequenceNext = sleCreator->getFieldU32 (sfSequence);
|
std::uint32_t const uAccountSequenceNext = sleCreator->getFieldU32 (sfSequence);
|
||||||
std::uint32_t const uSequence = mTxn.getSequence ();
|
std::uint32_t const uSequence = mTxn.getSequence ();
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
// What kind of offer we are placing
|
// What kind of offer we are placing
|
||||||
CrossType cross_type_;
|
CrossType cross_type_;
|
||||||
|
std::uint32_t deprecatedWrongOwnerCount_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#define RIPPLE_LEDGER_READVIEW_H_INCLUDED
|
#define RIPPLE_LEDGER_READVIEW_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/ledger/detail/ReadViewFwdRange.h>
|
#include <ripple/ledger/detail/ReadViewFwdRange.h>
|
||||||
|
#include <ripple/basics/chrono.h>
|
||||||
#include <ripple/protocol/Indexes.h>
|
#include <ripple/protocol/Indexes.h>
|
||||||
#include <ripple/protocol/Protocol.h>
|
#include <ripple/protocol/Protocol.h>
|
||||||
#include <ripple/protocol/STLedgerEntry.h>
|
#include <ripple/protocol/STLedgerEntry.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user