mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
swarm/storage/feed: revert cursor changes
This commit is contained in:
parent
9a847448c5
commit
b4c3ac80cb
3 changed files with 12 additions and 1 deletions
|
|
@ -58,6 +58,7 @@ func (f *Feed) binaryPut(serializedData []byte) error {
|
||||||
cursor += TopicLength
|
cursor += TopicLength
|
||||||
|
|
||||||
copy(serializedData[cursor:cursor+common.AddressLength], f.User[:])
|
copy(serializedData[cursor:cursor+common.AddressLength], f.User[:])
|
||||||
|
cursor += common.AddressLength
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -78,6 +79,7 @@ func (f *Feed) binaryGet(serializedData []byte) error {
|
||||||
cursor += TopicLength
|
cursor += TopicLength
|
||||||
|
|
||||||
copy(f.User[:], serializedData[cursor:cursor+common.AddressLength])
|
copy(f.User[:], serializedData[cursor:cursor+common.AddressLength])
|
||||||
|
cursor += common.AddressLength
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ func (u *ID) binaryPut(serializedData []byte) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
copy(serializedData[cursor:cursor+lookup.EpochLength], epochBytes[:])
|
copy(serializedData[cursor:cursor+lookup.EpochLength], epochBytes[:])
|
||||||
|
cursor += lookup.EpochLength
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +93,12 @@ func (u *ID) binaryGet(serializedData []byte) error {
|
||||||
}
|
}
|
||||||
cursor += feedLength
|
cursor += feedLength
|
||||||
|
|
||||||
return u.Epoch.UnmarshalBinary(serializedData[cursor : cursor+lookup.EpochLength])
|
if err := u.Epoch.UnmarshalBinary(serializedData[cursor : cursor+lookup.EpochLength]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
cursor += lookup.EpochLength
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FromValues deserializes this instance from a string key-value store
|
// FromValues deserializes this instance from a string key-value store
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ func (r *Update) binaryPut(serializedData []byte) error {
|
||||||
|
|
||||||
// add the data
|
// add the data
|
||||||
copy(serializedData[cursor:], r.data)
|
copy(serializedData[cursor:], r.data)
|
||||||
|
cursor += datalength
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -105,12 +106,14 @@ func (r *Update) binaryGet(serializedData []byte) error {
|
||||||
cursor += idLength
|
cursor += idLength
|
||||||
|
|
||||||
data := serializedData[cursor : cursor+dataLength]
|
data := serializedData[cursor : cursor+dataLength]
|
||||||
|
cursor += dataLength
|
||||||
|
|
||||||
// now that all checks have passed, copy data into structure
|
// now that all checks have passed, copy data into structure
|
||||||
r.data = make([]byte, dataLength)
|
r.data = make([]byte, dataLength)
|
||||||
copy(r.data, data)
|
copy(r.data, data)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FromValues deserializes this instance from a string key-value store
|
// FromValues deserializes this instance from a string key-value store
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue