diff --git a/server.go b/server.go index ee6c213a..a237b31b 100644 --- a/server.go +++ b/server.go @@ -839,7 +839,6 @@ func (sp *serverPeer) OnGetCFHeaders(_ *peer.Peer, msg *wire.MsgGetCFHeaders) { // Generate cfheaders message and send it. headersMsg := wire.NewMsgCFHeaders() - var header chainhash.Hash for i := range hashList { // Fetch the raw committed filter header bytes from the // database. @@ -852,6 +851,7 @@ func (sp *serverPeer) OnGetCFHeaders(_ *peer.Peer, msg *wire.MsgGetCFHeaders) { } // Deserialize the hash. + var header chainhash.Hash err = header.SetBytes(headerBytes) if err != nil { peerLog.Warnf("Committed filter header deserialize "+ diff --git a/wire/msgcfheaders.go b/wire/msgcfheaders.go index 411bf8f1..3b9266b1 100644 --- a/wire/msgcfheaders.go +++ b/wire/msgcfheaders.go @@ -60,9 +60,9 @@ func (msg *MsgCFHeaders) BtcDecode(r io.Reader, pver uint32) error { // Create a contiguous slice of headers to deserialize into in order to // reduce the number of allocations. - var cfh chainhash.Hash msg.HeaderHashes = make([]*chainhash.Hash, 0, count) for i := uint64(0); i < count; i++ { + var cfh chainhash.Hash err := readElement(r, &cfh) if err != nil { return err