OSDN Git Service

Merge pull request #1329 from Bytom/dev
[bytom/bytom.git] / wallet / wallet_test.go
index 29d39d5..b3cca13 100644 (file)
@@ -31,7 +31,7 @@ func TestWalletUpdate(t *testing.T) {
        defer os.RemoveAll("temp")
 
        store := leveldb.NewStore(testDB)
-       txPool := protocol.NewTxPool()
+       txPool := protocol.NewTxPool(store)
 
        chain, err := protocol.NewChain(store, txPool)
        if err != nil {
@@ -44,17 +44,17 @@ func TestWalletUpdate(t *testing.T) {
                t.Fatal(err)
        }
 
-       xpub1, err := hsm.XCreate("test_pub1", "password")
+       xpub1, _, err := hsm.XCreate("test_pub1", "password", "en")
        if err != nil {
                t.Fatal(err)
        }
 
-       testAccount, err := accountManager.Create(nil, []chainkd.XPub{xpub1.XPub}, 1, "testAccount")
+       testAccount, err := accountManager.Create([]chainkd.XPub{xpub1.XPub}, 1, "testAccount")
        if err != nil {
                t.Fatal(err)
        }
 
-       controlProg, err := accountManager.CreateAddress(nil, testAccount.ID, false)
+       controlProg, err := accountManager.CreateAddress(testAccount.ID, false)
        if err != nil {
                t.Fatal(err)
        }
@@ -62,7 +62,7 @@ func TestWalletUpdate(t *testing.T) {
        controlProg.KeyIndex = 1
 
        reg := asset.NewRegistry(testDB, chain)
-       asset, err := reg.Define([]chainkd.XPub{xpub1.XPub}, 1, nil, "TESTASSET")
+       asset, err := reg.Define([]chainkd.XPub{xpub1.XPub}, 1, nil, "TESTASSET", nil)
        if err != nil {
                t.Fatal(err)
        }
@@ -81,6 +81,7 @@ func TestWalletUpdate(t *testing.T) {
        tx := types.NewTx(*txData)
        block := mockSingleBlock(tx)
        txStatus := bc.NewTransactionStatus()
+       txStatus.SetStatus(0, false)
        store.SaveBlock(block, txStatus)
 
        w := mockWallet(testDB, accountManager, reg, chain)