From 9876999b8d49174c08e086093c6e8a3800f45766 Mon Sep 17 00:00:00 2001 From: pscott Date: Thu, 15 Apr 2021 16:13:42 +0200 Subject: [PATCH] Enumerate through variants --- src_common/ethUstream.c | 12 ++++++++---- src_common/ethUstream.h | 3 --- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src_common/ethUstream.c b/src_common/ethUstream.c index 023dc45..517691e 100644 --- a/src_common/ethUstream.c +++ b/src_common/ethUstream.c @@ -265,13 +265,17 @@ static parserStatus_e processTxInternal(txContext_t *context) { } // EIP 2718: TransactionType might be present before the TransactionPayload. if (*context->workBuffer > 0x00 && *context->workBuffer < 0x7f) { - PRINTF("TX TYPE: %u\n", *context->workBuffer); - if (*context->workBuffer <= MIN_TX_TYPE || *context->workBuffer >= MAX_TX_TYPE) { + uint8_t maybeType = *context->workBuffer; + PRINTF("TX TYPE: %u\n", maybeType); + + // Enumerate through all supported txTypes here... + if (maybeType == LEGACY_TX) { + context->txType = *context->workBuffer; + context->workBuffer++; + } else { PRINTF("Transaction type not supported\n"); return USTREAM_FAULT; } - context->txType = *context->workBuffer; - context->workBuffer++; } if (!context->processingField) { bool canDecode = false; diff --git a/src_common/ethUstream.h b/src_common/ethUstream.h index cd30835..1b9bf2e 100644 --- a/src_common/ethUstream.h +++ b/src_common/ethUstream.h @@ -55,10 +55,7 @@ typedef enum rlpTxField_e { // EIP 2718 TransactionType typedef enum txType_e { - MIN_TX_TYPE, LEGACY_TX, - BERLIN_TX, - MAX_TX_TYPE, } txType_e; typedef enum parserStatus_e {