OSDN Git Service

fix bug
[bytom/vapor.git] / mining / mining.go
index 97590f5..61dfe03 100644 (file)
@@ -108,7 +108,7 @@ func createCoinbaseTx(accountManager *account.Manager, amount uint64, blockHeigh
 }
 
 // NewBlockTemplate returns a new block template that is ready to be solved
-func NewBlockTemplate(c *protocol.Chain, txPool *protocol.TxPool, accountManager *account.Manager, engine engine.Engine, delegateInfo interface{}) (b *types.Block, err error) {
+func NewBlockTemplate(c *protocol.Chain, txPool *protocol.TxPool, accountManager *account.Manager, engine engine.Engine, delegateInfo interface{}, blockTime uint64) (b *types.Block, err error) {
        view := state.NewUtxoViewpoint()
        txStatus := bc.NewTransactionStatus()
        if err := txStatus.SetStatus(0, false); err != nil {
@@ -127,7 +127,7 @@ func NewBlockTemplate(c *protocol.Chain, txPool *protocol.TxPool, accountManager
                Version:           1,
                Height:            nextBlockHeight,
                PreviousBlockHash: preBlockHash,
-               Timestamp:         uint64(time.Now().Unix()),
+               Timestamp:         blockTime,
                BlockCommitment:   types.BlockCommitment{},
        }