@@ -174,25 +174,20 @@ func (be *registryAPIBackend) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr
174
174
175
175
from .SetBalance (common .MaxBig )
176
176
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
184
178
if len (toStr ) > 0 {
185
179
addr := common .HexToAddress (toStr )
186
- msg . to = & addr
180
+ to = & addr
187
181
}
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 )
191
185
}
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 )
195
189
}
190
+ msg := types .NewMessage (from .Address (), to , 0 , common .Big (valueStr ), gas , gasPrice , common .FromHex (dataStr ))
196
191
197
192
header := be .bc .CurrentBlock ().Header ()
198
193
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
258
253
tx = types .NewTransaction (nonce , to , value , gas , price , data )
259
254
}
260
255
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 ())
262
258
if err != nil {
263
259
return "" , err
264
260
}
265
- signedTx , err := tx .WithSignature (signature )
261
+ signedTx , err := tx .WithSignature (types. HomesteadSigner {}, signature )
266
262
if err != nil {
267
263
return "" , err
268
264
}
0 commit comments