mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-28 17:02:32 +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
|
||||
// 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user