OSDN Git Service

Set chain Tx Gas 0 (#409)
[bytom/vapor.git] / test / builder_test.go
index 839a4a9..7eda649 100644 (file)
@@ -13,8 +13,6 @@ import (
 var (
        //chainTxUtxoNum maximum utxo quantity in a tx
        chainTxUtxoNum = 5
-       //chainTxMergeGas chain tx gas
-       chainTxMergeGas = uint64(10000000)
 )
 
 func TestBuildBtmTxChain(t *testing.T) {
@@ -30,7 +28,7 @@ func TestBuildBtmTxChain(t *testing.T) {
                        inputUtxo:  []uint64{5},
                        wantInput:  [][]uint64{},
                        wantOutput: [][]uint64{},
-                       wantUtxo:   5 * chainTxMergeGas,
+                       wantUtxo:   5,
                },
                {
                        inputUtxo: []uint64{5, 4},
@@ -38,9 +36,9 @@ func TestBuildBtmTxChain(t *testing.T) {
                                []uint64{5, 4},
                        },
                        wantOutput: [][]uint64{
-                               []uint64{8},
+                               []uint64{9},
                        },
-                       wantUtxo: 8 * chainTxMergeGas,
+                       wantUtxo: 9,
                },
                {
                        inputUtxo: []uint64{5, 4, 1, 1},
@@ -49,22 +47,22 @@ func TestBuildBtmTxChain(t *testing.T) {
                                []uint64{1, 9},
                        },
                        wantOutput: [][]uint64{
+                               []uint64{11},
                                []uint64{10},
-                               []uint64{9},
                        },
-                       wantUtxo: 10 * chainTxMergeGas,
+                       wantUtxo: 11,
                },
                {
                        inputUtxo: []uint64{22, 123, 53, 234, 23, 4, 2423, 24, 23, 43, 34, 234, 234, 24, 11, 16, 33, 59, 73, 89, 66},
                        wantInput: [][]uint64{
                                []uint64{22, 123, 53, 234, 23, 4, 2423, 24, 23, 43, 34, 234, 234, 24, 11, 16, 33, 59, 73, 89},
-                               []uint64{66, 3778},
+                               []uint64{66, 3779},
                        },
                        wantOutput: [][]uint64{
-                               []uint64{3778},
-                               []uint64{3843},
+                               []uint64{3779},
+                               []uint64{3845},
                        },
-                       wantUtxo: 3843 * chainTxMergeGas,
+                       wantUtxo: 3845,
                },
        }
 
@@ -82,7 +80,7 @@ func TestBuildBtmTxChain(t *testing.T) {
                utxos := []*acc.UTXO{}
                for _, amount := range c.inputUtxo {
                        utxos = append(utxos, &acc.UTXO{
-                               Amount:         amount * chainTxMergeGas,
+                               Amount:         amount,
                                AssetID:        *consensus.BTMAssetID,
                                Address:        acp.Address,
                                ControlProgram: acp.ControlProgram,
@@ -97,12 +95,12 @@ func TestBuildBtmTxChain(t *testing.T) {
                for i, tpl := range tpls {
                        gotInput := []uint64{}
                        for _, input := range tpl.Transaction.Inputs {
-                               gotInput = append(gotInput, input.Amount()/chainTxMergeGas)
+                               gotInput = append(gotInput, input.Amount())
                        }
 
                        gotOutput := []uint64{}
                        for _, output := range tpl.Transaction.Outputs {
-                               gotOutput = append(gotOutput, output.AssetAmount().Amount/chainTxMergeGas)
+                               gotOutput = append(gotOutput, output.AssetAmount().Amount)
                        }
 
                        if !testutil.DeepEqual(c.wantInput[i], gotInput) {