Enumerate through variants

This commit is contained in:
pscott
2021-04-15 16:13:42 +02:00
parent 9e6610c56a
commit 9876999b8d
2 changed files with 8 additions and 7 deletions

View File

@@ -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;

View File

@@ -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 {