X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=blobdiff_plain;f=test%2Futil.go;h=54b9b05eb0a90f3fd67de20fc5c3305e368b12b2;hp=dd1c17acf0201ca6740ccd68819ee861c8b50b99;hb=refs%2Fheads%2Ffix_log_err;hpb=f6ec2b987c394f065e527bcdf5942d1f9f0dad66 diff --git a/test/util.go b/test/util.go index dd1c17ac..54b9b05e 100644 --- a/test/util.go +++ b/test/util.go @@ -4,14 +4,15 @@ import ( "context" "time" - dbm "github.com/tendermint/tmlibs/db" - "github.com/vapor/account" "github.com/vapor/blockchain/pseudohsm" "github.com/vapor/blockchain/txbuilder" + "github.com/vapor/config" "github.com/vapor/consensus" "github.com/vapor/crypto/ed25519/chainkd" - "github.com/vapor/database/leveldb" + "github.com/vapor/database" + dbm "github.com/vapor/database/leveldb" + "github.com/vapor/event" "github.com/vapor/protocol" "github.com/vapor/protocol/bc" "github.com/vapor/protocol/bc/types" @@ -24,12 +25,12 @@ const ( ) // MockChain mock chain with genesis block -func MockChain(testDB dbm.DB) (*protocol.Chain, *leveldb.Store, *protocol.TxPool, error) { - store := leveldb.NewStore(testDB) - txPool := protocol.NewTxPool(store) - chain, err := protocol.NewChain(store, txPool) - consensus.ActiveNetParams.Signer = "78673764e0ba91a4c5ba9ec0c8c23c69e3d73bf27970e05e0a977e81e13bde475264d3b177a96646bc0ce517ae7fd63504c183ab6d330dea184331a4cf5912d5" - setAuthoritys(chain) +func MockChain(testDB dbm.DB) (*protocol.Chain, *database.Store, *protocol.TxPool, error) { + config.CommonConfig = config.DefaultConfig() + store := database.NewStore(testDB) + dispatcher := event.NewDispatcher() + txPool := protocol.NewTxPool(store, dispatcher) + chain, err := protocol.NewChain(store, txPool, dispatcher) return chain, store, txPool, err } @@ -60,7 +61,7 @@ func MockTx(utxo *account.UTXO, testAccount *account.Account) (*txbuilder.Templa if err := b.AddInput(txInput, sigInst); err != nil { return nil, nil, err } - out := types.NewTxOutput(*consensus.BTMAssetID, 100, []byte{byte(vm.OP_FAIL)}) + out := types.NewIntraChainOutput(*consensus.BTMAssetID, 100, []byte{byte(vm.OP_FAIL)}) if err := b.AddOutput(out); err != nil { return nil, nil, err }