OSDN Git Service

dispatch signature when proccess block (#85)
[bytom/vapor.git] / test / bench_blockchain_test.go
index abdb2e0..e987946 100644 (file)
@@ -7,16 +7,16 @@ import (
        "testing"
        "time"
 
-       dbm "github.com/tendermint/tmlibs/db"
-
        "github.com/vapor/account"
        "github.com/vapor/blockchain/pseudohsm"
        "github.com/vapor/blockchain/signers"
        "github.com/vapor/blockchain/txbuilder"
        "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/database/storage"
+       "github.com/vapor/event"
        "github.com/vapor/mining"
        "github.com/vapor/protocol"
        "github.com/vapor/protocol/bc"
@@ -137,9 +137,10 @@ func GenerateChainData(dirPath string, testDB dbm.DB, txNumber, otherAssetNum in
                return nil, nil, nil, err
        }
 
-       store := leveldb.NewStore(testDB)
-       txPool := protocol.NewTxPool(store)
-       chain, err := protocol.NewChain(store, txPool)
+       store := database.NewStore(testDB)
+       dispatcher := event.NewDispatcher()
+       txPool := protocol.NewTxPool(store, dispatcher)
+       chain, err := protocol.NewChain(store, txPool, dispatcher)
        if err != nil {
                return nil, nil, nil, err
        }
@@ -156,7 +157,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)
        if err != nil {
                return err
        }
@@ -181,11 +182,6 @@ func InsertChain(chain *protocol.Chain, txPool *protocol.TxPool, txs []*types.Tx
 }
 
 func processNewTxch(txPool *protocol.TxPool) {
-       newTxCh := txPool.GetMsgCh()
-       for tx := range newTxCh {
-               if tx == nil {
-               }
-       }
 }
 
 func MockSimpleUtxo(index uint64, assetID *bc.AssetID, amount uint64, ctrlProg *account.CtrlProgram) *account.UTXO {
@@ -253,7 +249,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
 }
 
@@ -361,7 +357,7 @@ func CreateTxbyNum(txNumber, otherAssetNum int) ([]*types.Tx, error) {
 
 func SetUtxoView(db dbm.DB, view *state.UtxoViewpoint) error {
        batch := db.NewBatch()
-       if err := leveldb.SaveUtxoView(batch, view); err != nil {
+       if err := database.SaveUtxoView(batch, view); err != nil {
                return err
        }
        batch.Write()