X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=blobdiff_plain;f=test%2Fbench_blockchain_test.go;h=8ccb36b759d6eaad265d8a065783688f57a67c50;hp=abdb2e076a514ae00640c8c39272fea15939837a;hb=e57f41f037f3f37fd7253e34f8a04e60a125e634;hpb=620deabb3a00c7995b190b5ed47a224826165ecf diff --git a/test/bench_blockchain_test.go b/test/bench_blockchain_test.go index abdb2e07..8ccb36b7 100644 --- a/test/bench_blockchain_test.go +++ b/test/bench_blockchain_test.go @@ -13,7 +13,10 @@ import ( "github.com/vapor/blockchain/pseudohsm" "github.com/vapor/blockchain/signers" "github.com/vapor/blockchain/txbuilder" + "github.com/vapor/config" "github.com/vapor/consensus" + engine "github.com/vapor/consensus/consensus" + "github.com/vapor/consensus/consensus/dpos" "github.com/vapor/crypto/ed25519/chainkd" "github.com/vapor/database/leveldb" "github.com/vapor/database/storage" @@ -136,10 +139,15 @@ func GenerateChainData(dirPath string, testDB dbm.DB, txNumber, otherAssetNum in if err := SetUtxoView(testDB, utxoView); err != nil { return nil, nil, nil, err } + var engine engine.Engine + switch config.CommonConfig.Consensus.Type { + case "dpos": + engine = dpos.GDpos + } store := leveldb.NewStore(testDB) txPool := protocol.NewTxPool(store) - chain, err := protocol.NewChain(store, txPool) + chain, err := protocol.NewChain(store, txPool, engine) if err != nil { return nil, nil, nil, err } @@ -156,7 +164,7 @@ func InsertChain(chain *protocol.Chain, txPool *protocol.TxPool, txs []*types.Tx } } - block, err := mining.NewBlockTemplate(chain, txPool, nil, nil) + block, err := mining.NewBlockTemplate(chain, txPool, nil, nil, nil) if err != nil { return err }