aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2017-03-18 21:05:32 +0800
committerFelix Lange <fjl@twurst.com>2017-03-23 22:58:42 +0800
commit67c47459f283842bbf0063d9a1dc078251d6f433 (patch)
treee74d896475336330ddb534b0de100369d8809257
parent0f4b75bea27b1c39f1dd5c42c3ef472b98f4a7df (diff)
downloadgo-tangerine-67c47459f283842bbf0063d9a1dc078251d6f433.tar.gz
go-tangerine-67c47459f283842bbf0063d9a1dc078251d6f433.tar.zst
go-tangerine-67c47459f283842bbf0063d9a1dc078251d6f433.zip
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.
-rw-r--r--core/types/transaction_signing.go3
1 files changed, 3 insertions, 0 deletions
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)),