OSDN Git Service

remove unuse parameter
authorshenao78 <shenao.78@163.com>
Thu, 31 Oct 2019 03:08:41 +0000 (11:08 +0800)
committershenao78 <shenao.78@163.com>
Thu, 31 Oct 2019 03:08:41 +0000 (11:08 +0800)
proposal/blockproposer/blockproposer.go
proposal/proposal.go
test/bench_blockchain_test.go
test/performance/mining_test.go

index 71063cc..7cfe24e 100644 (file)
@@ -74,7 +74,7 @@ func (b *BlockProposer) generateBlocks() {
                        continue
                }
 
-               block, err := proposal.NewBlockTemplate(b.chain, b.txPool, b.accountManager, nextBlockTime)
+               block, err := proposal.NewBlockTemplate(b.chain, b.accountManager, nextBlockTime)
                if err != nil {
                        log.WithFields(log.Fields{"module": logModule, "error": err}).Error("failed on create NewBlockTemplate")
                        continue
index 9d22d86..e27e7a6 100644 (file)
@@ -91,7 +91,7 @@ func createCoinbaseTxByReward(accountManager *account.Manager, blockHeight uint6
 }
 
 // NewBlockTemplate returns a new block template that is ready to be solved
-func NewBlockTemplate(chain *protocol.Chain, txPool *protocol.TxPool, accountManager *account.Manager, timestamp uint64) (*types.Block, error) {
+func NewBlockTemplate(chain *protocol.Chain, accountManager *account.Manager, timestamp uint64) (*types.Block, error) {
        block := createBasicBlock(chain, timestamp)
 
        view := state.NewUtxoViewpoint()
index 72752d7..40365d0 100644 (file)
@@ -159,7 +159,7 @@ func InsertChain(chain *protocol.Chain, txPool *protocol.TxPool, txs []*types.Tx
                }
        }
 
-       block, err := proposal.NewBlockTemplate(chain, txPool, nil, uint64(time.Now().UnixNano()/1e6))
+       block, err := proposal.NewBlockTemplate(chain, nil, uint64(time.Now().UnixNano()/1e6))
        if err != nil {
                return err
        }
index 0f3f0d6..b8cbfef 100644 (file)
@@ -17,7 +17,7 @@ func BenchmarkNewBlockTpl(b *testing.B) {
        testDB := dbm.NewDB("testdb", "leveldb", "temp")
        defer os.RemoveAll("temp")
 
-       chain, _, txPool, err := test.MockChain(testDB)
+       chain, _, _, err := test.MockChain(testDB)
        if err != nil {
                b.Fatal(err)
        }
@@ -26,6 +26,6 @@ func BenchmarkNewBlockTpl(b *testing.B) {
 
        b.ResetTimer()
        for i := 0; i < b.N; i++ {
-               proposal.NewBlockTemplate(chain, txPool, accountManager, uint64(time.Now().UnixNano()/1e6))
+               proposal.NewBlockTemplate(chain, accountManager, uint64(time.Now().UnixNano()/1e6))
        }
 }