go-spacemesh
go-spacemesh copied to clipboard
Remove custom EncodeScale/DecodeScale once post library updated
// Post is an alias to postShared.Proof.
type Post postShared.Proof
// EncodeScale implements scale codec interface.
func (p *Post) EncodeScale(enc *scale.Encoder) (total int, err error) {
if n, err := scale.EncodeCompact32(enc, uint32(p.Nonce)); err != nil {
return total, err
} else { // nolint
total += n
}
if n, err := scale.EncodeByteSlice(enc, p.Indices); err != nil {
return total, err
} else { // nolint
total += n
}
return total, nil
}
// DecodeScale implements scale codec interface.
func (p *Post) DecodeScale(dec *scale.Decoder) (total int, err error) {
if field, n, err := scale.DecodeCompact32(dec); err != nil {
return total, err
} else { // nolint
total += n
p.Nonce = uint32(field)
}
if field, n, err := scale.DecodeByteSlice(dec); err != nil {
return total, err
} else { // nolint
total += n
p.Indices = field
}
return total, nil
}
above EncodeScale/DecodeScale methods should be removed once they're enabled for postShared.Proof