OSDN Git Service

Update for hsm_test (#131)
authoricodezjb <icodezjb@163.com>
Mon, 27 Nov 2017 02:37:07 +0000 (10:37 +0800)
committerGuanghua Guo <1536310027@qq.com>
Mon, 27 Nov 2017 02:37:07 +0000 (10:37 +0800)
* Update for hsm_test

blockchain/hsm_test.go [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 129c705..18024dd
@@ -15,6 +15,7 @@ import (
        "github.com/bytom/blockchain/pseudohsm"
        "github.com/bytom/blockchain/txbuilder"
        "github.com/bytom/blockchain/txdb"
+       w "github.com/bytom/blockchain/wallet"
        cfg "github.com/bytom/config"
        "github.com/bytom/crypto/ed25519/chainkd"
        "github.com/bytom/protocol"
@@ -34,7 +35,6 @@ func TestHSM(t *testing.T) {
        store := txdb.NewStore(tc)
 
        var accounts *account.Manager
-       var wallet *account.Wallet
        var assets *asset.Registry
        genesisBlock := cfg.GenerateGenesisBlock()
        // tx pool init
@@ -53,14 +53,11 @@ func TestHSM(t *testing.T) {
                t.Fatal(err)
        }
 
-       walletDB := dbm.NewDB("wallet", config.DBBackend, config.DBDir())
-
        accountsDB := dbm.NewDB("account", config.DBBackend, dir)
-       wallet = account.NewWallet(walletDB)
-       accounts = account.NewManager(accountsDB, chain, wallet)
-       //accounts.IndexAccounts(query.NewIndexer(accountsDB, chain))
-
        assetsDB := dbm.NewDB("asset", config.DBBackend, dir)
+       walletDB := dbm.NewDB("wallet", config.DBBackend, config.DBDir())
+
+       accounts = account.NewManager(accountsDB, walletDB, w.GetWalletHeight, chain)
        assets = asset.NewRegistry(assetsDB, chain)
 
        hsm, err := pseudohsm.New(dirPath)