@@ -174,25 +174,20 @@ func (be *registryAPIBackend) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr
174174
175175 from .SetBalance (common .MaxBig )
176176
177- msg := callmsg {
178- from : from ,
179- gas : common .Big (gasStr ),
180- gasPrice : common .Big (gasPriceStr ),
181- value : common .Big (valueStr ),
182- data : common .FromHex (dataStr ),
183- }
177+ var to * common.Address
184178 if len (toStr ) > 0 {
185179 addr := common .HexToAddress (toStr )
186- msg . to = & addr
180+ to = & addr
187181 }
188-
189- if msg . gas .Cmp ( big . NewInt ( 0 ) ) == 0 {
190- msg . gas = big .NewInt (50000000 )
182+ gas := common . Big ( gasStr )
183+ if gas .BitLen ( ) == 0 {
184+ gas = big .NewInt (50000000 )
191185 }
192-
193- if msg . gasPrice .Cmp ( big . NewInt ( 0 ) ) == 0 {
194- msg . gasPrice = new (big.Int ).Mul (big .NewInt (50 ), common .Shannon )
186+ gasPrice := common . Big ( gasPriceStr )
187+ if gasPrice .BitLen ( ) == 0 {
188+ gasPrice = new (big.Int ).Mul (big .NewInt (50 ), common .Shannon )
195189 }
190+ msg := types .NewMessage (from .Address (), to , 0 , common .Big (valueStr ), gas , gasPrice , common .FromHex (dataStr ))
196191
197192 header := be .bc .CurrentBlock ().Header ()
198193 vmenv := core .NewEnv (statedb , be .config , be .bc , msg , header , vm.Config {})
@@ -258,11 +253,12 @@ func (be *registryAPIBackend) Transact(fromStr, toStr, nonceStr, valueStr, gasSt
258253 tx = types .NewTransaction (nonce , to , value , gas , price , data )
259254 }
260255
261- signature , err := be .am .SignEthereum (from , tx .SigHash ().Bytes ())
256+ sigHash := (types.HomesteadSigner {}).Hash (tx )
257+ signature , err := be .am .SignEthereum (from , sigHash .Bytes ())
262258 if err != nil {
263259 return "" , err
264260 }
265- signedTx , err := tx .WithSignature (signature )
261+ signedTx , err := tx .WithSignature (types. HomesteadSigner {}, signature )
266262 if err != nil {
267263 return "" , err
268264 }
0 commit comments