diff --git a/blockchain/utxopool.go b/blockchain/utxopool.go index b978b0946..0aa57e0f1 100644 --- a/blockchain/utxopool.go +++ b/blockchain/utxopool.go @@ -9,6 +9,7 @@ import ( "github.com/dedis/kyber/sign/schnorr" "github.com/simple-rules/harmony-benchmark/crypto" "github.com/simple-rules/harmony-benchmark/log" + "math/rand" "sync" ) @@ -408,6 +409,9 @@ func (utxoPool *UTXOPool) SelectTransactionsForNewBlock(transactions []*Transact err, crossShard := utxoPool.VerifyOneTransaction(tx, &spentTXOs) if len(selected) < maxNumTxs { + if err != nil && rand.Intn(10) < 1 { + log.Warn("Invalid Transaction", "Reason", err) + } if err == nil || crossShard { if crossShard { proof := CrossShardTxProof{Accept: err == nil, TxID: tx.ID, TxInput: getShardTxInput(tx, utxoPool.ShardID)} diff --git a/client/client.go b/client/client.go index 7ec150183..0c287a39d 100644 --- a/client/client.go +++ b/client/client.go @@ -61,7 +61,7 @@ func (client *Client) handleProofOfLockMessage(proofs *[]blockchain.CrossShardTx //fmt.Printf("PENDING CLIENT TX - %d\n", len(client.PendingCrossTxs)) // Loop through the newly received list of proofs client.PendingCrossTxsMutex.Lock() - log.Info("CLIENT PENDING TX", "num", len(client.PendingCrossTxs)) + log.Info("CLIENT PENDING CROSS TX", "num", len(client.PendingCrossTxs)) for _, proof := range *proofs { // Find the corresponding pending cross tx txAndProofs, ok := client.PendingCrossTxs[proof.TxID] diff --git a/consensus/consensus_leader.go b/consensus/consensus_leader.go index c824e7425..d1939479d 100644 --- a/consensus/consensus_leader.go +++ b/consensus/consensus_leader.go @@ -168,6 +168,7 @@ func (consensus *Consensus) processCommitMessage(payload []byte, targetState Con point := crypto.Ed25519Curve.Point() point.UnmarshalBinary(commitment) (*commitments)[validatorId] = point + consensus.Log.Debug("Received new commit message", "num", len(*commitments)) // Set the bitmap indicate this validate signed. TODO: figure out how to resolve the inconsistency of validators from commit and response messages bitmap.SetKey(value.PubKey, true) } @@ -177,7 +178,7 @@ func (consensus *Consensus) processCommitMessage(payload []byte, targetState Con } if len((*commitments)) >= len(consensus.publicKeys) && consensus.state < targetState { - consensus.Log.Debug("Enough commitments received with signatures", "num", len((*commitments)), "state", consensus.state) + consensus.Log.Debug("Enough commitments received with signatures", "num", len(*commitments), "state", consensus.state) // Broadcast challenge msgTypeToSend := proto_consensus.CHALLENGE // targetState == CHALLENGE_DONE @@ -297,6 +298,7 @@ func (consensus *Consensus) processResponseMessage(payload []byte, targetState C shouldProcess = false } else { (*responses)[validatorId] = responseScalar + consensus.Log.Debug("Received new response message", "num", len(*responses)) // Set the bitmap indicate this validate signed. TODO: figure out how to resolve the inconsistency of validators from commit and response messages consensus.bitmap.SetKey(value.PubKey, true) } diff --git a/consensus/consensus_validator.go b/consensus/consensus_validator.go index bf0dfb487..63ac9c614 100644 --- a/consensus/consensus_validator.go +++ b/consensus/consensus_validator.go @@ -27,6 +27,7 @@ func (consensus *Consensus) ProcessMessageValidator(message []byte) { consensus.Log.Error("Failed to get consensus message payload", "err", err, "consensus", consensus) } + consensus.Log.Info("Received consensus Message", "type", msgType) switch msgType { case proto_consensus.ANNOUNCE: consensus.processAnnounceMessage(payload) @@ -68,8 +69,6 @@ func (consensus *Consensus) processAnnounceMessage(payload []byte) { offset += 64 //#### END: Read payload data - consensus.Log.Info("Received Announce Message", "LeaderId", leaderId) - copy(consensus.blockHash[:], blockHash[:]) // Verify block data