From 2e3125dbffce89702daede07bdedff572e6f8781 Mon Sep 17 00:00:00 2001 From: Jacky Wang Date: Wed, 14 Apr 2021 01:31:59 -0700 Subject: [PATCH] [txpool] fixed delegate transaction cost unit test --- staking/types/transaction_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/staking/types/transaction_test.go b/staking/types/transaction_test.go index 51c7fb3be..55f21053a 100644 --- a/staking/types/transaction_test.go +++ b/staking/types/transaction_test.go @@ -140,16 +140,22 @@ func TestGasCost(t *testing.T) { t.Errorf("gas price set incorrectly \n") } cost, err := stakingTx.Cost() - if err != nil || cost.Int64() != 600100 { - t.Errorf("staking transaction cost is incorrect %v\n", err) + if err != nil { + t.Errorf("unexpected error %v\n", err) + } + if cost.Int64() != 600100 { + t.Errorf("unexpected cost: %v / %v", cost, 600100) } delegateTx, err := createDelegate() if err != nil { t.Errorf("cannot create delegate staking transaction, %v\n", err) } cost, err = delegateTx.Cost() - if err != nil || cost.Int64() != 21100 { - t.Errorf("staking transaction cost is incorrect %v\n", err) + if err != nil { + t.Errorf("unexpected error %v\n", err) + } + if cost.Int64() != 21000 { + t.Errorf("unexpected cost: %v / %v", cost, 21000) } }