X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=proposal%2Fproposal.go;h=46382e2c196b564c3573adf6a1013f578d3a1b0b;hb=4c43de6c51c2f266b6671cf6ff724aae4ca6c8fa;hp=364d9ffc7600c4f0e27c249136847a011dbdb716;hpb=2d27cad41ef79da3a46142401b5efcf92133ea1a;p=bytom%2Fvapor.git diff --git a/proposal/proposal.go b/proposal/proposal.go index 364d9ffc..46382e2c 100644 --- a/proposal/proposal.go +++ b/proposal/proposal.go @@ -69,7 +69,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) (b *types.Block, err error) { +func NewBlockTemplate(c *protocol.Chain, txPool *protocol.TxPool, accountManager *account.Manager, timestamp uint64) (b *types.Block, err error) { view := state.NewUtxoViewpoint() txStatus := bc.NewTransactionStatus() if err := txStatus.SetStatus(0, false); err != nil { @@ -89,8 +89,9 @@ func NewBlockTemplate(c *protocol.Chain, txPool *protocol.TxPool, accountManager Version: 1, Height: nextBlockHeight, PreviousBlockHash: preBlockHash, - Timestamp: uint64(time.Now().UnixNano() / int64(time.Millisecond)), + Timestamp: timestamp, BlockCommitment: types.BlockCommitment{}, + BlockWitness: types.BlockWitness{Witness: make([][]byte, consensus.NumOfConsensusNode)}, }, } bcBlock := &bc.Block{BlockHeader: &bc.BlockHeader{Height: nextBlockHeight}} @@ -153,7 +154,7 @@ func NewBlockTemplate(c *protocol.Chain, txPool *protocol.TxPool, accountManager b.BlockHeader.BlockCommitment.TransactionStatusHash, err = types.TxStatusMerkleRoot(txStatus.VerifyStatus) - _, err = c.GetBBFT().SignBlock(b) + _, err = c.SignBlock(b) return b, err }