瀏覽代碼

mobile: use EIP155 signer for determining sender

Bas van Kervel 8 年之前
父節點
當前提交
eb92522278
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      mobile/types.go

+ 5 - 2
mobile/types.go

@@ -264,8 +264,11 @@ func (tx *Transaction) GetHash() *Hash    { return &Hash{tx.tx.Hash()} }
 func (tx *Transaction) GetSigHash() *Hash { return &Hash{tx.tx.SigHash(types.HomesteadSigner{})} }
 func (tx *Transaction) GetCost() *BigInt  { return &BigInt{tx.tx.Cost()} }
 
-func (tx *Transaction) GetFrom() (address *Address, _ error) {
-	from, err := types.Sender(types.HomesteadSigner{}, tx.tx)
+func (tx *Transaction) GetFrom(chainID *BigInt) (address *Address, _ error) {
+	if chainID == nil { // Null passed from mobile app
+		chainID = new(BigInt)
+	}
+	from, err := types.Sender(types.NewEIP155Signer(chainID.bigint), tx.tx)
 	return &Address{from}, err
 }