X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=blobdiff_plain;f=test%2Fbench_blockchain_test.go;h=092811d510c1b9a4fbeb54e1e8867efab7a5db61;hp=1d3413b4125405fcbc046b240c4dcc50bece9f0a;hb=refs%2Fheads%2Fblock_fetcher;hpb=2cf5801b2e693a45de9b51ec9aa9c1f787d57105 diff --git a/test/bench_blockchain_test.go b/test/bench_blockchain_test.go index 1d3413b4..092811d5 100644 --- a/test/bench_blockchain_test.go +++ b/test/bench_blockchain_test.go @@ -11,13 +11,14 @@ import ( "github.com/vapor/blockchain/pseudohsm" "github.com/vapor/blockchain/signers" "github.com/vapor/blockchain/txbuilder" + "github.com/vapor/config" "github.com/vapor/consensus" "github.com/vapor/crypto/ed25519/chainkd" "github.com/vapor/database" dbm "github.com/vapor/database/leveldb" "github.com/vapor/database/storage" "github.com/vapor/event" - "github.com/vapor/mining" + "github.com/vapor/proposal" "github.com/vapor/protocol" "github.com/vapor/protocol/bc" "github.com/vapor/protocol/bc/types" @@ -126,7 +127,7 @@ func GenerateChainData(dirPath string, testDB dbm.DB, txNumber, otherAssetNum in // init UtxoViewpoint utxoView := state.NewUtxoViewpoint() - utxoEntry := storage.NewUtxoEntry(false, 1, false) + utxoEntry := storage.NewUtxoEntry(storage.NormalUTXOType, 1, false) for _, tx := range txs { for _, id := range tx.SpentOutputIDs { utxoView.Entries[id] = utxoEntry @@ -137,10 +138,11 @@ func GenerateChainData(dirPath string, testDB dbm.DB, txNumber, otherAssetNum in return nil, nil, nil, err } + config.CommonConfig = config.DefaultConfig() store := database.NewStore(testDB) dispatcher := event.NewDispatcher() txPool := protocol.NewTxPool(store, dispatcher) - chain, err := protocol.NewChain(store, txPool) + chain, err := protocol.NewChain(store, txPool, dispatcher) if err != nil { return nil, nil, nil, err } @@ -157,7 +159,7 @@ func InsertChain(chain *protocol.Chain, txPool *protocol.TxPool, txs []*types.Tx } } - block, err := mining.NewBlockTemplate(chain, txPool, nil) + block, err := proposal.NewBlockTemplate(chain, txPool, nil, uint64(time.Now().UnixNano()/1e6)) if err != nil { return err } @@ -249,7 +251,7 @@ func AddTxInputFromUtxo(utxo *account.UTXO, singer *signers.Signer) (*types.TxIn } func AddTxOutput(assetID bc.AssetID, amount uint64, controlProgram []byte) *types.TxOutput { - out := types.NewTxOutput(assetID, amount, controlProgram) + out := types.NewIntraChainOutput(assetID, amount, controlProgram) return out } @@ -366,7 +368,8 @@ func SetUtxoView(db dbm.DB, view *state.UtxoViewpoint) error { //-------------------------Mock actual transaction---------------------------------- func MockTxsP2PKH(keyDirPath string, testDB dbm.DB, txNumber, otherAssetNum int) ([]*types.Tx, error) { - accountManager := account.NewManager(testDB, nil) + accountStore := database.NewAccountStore(testDB) + accountManager := account.NewManager(accountStore, nil) hsm, err := pseudohsm.New(keyDirPath) if err != nil { return nil, err @@ -408,7 +411,8 @@ func MockTxsP2PKH(keyDirPath string, testDB dbm.DB, txNumber, otherAssetNum int) } func MockTxsP2SH(keyDirPath string, testDB dbm.DB, txNumber, otherAssetNum int) ([]*types.Tx, error) { - accountManager := account.NewManager(testDB, nil) + accountStore := database.NewAccountStore(testDB) + accountManager := account.NewManager(accountStore, nil) hsm, err := pseudohsm.New(keyDirPath) if err != nil { return nil, err @@ -455,7 +459,8 @@ func MockTxsP2SH(keyDirPath string, testDB dbm.DB, txNumber, otherAssetNum int) } func MockTxsMultiSign(keyDirPath string, testDB dbm.DB, txNumber, otherAssetNum int) ([]*types.Tx, error) { - accountManager := account.NewManager(testDB, nil) + accountStore := database.NewAccountStore(testDB) + accountManager := account.NewManager(accountStore, nil) hsm, err := pseudohsm.New(keyDirPath) if err != nil { return nil, err