From 3657f2e21d1017a588a36c20c7b5f488522a94ef Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 20 Apr 2020 10:57:09 +0300 Subject: [PATCH] consensus: set Nonce and ValidUntilBlock on proposal Related #841. --- pkg/consensus/consensus.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/consensus/consensus.go b/pkg/consensus/consensus.go index 116dcbedc..fdfad81d0 100644 --- a/pkg/consensus/consensus.go +++ b/pkg/consensus/consensus.go @@ -2,6 +2,7 @@ package consensus import ( "errors" + "math/rand" "sort" "time" @@ -348,7 +349,9 @@ func (s *service) verifyBlock(b block.Block) bool { coreb := &b.(*neoBlock).Block for _, tx := range coreb.Transactions { if err := s.Chain.VerifyTx(tx, coreb); err != nil { - s.log.Warn("invalid transaction in proposed block", zap.Stringer("hash", tx.Hash())) + s.log.Warn("invalid transaction in proposed block", + zap.Stringer("hash", tx.Hash()), + zap.Error(err)) return false } } @@ -462,6 +465,8 @@ func (s *service) getVerifiedTx(count int) []block.Transaction { for { minerTx := transaction.NewMinerTX() minerTx.Outputs = txOuts + minerTx.ValidUntilBlock = s.dbft.BlockIndex + minerTx.Nonce = rand.Uint32() res[0] = minerTx if tx, _, _ := s.Chain.GetTransaction(res[0].Hash()); tx == nil {