Skip to content

Commit

Permalink
fix log
Browse files Browse the repository at this point in the history
  • Loading branch information
chengzhinei committed Jan 28, 2023
1 parent 0fdfab9 commit 223dac3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 34 deletions.
7 changes: 4 additions & 3 deletions libs/tendermint/consensus/consensus_context.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package consensus

import (
"os"
"time"

"github.com/okex/exchain/libs/tendermint/delta"
redis_cgi "github.com/okex/exchain/libs/tendermint/delta/redis-cgi"
"github.com/okex/exchain/libs/tendermint/delta/redis-cgi"
"github.com/okex/exchain/libs/tendermint/libs/log"
"github.com/okex/exchain/libs/tendermint/types"
"github.com/spf13/viper"
"os"
"time"
)

type BlockContext struct {
Expand Down
9 changes: 2 additions & 7 deletions libs/tendermint/consensus/consensus_main_routine.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ func (cs *State) handleAVCProposal(proposal *types.Proposal) {
if !bytes.Equal(proposal.BlockID.PartsHeader.Hash, res.blockParts.Header().Hash) || proposal.Height != res.block.Height {
return
}
//blockBytes, err := res.block.Marshal()
//if err != nil {
// return
//}
//cs.blockCtx.deltaBroker.SetBlock(res.block.Height, cs.Round, blockBytes)
pi := ProposalBlockMessage{proposal, res.block}
cs.blockCtx.deltaBroker.Pub(pi.Marshal())
cs.sendInternalMessage(msgInfo{&ProposalMessage{proposal}, ""})
Expand Down Expand Up @@ -189,7 +184,7 @@ func (cs *State) handleMsg(mi msgInfo) (added bool) {
cs.ProposalBlock = msg.Block
cs.trc.Pin("recvBlock")
cs.finishReceiveBlock(msg.Block.Height)
cs.Logger.Error("GetBlockRedis", "height", msg.Proposal.Height, "time", tmtime.Now())
cs.Logger.Info("GetBlockRedis", "height", msg.Proposal.Height, "time", tmtime.Now())
case *BlockPartMessage:
// if avc and has 2/3 votes, it can use the blockPartsHeader from votes
if cs.HasVC && cs.ProposalBlockParts == nil && cs.Round == 0 {
Expand Down Expand Up @@ -218,7 +213,7 @@ func (cs *State) handleMsg(mi msgInfo) (added bool) {
cs.trc.Pin("lastPart")
cs.bt.onRecvBlock(msg.Height)
cs.bt.totalParts = cs.ProposalBlockParts.Total()
cs.Logger.Error("GetBlockP2P", "height", msg.Height, "time", tmtime.Now())
cs.Logger.Info("GetBlockP2P", "height", msg.Height, "time", tmtime.Now())

if cs.ProposalBlock == nil {
err = cs.unmarshalBlock()
Expand Down
5 changes: 0 additions & 5 deletions libs/tendermint/consensus/consensus_propose.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,6 @@ func (cs *State) defaultDecideProposal(height int64, round int) {
if block == nil {
return
}
//blockBytes, err := block.Marshal()
//if err != nil {
// return
//}
//cs.blockCtx.deltaBroker.SetBlock(block.Height, cs.Round, blockBytes)
}

// Flush the WAL. Otherwise, we may not recompute the same proposal to sign,
Expand Down
19 changes: 0 additions & 19 deletions libs/tendermint/consensus/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1104,31 +1104,12 @@ func (conR *Reactor) getBlockRoutine() {
ctx := conR.conS.blockCtx
subChan := ctx.deltaBroker.SubChannel().Channel()
for msg := range subChan {
//block := &types.Block{}
//if err := block.Unmarshal([]byte(msg.Payload)); err == nil {
// conR.conS.peerMsgQueue <- msgInfo{&BlockMessage{Height: rs.Height, Round: rs.Round, Block: block}, ""}
//}
pbm := &ProposalBlockMessage{}
if err := pbm.Unmarshal([]byte(msg.Payload)); err == nil {
conR.Logger.Debug("Block from Redis:", "chan", msg.Channel, "height", pbm.Proposal.Height)
conR.conS.peerMsgQueue <- msgInfo{pbm, ""}
}
}
//var hasHeight int64 = 0
//for {
// rs := conR.getRoundState()
// if hasHeight < rs.Height {
// if blockBytes, _ := ctx.deltaBroker.GetBlock(rs.Height, rs.Round); blockBytes != nil {
// hasHeight = rs.Height
// block := &types.Block{}
// if err := block.Unmarshal(blockBytes); err == nil {
// conR.conS.peerMsgQueue <- msgInfo{&BlockMessage{Height: rs.Height, Round: rs.Round, Block: block}, ""}
// }
// }
// }
//
// time.Sleep(conR.conS.config.PeerGossipSleepDuration)
//}
}

func (conR *Reactor) peerStatsRoutine() {
Expand Down

0 comments on commit 223dac3

Please sign in to comment.