fix: another byte slice disappearance issue

This commit is contained in:
Cassandra Heart 2023-09-26 01:14:26 -05:00
parent 05acdbf56f
commit 836d449177
No known key found for this signature in database
GPG Key ID: 6352152859385958

View File

@ -123,7 +123,8 @@ func (p *PebbleMasterClockIterator) Value() (*protobufs.ClockFrame, error) {
} }
frame.FrameNumber = frameNumber frame.FrameNumber = frameNumber
frame.Filter = filter frame.Filter = make([]byte, len(filter))
copy(frame.Filter, filter)
if len(value) < 521 { if len(value) < 521 {
return nil, errors.Wrap( return nil, errors.Wrap(
@ -132,9 +133,12 @@ func (p *PebbleMasterClockIterator) Value() (*protobufs.ClockFrame, error) {
) )
} }
frame.Difficulty = binary.BigEndian.Uint32(value[:4]) copied := make([]byte, len(value))
frame.Input = value[4 : len(value)-516] copy(copied, value)
frame.Output = value[len(value)-516:]
frame.Difficulty = binary.BigEndian.Uint32(copied[:4])
frame.Input = copied[4 : len(copied)-516]
frame.Output = copied[len(copied)-516:]
previousSelectorBytes := [516]byte{} previousSelectorBytes := [516]byte{}
copy(previousSelectorBytes[:], frame.Input[:516]) copy(previousSelectorBytes[:], frame.Input[:516])