diff --git a/src_common/ethUstream.c b/src_common/ethUstream.c index 9ddf672..a97a418 100644 --- a/src_common/ethUstream.c +++ b/src_common/ethUstream.c @@ -263,7 +263,14 @@ static parserStatus_e processTxInternal(txContext_t *context) { if (context->commandLength == 0) { return USTREAM_PROCESSING; } + // EIP 2718: TransactionType might be present before the TransactionPayload. + if (*context->workBuffer > 0x00 && *context->workBuffer < 0x7f) { + context->txType = *context->workBuffer; + context->workBuffer++; + PRINTF("TX TYPE: %u\n", context->txType); + } if (!context->processingField) { + PRINTF("PROCESSING FIELD\n"); bool canDecode = false; uint32_t offset; while (context->commandLength != 0) { diff --git a/src_common/ethUstream.h b/src_common/ethUstream.h index ff5c28e..24cbaa0 100644 --- a/src_common/ethUstream.h +++ b/src_common/ethUstream.h @@ -53,6 +53,12 @@ typedef enum rlpTxField_e { TX_RLP_DONE } rlpTxField_e; +// EIP 2718 TransactionType +typedef enum txType_e { + LegacyTransaction = 1, + BerlinTransaction = 2 +} txType_e; + typedef enum parserStatus_e { USTREAM_PROCESSING, USTREAM_SUSPENDED, @@ -93,6 +99,7 @@ typedef struct txContext_t { ustreamProcess_t customProcessor; txContent_t *content; void *extra; + uint8_t txType; } txContext_t; void initTx(txContext_t *context,