diff --git a/src/ripple/app/tx/impl/SetOracle.cpp b/src/ripple/app/tx/impl/SetOracle.cpp index a2fcdd53a46..469de1c13de 100644 --- a/src/ripple/app/tx/impl/SetOracle.cpp +++ b/src/ripple/app/tx/impl/SetOracle.cpp @@ -78,7 +78,7 @@ SetOracle::preclaim(PreclaimContext const& ctx) if (!entry.isFieldPresent(sfSymbolPrice)) return temMALFORMED; auto const hash = tokenPairHash(entry); - if (pairs.contains(tokenPairHash(entry))) + if (pairs.contains(hash)) return tecDUPLICATE; pairs.emplace(hash); } @@ -114,15 +114,13 @@ SetOracle::preclaim(PreclaimContext const& ctx) if (pairs.size() > maxOracleDataSeries) return temARRAY_SIZE; + auto const add = pairs.size() <= 5 ? 1 : 2; auto const reserve = ctx.view.fees().accountReserve( - sleSetter->getFieldU32(sfOwnerCount) + pairs.size() <= 5 ? 1 : 2); + sleSetter->getFieldU32(sfOwnerCount) + add); auto const& balance = sleSetter->getFieldAmount(sfBalance); if (balance < reserve) - { - JLOG(ctx.j.debug()) << "Oracle Set: insufficient reserve"; return tecINSUFFICIENT_RESERVE; - } return tesSUCCESS; } @@ -181,7 +179,7 @@ applySet( } } STArray updatedSeries; - for (auto iter : pairs) + for (auto const& iter : pairs) updatedSeries.push_back(std::move(iter.second)); sle->setFieldArray(sfPriceDataSeries, updatedSeries); if (ctx_.tx.isFieldPresent(sfURI))