@@ -526,6 +526,7 @@ func TestEth_PendingTransactionFilter(t *testing.T) {
526
526
}
527
527
528
528
func TestEth_EstimateGas (t * testing.T ) {
529
+
529
530
param := make ([]map [string ]string , 1 )
530
531
param [0 ] = make (map [string ]string )
531
532
param [0 ]["from" ] = "0x" + fmt .Sprintf ("%x" , from )
@@ -539,26 +540,33 @@ func TestEth_EstimateGas(t *testing.T) {
539
540
err := json .Unmarshal (rpcRes .Result , & gas )
540
541
require .NoError (t , err , string (rpcRes .Result ))
541
542
542
- require .Equal (t , "0xf54c " , gas )
543
+ require .Equal (t , "0xf560 " , gas )
543
544
}
544
545
545
546
func TestEth_EstimateGas_ContractDeployment (t * testing.T ) {
546
547
bytecode := "0x608060405234801561001057600080fd5b5060117f775a94827b8fd9b519d36cd827093c664f93347070a554f65e4a6f56cd73889860405160405180910390a260d08061004d6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063eb8ac92114602d575b600080fd5b606060048036036040811015604157600080fd5b8101908080359060200190929190803590602001909291905050506062565b005b8160008190555080827ff3ca124a697ba07e8c5e80bebcfcc48991fc16a63170e8a9206e30508960d00360405160405180910390a3505056fea265627a7a723158201d94d2187aaf3a6790527b615fcc40970febf0385fa6d72a2344848ebd0df3e964736f6c63430005110032"
547
548
549
+ //deploy contract befor call estimateGas, make account nonce changed
550
+ hash , _ := DeployTestContract (t , from )
551
+ time .Sleep (5 * time .Second )
552
+ paramdeploy := []string {hash .String ()}
553
+ rpcRes := Call (t , "eth_getTransactionReceipt" , paramdeploy )
554
+ require .Nil (t , rpcRes .Error )
555
+
548
556
param := make ([]map [string ]string , 1 )
549
557
param [0 ] = make (map [string ]string )
550
558
param [0 ]["from" ] = "0x" + fmt .Sprintf ("%x" , from )
551
559
param [0 ]["data" ] = bytecode
552
560
553
- rpcRes : = Call (t , "eth_estimateGas" , param )
561
+ rpcRes = Call (t , "eth_estimateGas" , param )
554
562
require .NotNil (t , rpcRes )
555
563
require .NotEmpty (t , rpcRes .Result )
556
564
557
565
var gas hexutil.Uint64
558
566
err := json .Unmarshal (rpcRes .Result , & gas )
559
567
require .NoError (t , err , string (rpcRes .Result ))
560
568
561
- require .Equal (t , "0x1a724 " , gas .String ())
569
+ require .Equal (t , "0x1a738 " , gas .String ())
562
570
}
563
571
564
572
func TestEth_GetBlockByNumber (t * testing.T ) {
0 commit comments