"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"
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
}
}
}
- block, err := mining.NewBlockTemplate(chain, txPool, nil, nil)
+ block, err := mining.NewBlockTemplate(chain, txPool, nil, nil, nil)
if err != nil {
return err
}