Browse Source

make crc32c a global var

change echo format in build.sh script
pull/672/head
Anton Kaliaev 7 years ago
parent
commit
31030c6514
No known key found for this signature in database GPG Key ID: 7B6881D965918214
2 changed files with 2 additions and 2 deletions
  1. +2
    -1
      consensus/replay.go
  2. +0
    -1
      consensus/wal.go

+ 2
- 1
consensus/replay.go View File

@ -23,6 +23,8 @@ import (
"github.com/tendermint/tendermint/version"
)
var crc32c = crc32.MakeTable(crc32.Castagnoli)
// Functionality to replay blocks and messages on recovery from a crash.
// There are two general failure scenarios: failure during consensus, and failure while applying the block.
// The former is handled by the WAL, the latter by the proxyApp Handshake on restart,
@ -50,7 +52,6 @@ func (cs *ConsensusState) readReplayMessage(msgBytes []byte, newStepCh chan inte
}
// check checksum
innerMsgBytes := wire.JSONBytes(msg.Msg)
crc32c := crc32.MakeTable(crc32.Castagnoli)
crc := crc32.Checksum(innerMsgBytes, crc32c)
if crc != msg.CRC {
return fmt.Errorf("Checksums do not match. Original: %v, but calculated: %v", msg.CRC, crc)


+ 0
- 1
consensus/wal.go View File

@ -87,7 +87,6 @@ func (wal *WAL) Save(wmsg WALMessage) {
}
// Write the wal message
innerMsgBytes := wire.JSONBytes(wmsg)
crc32c := crc32.MakeTable(crc32.Castagnoli)
crc := crc32.Checksum(innerMsgBytes, crc32c)
wmsgSize := uint32(len(innerMsgBytes))
var wmsgBytes = wire.JSONBytes(TimedWALMessage{time.Now(), crc, wmsgSize, wmsg})


Loading…
Cancel
Save