Quellcode durchsuchen

core/types: handle nil ChainId in NewEIP155Signer

All uses of ChainConfig.ChainId eventually end up in NewEIP155Signer.
This fixes the case where users forget to set the ChainId in their
config.
Felix Lange vor 8 Jahren
Ursprung
Commit
67c47459f2
1 geänderte Dateien mit 3 neuen und 0 gelöschten Zeilen
  1. 3 0
      core/types/transaction_signing.go

+ 3 - 0
core/types/transaction_signing.go

@@ -112,6 +112,9 @@ type EIP155Signer struct {
 }
 
 func NewEIP155Signer(chainId *big.Int) EIP155Signer {
+	if chainId == nil {
+		chainId = new(big.Int)
+	}
 	return EIP155Signer{
 		chainId:    chainId,
 		chainIdMul: new(big.Int).Mul(chainId, big.NewInt(2)),