make crc32c a global var

change echo format in build.sh script
This commit is contained in:
Anton Kaliaev
2017-09-26 09:51:08 +03:00
parent 7b8ffc9981
commit 31030c6514
2 changed files with 2 additions and 2 deletions

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)

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})