From 24384be242b4fb4ac768aeebca0f0d642d66beae Mon Sep 17 00:00:00 2001 From: Richard Holland Date: Thu, 23 Mar 2023 12:05:44 +0000 Subject: [PATCH] allow nops to be specified in emitted txns --- src/ripple/protocol/impl/STArray.cpp | 13 +++++++++++++ src/ripple/protocol/impl/STObject.cpp | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/ripple/protocol/impl/STArray.cpp b/src/ripple/protocol/impl/STArray.cpp index ae9c0410d..0410a13d6 100644 --- a/src/ripple/protocol/impl/STArray.cpp +++ b/src/ripple/protocol/impl/STArray.cpp @@ -58,11 +58,24 @@ STArray::STArray(std::vector const& v, SField const& f) : STBase(f) STArray::STArray(SerialIter& sit, SField const& f, int depth) : STBase(f) { + uint8_t nop_counter = 0; while (!sit.empty()) { int type, field; sit.getFieldID(type, field); + // pass nops + if (type == 9 && field == 9) + { + if (++nop_counter == 64) + { + JLOG(debugLog().error()) + << "Too many NOPS"; + Throw("Too many NOPS"); + } + continue; + } + if ((type == STI_ARRAY) && (field == 1)) break; diff --git a/src/ripple/protocol/impl/STObject.cpp b/src/ripple/protocol/impl/STObject.cpp index a64fe14b9..5c88ef87d 100644 --- a/src/ripple/protocol/impl/STObject.cpp +++ b/src/ripple/protocol/impl/STObject.cpp @@ -183,6 +183,8 @@ STObject::set(SerialIter& sit, int depth) v_.clear(); + uint8_t nop_counter = 0; + // Consume data in the pipe until we run out or reach the end while (!sit.empty()) { @@ -192,6 +194,18 @@ STObject::set(SerialIter& sit, int depth) // Get the metadata for the next field sit.getFieldID(type, field); + // pass nops + if (type == 9 && field == 9) + { + if (++nop_counter == 64) + { + JLOG(debugLog().error()) + << "Too many NOPS"; + Throw("Too many NOPS"); + } + continue; + } + // The object termination marker has been found and the termination // marker has been consumed. Done deserializing. if (type == STI_OBJECT && field == 1)