remove unused offers code

This commit is contained in:
CJ Cobb
2021-08-06 12:32:06 -04:00
parent 56e81eb1d8
commit ea5f9162b7
11 changed files with 16 additions and 83 deletions

View File

@@ -39,20 +39,15 @@ void
BackendInterface::writeLedgerObject(
std::string&& key,
uint32_t seq,
std::string&& blob,
bool isCreated,
bool isDeleted,
std::optional<ripple::uint256>&& book) const
std::string&& blob) const
{
assert(key.size() == sizeof(rippled::uint256));
ripple::uint256 key256 = ripple::uint256::fromVoid(key.data());
indexer_.addKey(std::move(key256));
doWriteLedgerObject(
std::move(key),
seq,
std::move(blob),
isCreated,
isDeleted,
std::move(book));
std::move(blob));
}
std::optional<LedgerRange>
BackendInterface::hardFetchLedgerRangeNoThrow() const

View File

@@ -204,10 +204,7 @@ protected:
writeLedgerObject(
std::string&& key,
uint32_t seq,
std::string&& blob,
bool isCreated,
bool isDeleted,
std::optional<ripple::uint256>&& book) const;
std::string&& blob) const;
virtual void
writeTransaction(
@@ -263,10 +260,7 @@ private:
doWriteLedgerObject(
std::string&& key,
uint32_t seq,
std::string&& blob,
bool isCreated,
bool isDeleted,
std::optional<ripple::uint256>&& book) const = 0;
std::string&& blob) const = 0;
virtual bool
doFinishWrites() const = 0;

View File

@@ -148,10 +148,7 @@ void
CassandraBackend::doWriteLedgerObject(
std::string&& key,
uint32_t seq,
std::string&& blob,
bool isCreated,
bool isDeleted,
std::optional<ripple::uint256>&& book) const
std::string&& blob) const
{
BOOST_LOG_TRIVIAL(trace) << "Writing ledger object to cassandra";
makeAndExecuteAsyncWrite(

View File

@@ -833,10 +833,7 @@ public:
doWriteLedgerObject(
std::string&& key,
uint32_t seq,
std::string&& blob,
bool isCreated,
bool isDeleted,
std::optional<ripple::uint256>&& book) const override;
std::string&& blob) const override;
void
writeAccountTransactions(

View File

@@ -60,10 +60,7 @@ void
PostgresBackend::doWriteLedgerObject(
std::string&& key,
uint32_t seq,
std::string&& blob,
bool isCreated,
bool isDeleted,
std::optional<ripple::uint256>&& book) const
std::string&& blob) const
{
if (abortWrite_)
return;

View File

@@ -79,10 +79,7 @@ public:
doWriteLedgerObject(
std::string&& key,
uint32_t seq,
std::string&& blob,
bool isCreated,
bool isDeleted,
std::optional<ripple::uint256>&& book) const override;
std::string&& blob) const override;
void
writeTransaction(

View File

@@ -435,22 +435,10 @@ public:
BOOST_LOG_TRIVIAL(trace) << "Writing objects";
for (auto& obj : *(cur_->mutable_ledger_objects()->mutable_objects()))
{
std::optional<ripple::uint256> book = {};
short offer_bytes = (obj.data()[1] << 8) | obj.data()[2];
if (offer_bytes == 0x006f)
{
ripple::SerialIter it{obj.data().data(), obj.data().size()};
ripple::SLE sle{it, {}};
book = sle.getFieldH256(ripple::sfBookDirectory);
}
backend.writeLedgerObject(
std::move(*obj.mutable_key()),
request_.ledger().sequence(),
std::move(*obj.mutable_data()),
true,
false,
std::move(book));
std::move(*obj.mutable_data()));
}
BOOST_LOG_TRIVIAL(trace) << "Wrote objects";

View File

@@ -294,34 +294,11 @@ ReportingETL::buildNextLedger(org::xrpl::rpc::v1::GetLedgerResponse& rawData)
for (auto& obj : *(rawData.mutable_ledger_objects()->mutable_objects()))
{
bool isCreated = false;
bool isDeleted = false;
if (obj.mod_type() == org::xrpl::rpc::v1::RawLedgerObject::CREATED)
isCreated = true;
else if (
obj.mod_type() == org ::xrpl::rpc::v1::RawLedgerObject::DELETED)
isDeleted = true;
std::optional<ripple::uint256> bookDir;
if (isCreated)
{
if (isOffer(obj.data()))
bookDir = getBook(obj.data());
}
else if (obj.book_of_deleted_offer().size())
{
bookDir =
ripple::uint256::fromVoid(obj.book_of_deleted_offer().data());
}
assert(not(isCreated and isDeleted));
backend_->writeLedgerObject(
std::move(*obj.mutable_key()),
lgrInfo.seq,
std::move(*obj.mutable_data()),
isCreated,
isDeleted,
std::move(bookDir));
std::move(*obj.mutable_data()));
}
BOOST_LOG_TRIVIAL(debug)
<< __func__ << " : "

View File

@@ -97,7 +97,7 @@ doLedger(Context const& context)
entry["tx_blob"] = ripple::strHex(obj.transaction);
entry["meta"] = ripple::strHex(obj.metadata);
}
entry["ledger_index"] = obj.ledgerSequence;
//entry["ledger_index"] = obj.ledgerSequence;
return entry;
});
}