allow nops to be specified in emitted txns

This commit is contained in:
Richard Holland
2023-03-23 12:05:44 +00:00
parent d4b54c20ed
commit 24384be242
2 changed files with 27 additions and 0 deletions

View File

@@ -58,11 +58,24 @@ STArray::STArray(std::vector<STObject> 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<std::runtime_error>("Too many NOPS");
}
continue;
}
if ((type == STI_ARRAY) && (field == 1))
break;

View File

@@ -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<std::runtime_error>("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)