diff --git a/blockchain/chainio.go b/blockchain/chainio.go index c456c006..f40ba465 100644 --- a/blockchain/chainio.go +++ b/blockchain/chainio.go @@ -120,7 +120,7 @@ func dbFetchVersion(dbTx database.Tx, key []byte) uint32 { return 0 } - return byteOrder.Uint32(serialized[:]) + return byteOrder.Uint32(serialized) } // dbPutVersion uses an existing database transaction to update the provided @@ -943,7 +943,7 @@ func serializeBestChainState(state bestChainState) []byte { byteOrder.PutUint32(serializedData[offset:], workSumBytesLen) offset += 4 copy(serializedData[offset:], workSumBytes) - return serializedData[:] + return serializedData } // deserializeBestChainState deserializes the passed serialized best chain diff --git a/database/ffldb/blockio.go b/database/ffldb/blockio.go index 3d7782f9..8fb27ab2 100644 --- a/database/ffldb/blockio.go +++ b/database/ffldb/blockio.go @@ -474,7 +474,7 @@ func (s *blockStore) writeBlock(rawBlock []byte) (blockLocation, error) { _, _ = hasher.Write(scratch[:]) // Serialized block. - if err := s.writeData(rawBlock[:], "block"); err != nil { + if err := s.writeData(rawBlock, "block"); err != nil { return blockLocation{}, err } _, _ = hasher.Write(rawBlock) diff --git a/wire/fixedIO_test.go b/wire/fixedIO_test.go index 731c4638..ccd67ae4 100644 --- a/wire/fixedIO_test.go +++ b/wire/fixedIO_test.go @@ -68,7 +68,7 @@ func (fr *fixedReader) Read(p []byte) (n int, err error) { func newFixedReader(max int, buf []byte) io.Reader { b := make([]byte, max) if buf != nil { - copy(b[:], buf) + copy(b, buf) } iobuf := bytes.NewBuffer(b) diff --git a/wire/message.go b/wire/message.go index fe45a11f..eae1cf88 100644 --- a/wire/message.go +++ b/wire/message.go @@ -401,7 +401,7 @@ func ReadMessageWithEncodingN(r io.Reader, pver uint32, btcnet BitcoinNet, // Test checksum. checksum := chainhash.DoubleHashB(payload)[0:4] - if !bytes.Equal(checksum[:], hdr.checksum[:]) { + if !bytes.Equal(checksum, hdr.checksum[:]) { str := fmt.Sprintf("payload checksum failed - header "+ "indicates %v, but actual checksum is %v.", hdr.checksum, checksum)