chain: Undo exporting TipSetKey Value
This commit is contained in:
parent
43680400c3
commit
c9e5720f68
@ -38,7 +38,7 @@ type TipSetKey struct {
|
|||||||
// self-describing, wrapped as a string.
|
// self-describing, wrapped as a string.
|
||||||
// These gymnastics make the a TipSetKey usable as a map key.
|
// These gymnastics make the a TipSetKey usable as a map key.
|
||||||
// The empty key has value "".
|
// The empty key has value "".
|
||||||
Value string
|
value string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTipSetKey builds a new key from a slice of CIDs.
|
// NewTipSetKey builds a new key from a slice of CIDs.
|
||||||
@ -59,7 +59,7 @@ func TipSetKeyFromBytes(encoded []byte) (TipSetKey, error) {
|
|||||||
|
|
||||||
// Cids returns a slice of the CIDs comprising this key.
|
// Cids returns a slice of the CIDs comprising this key.
|
||||||
func (k TipSetKey) Cids() []cid.Cid {
|
func (k TipSetKey) Cids() []cid.Cid {
|
||||||
cids, err := decodeKey([]byte(k.Value))
|
cids, err := decodeKey([]byte(k.value))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic("invalid tipset key: " + err.Error())
|
panic("invalid tipset key: " + err.Error())
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ func (k TipSetKey) String() string {
|
|||||||
|
|
||||||
// Bytes() returns a binary representation of the key.
|
// Bytes() returns a binary representation of the key.
|
||||||
func (k TipSetKey) Bytes() []byte {
|
func (k TipSetKey) Bytes() []byte {
|
||||||
return []byte(k.Value)
|
return []byte(k.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k TipSetKey) MarshalJSON() ([]byte, error) {
|
func (k TipSetKey) MarshalJSON() ([]byte, error) {
|
||||||
@ -95,7 +95,7 @@ func (k *TipSetKey) UnmarshalJSON(b []byte) error {
|
|||||||
if err := json.Unmarshal(b, &cids); err != nil {
|
if err := json.Unmarshal(b, &cids); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
k.Value = string(encodeKey(cids))
|
k.value = string(encodeKey(cids))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ func (k *TipSetKey) UnmarshalCBOR(reader io.Reader) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (k TipSetKey) IsEmpty() bool {
|
func (k TipSetKey) IsEmpty() bool {
|
||||||
return len(k.Value) == 0
|
return len(k.value) == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeKey(cids []cid.Cid) []byte {
|
func encodeKey(cids []cid.Cid) []byte {
|
||||||
|
Loading…
Reference in New Issue
Block a user