[contract] add tx fee test for the chain version 3
@@ -5816,6 +5816,8 @@ func TestBF(t *testing.T) {
if err != nil {
t.Error(err)
}
+
+ feeTest := func(expectedFee uint64) {
bal := state.GetBalanceBigInt().Uint64()
tx := NewLuaTxCall("ktlee", "op", 0, `{"Name": "main"}`)
err = bc.ConnectBlock(tx)
@@ -5823,7 +5825,6 @@ func TestBF(t *testing.T) {
t.Error(err)
}
r := bc.GetReceipt(tx.Hash())
- expectedFee := uint64(47456244)
if r.GetGasUsed() != expectedFee {
t.Errorf("expected: %d, but got: %d", expectedFee, r.GetGasUsed())
}
@@ -5840,6 +5841,14 @@ func TestBF(t *testing.T) {
}
}
+ feeTest(47456244)
+
+ OldV3 := HardforkConfig.V3
+ HardforkConfig.V3 = types.BlockNo(0)
+ feeTest(47456460)
+ HardforkConfig.V3 = OldV3
+}
+
func TestContractSendF(t *testing.T) {
bc, err := LoadDummyChain(OnPubNet)
if err != nil {
