wire: Fix MsgCFHeaders.Decode()

This commit is contained in:
Alex 2017-03-08 17:11:00 -08:00 committed by Olaoluwa Osuntokun
parent 29b5ece196
commit 71ccc95502

View file

@ -60,15 +60,14 @@ 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.
headers := make([]chainhash.Hash, count)
var cfh chainhash.Hash
msg.HeaderHashes = make([]*chainhash.Hash, 0, count)
for i := uint64(0); i < count; i++ {
cfh := &headers[i]
err := readElement(r, &cfh)
if err != nil {
return err
}
msg.AddCFHeader(cfh)
msg.AddCFHeader(&cfh)
}
return nil