OSDN Git Service

fix format
authoroysheng <oysheng@bytom.io>
Tue, 5 Jun 2018 13:00:59 +0000 (21:00 +0800)
committeroysheng <oysheng@bytom.io>
Tue, 5 Jun 2018 13:21:03 +0000 (21:21 +0800)
api/query.go
node/node.go
wallet/unconfirmed_test.go

index 538da4b..db9b87f 100644 (file)
@@ -103,7 +103,6 @@ func (a *API) listTransactions(ctx context.Context, filter struct {
                } else {
                        transaction, err = a.wallet.GetTransactionByTxID(filter.ID)
                }
-
                if err != nil {
                        return NewErrorResponse(err)
                }
index 6ee3d7d..905a003 100644 (file)
@@ -30,7 +30,6 @@ import (
        "github.com/bytom/netsync"
        "github.com/bytom/protocol"
        "github.com/bytom/protocol/bc"
-       "github.com/bytom/protocol/bc/types"
        "github.com/bytom/types"
        w "github.com/bytom/wallet"
 )
index 2e22080..a607030 100644 (file)
@@ -7,7 +7,6 @@ import (
 
        dbm "github.com/tendermint/tmlibs/db"
 
-       "github.com/bytom/testutil"
        "github.com/bytom/account"
        "github.com/bytom/asset"
        "github.com/bytom/blockchain/pseudohsm"
@@ -15,6 +14,7 @@ import (
        "github.com/bytom/consensus"
        "github.com/bytom/crypto/ed25519/chainkd"
        "github.com/bytom/protocol/bc/types"
+       "github.com/bytom/testutil"
 )
 
 func TestWalletUnconfirmedTxs(t *testing.T) {
@@ -61,30 +61,23 @@ func TestWalletUnconfirmedTxs(t *testing.T) {
        btmUtxo := mockUTXO(controlProg, consensus.BTMAssetID)
        utxos = append(utxos, btmUtxo)
 
-       _, txData, err := mockTxData(utxos, testAccount)
-       if err != nil {
-               t.Fatal(err)
-       }
-       testTx1 := types.NewTx(*txData)
-       w.SaveUnconfirmedTx(testTx1)
-
        OtherUtxo := mockUTXO(controlProg, &asset.AssetID)
        utxos = append(utxos, OtherUtxo)
-       _, txData, err = mockTxData(utxos, testAccount)
+       _, txData, err := mockTxData(utxos, testAccount)
        if err != nil {
                t.Fatal(err)
        }
-       testTx2 := types.NewTx(*txData)
-       w.SaveUnconfirmedTx(testTx2)
+       testTx := types.NewTx(*txData)
+       w.SaveUnconfirmedTx(testTx)
 
-       txs := AnnotatedTxs([]*types.Tx{testTx1}, w)
+       txs := AnnotatedTxs([]*types.Tx{testTx}, w)
        wantTx := txs[0]
-       gotTx, err := w.GetUnconfirmedTxByTxID(testTx1.ID.String())
+       gotTx, err := w.GetUnconfirmedTxByTxID(testTx.ID.String())
        if !testutil.DeepEqual(gotTx.ID, wantTx.ID) {
                t.Errorf(`transaction got=%#v; want=%#v`, gotTx.ID, wantTx.ID)
        }
 
-       wantTxs := AnnotatedTxs([]*types.Tx{testTx1, testTx2}, w)
+       wantTxs := AnnotatedTxs([]*types.Tx{testTx}, w)
        gotTxs, err := w.GetUnconfirmedTxs("")
        for i, want := range wantTxs {
                if !testutil.DeepEqual(gotTxs[i].ID, want.ID) {