Add MAX and MIN tx types

This commit is contained in:
pscott
2021-04-15 15:36:21 +02:00
parent 48562ccfc7
commit 3faa172ec2
2 changed files with 9 additions and 3 deletions

View File

@@ -265,9 +265,13 @@ 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->txType);
if (*context->workBuffer < MIN_TX_TYPE || *context->workBuffer > MAX_TX_TYPE ) {
PRINTF("Transaction type not supported\n");
return USTREAM_FAULT;
}
context->txType = *context->workBuffer;
context->workBuffer++;
PRINTF("TX TYPE: %u\n", context->txType);
}
if (!context->processingField) {
PRINTF("PROCESSING FIELD\n");

View File

@@ -55,8 +55,10 @@ typedef enum rlpTxField_e {
// EIP 2718 TransactionType
typedef enum txType_e {
LegacyTransaction = 1,
BerlinTransaction = 2
MIN_TX_TYPE,
LEGACY_TX,
BERLIN_TX,
MAX_TX_TYPE,
} txType_e;
typedef enum parserStatus_e {