Skip to content

Commit d6fbde2

Browse files
committed
another check
1 parent c36b9a5 commit d6fbde2

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

collector/tx_processor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,13 @@ func (p *TxProcessor) validateTx(fTrash *os.File, txIn common.TxIn) error { // i
255255
txHashLower := strings.ToLower(tx.Hash().Hex())
256256
log := p.log.With("tx_hash", txHashLower).With("source", txIn.Source)
257257

258-
// Make sure the transaction is signed properly.
259258
if tx.ChainId().Sign() <= 0 {
260259
log.Debugf("error: invalid chainID %w", tx.ChainId())
261260
p.writeTrash(fTrash, txIn, "chainId not set", "")
262-
return fmt.Errorf("chainId not set") //nolint:err113
261+
return common.ErrChainIDNotSet
263262
}
264263

264+
// Make sure the transaction is signed properly.
265265
if _, err := types.Sender(types.LatestSignerForChainID(tx.ChainId()), tx); err != nil {
266266
log.Debugw("error: transaction signature incorrect")
267267
p.writeTrash(fTrash, txIn, common.TrashTxSignatureError, "")

common/errors.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package common
2+
3+
import "errors"
4+
5+
var ErrChainIDNotSet = errors.New("ChainID not set")

common/txsfile.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ func ParseTx(timestampMs int64, rawTxHex string) (TxSummaryEntry, *types.Transac
153153
return TxSummaryEntry{}, nil, err
154154
}
155155

156+
// Make sure the transaction is signed properly.
157+
if tx.ChainId().Sign() <= 0 {
158+
return TxSummaryEntry{}, nil, ErrChainIDNotSet
159+
}
160+
156161
from, err := types.Sender(types.LatestSignerForChainID(tx.ChainId()), tx)
157162
if err != nil {
158163
// fmt.Println("Error: ", err)

0 commit comments

Comments
 (0)