From 67c47459f283842bbf0063d9a1dc078251d6f433 Mon Sep 17 00:00:00 2001
From: Felix Lange <fjl@twurst.com>
Date: Sat, 18 Mar 2017 14:05:32 +0100
Subject: [PATCH] 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.
---
 core/types/transaction_signing.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go
index e7eb7c5f0..b4bab0aad 100644
--- a/core/types/transaction_signing.go
+++ b/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)),
-- 
GitLab