@@ -384,14 +384,12 @@ func TestTraceBlock(t *testing.T) {
384
384
}
385
385
genBlocks := 10
386
386
signer := types.HomesteadSigner {}
387
- var txHash common.Hash
388
387
backend := newTestBackend (t , genBlocks , genesis , func (i int , b * core.BlockGen ) {
389
388
// Transfer from account[0] to account[1]
390
389
// value: 1000 wei
391
390
// fee: 0 wei
392
391
tx , _ := types .SignTx (types .NewTransaction (uint64 (i ), accounts [1 ].addr , big .NewInt (1000 ), params .TxGas , b .BaseFee (), nil ), signer , accounts [0 ].key )
393
392
b .AddTx (tx )
394
- txHash = tx .Hash ()
395
393
})
396
394
defer backend .chain .Stop ()
397
395
api := NewAPI (backend )
@@ -410,7 +408,7 @@ func TestTraceBlock(t *testing.T) {
410
408
// Trace head block
411
409
{
412
410
blockNumber : rpc .BlockNumber (genBlocks ),
413
- want : fmt . Sprintf ( `[{"txHash":"%v"," result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]` , txHash ) ,
411
+ want : `[{"result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]` ,
414
412
},
415
413
// Trace non-existent block
416
414
{
@@ -420,12 +418,12 @@ func TestTraceBlock(t *testing.T) {
420
418
// Trace latest block
421
419
{
422
420
blockNumber : rpc .LatestBlockNumber ,
423
- want : fmt . Sprintf ( `[{"txHash":"%v"," result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]` , txHash ) ,
421
+ want : `[{"result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]` ,
424
422
},
425
423
// Trace pending block
426
424
{
427
425
blockNumber : rpc .PendingBlockNumber ,
428
- want : fmt . Sprintf ( `[{"txHash":"%v"," result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]` , txHash ) ,
426
+ want : `[{"result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]` ,
429
427
},
430
428
}
431
429
for i , tc := range testSuite {
@@ -855,7 +853,7 @@ func TestTraceChain(t *testing.T) {
855
853
backend .relHook = func () { rel .Add (1 ) }
856
854
api := NewAPI (backend )
857
855
858
- single := `{"txHash":"0x0000000000000000000000000000000000000000000000000000000000000000"," result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}`
856
+ single := `{"result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}`
859
857
var cases = []struct {
860
858
start uint64
861
859
end uint64
@@ -874,17 +872,16 @@ func TestTraceChain(t *testing.T) {
874
872
875
873
next := c .start + 1
876
874
for result := range resCh {
877
- if have , want : = uint64 (result .Block ), next ; have != want {
878
- t .Fatalf ( "unexpected tracing block, have %d want %d" , have , want )
875
+ if next ! = uint64 (result .Block ) {
876
+ t .Error ( "Unexpected tracing block" )
879
877
}
880
- if have , want := len (result .Traces ), int (next ); have != want {
881
- t .Fatalf ( "unexpected result length, have %d want %d" , have , want )
878
+ if len (result .Traces ) != int (next ) {
879
+ t .Error ( "Unexpected tracing result" )
882
880
}
883
881
for _ , trace := range result .Traces {
884
- trace .TxHash = common.Hash {}
885
882
blob , _ := json .Marshal (trace )
886
- if have , want := string (blob ), single ; have != want {
887
- t .Fatalf ( "unexpected tracing result, have \n %v \n want: \n %v" , have , want )
883
+ if string (blob ) != single {
884
+ t .Error ( "Unexpected tracing result" )
888
885
}
889
886
}
890
887
next += 1
0 commit comments