mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-23 16:21:57 +00:00
Compare commits
3 Commits
jae/litere
...
1394-mempo
Author | SHA1 | Date | |
---|---|---|---|
|
60dd8067ae | ||
|
2cd206e329 | ||
|
71e4870660 |
@@ -247,12 +247,11 @@ func (mem *Mempool) CheckTx(tx types.Tx, cb func(*abci.Response)) (err error) {
|
||||
|
||||
// WAL
|
||||
if mem.wal != nil {
|
||||
var buf bytes.Buffer
|
||||
buf.Write([]byte(tx))
|
||||
buf.Write([]byte("\n"))
|
||||
// TODO: Notify administrators when WAL fails
|
||||
_, err := mem.wal.Write([]byte(tx))
|
||||
if err != nil {
|
||||
mem.logger.Error("Error writing to WAL", "err", err)
|
||||
}
|
||||
_, err = mem.wal.Write([]byte("\n"))
|
||||
_, err := mem.wal.Write(buf.Bytes())
|
||||
if err != nil {
|
||||
mem.logger.Error("Error writing to WAL", "err", err)
|
||||
}
|
||||
|
@@ -90,7 +90,11 @@ func (memR *MempoolReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) {
|
||||
case *TxMessage:
|
||||
err := memR.Mempool.CheckTx(msg.Tx, nil)
|
||||
if err != nil {
|
||||
memR.Logger.Info("Could not check tx", "tx", TxID(msg.Tx), "err", err)
|
||||
if err != ErrTxInCache {
|
||||
memR.Logger.Error("Could not check tx", "tx", TxID(msg.Tx), "err", err)
|
||||
} else {
|
||||
memR.Logger.Debug("Could not check tx", "tx", TxID(msg.Tx), "err", err)
|
||||
}
|
||||
}
|
||||
// broadcasting happens from go routines per peer
|
||||
default:
|
||||
@@ -135,8 +139,8 @@ func (memR *MempoolReactor) broadcastTxRoutine(peer p2p.Peer) {
|
||||
memTx := next.Value.(*mempoolTx)
|
||||
// make sure the peer is up to date
|
||||
height := memTx.Height()
|
||||
if peerState_i := peer.Get(types.PeerStateKey); peerState_i != nil {
|
||||
peerState := peerState_i.(PeerState)
|
||||
if peerStateI := peer.Get(types.PeerStateKey); peerStateI != nil {
|
||||
peerState := peerStateI.(PeerState)
|
||||
peerHeight := peerState.GetHeight()
|
||||
if peerHeight < height-1 { // Allow for a lag of 1 block
|
||||
time.Sleep(peerCatchupSleepIntervalMS * time.Millisecond)
|
||||
|
Reference in New Issue
Block a user