mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-29 01:12:35 +00:00
wire: Fix MsgCFHeaders.Decode()
This commit is contained in:
parent
29b5ece196
commit
71ccc95502
@ -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
|
// Create a contiguous slice of headers to deserialize into in order to
|
||||||
// reduce the number of allocations.
|
// reduce the number of allocations.
|
||||||
headers := make([]chainhash.Hash, count)
|
var cfh chainhash.Hash
|
||||||
msg.HeaderHashes = make([]*chainhash.Hash, 0, count)
|
msg.HeaderHashes = make([]*chainhash.Hash, 0, count)
|
||||||
for i := uint64(0); i < count; i++ {
|
for i := uint64(0); i < count; i++ {
|
||||||
cfh := &headers[i]
|
|
||||||
err := readElement(r, &cfh)
|
err := readElement(r, &cfh)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
msg.AddCFHeader(cfh)
|
msg.AddCFHeader(&cfh)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user