mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-16 10:28:49 -07:00
lib/protocol: Zero pad index ID strings
This commit is contained in:
parent
1bd4ea0cbb
commit
e053db6a5e
@ -324,7 +324,7 @@ func (b BlockInfo) IsEmpty() bool {
|
|||||||
type IndexID uint64
|
type IndexID uint64
|
||||||
|
|
||||||
func (i IndexID) String() string {
|
func (i IndexID) String() string {
|
||||||
return fmt.Sprintf("0x%16X", uint64(i))
|
return fmt.Sprintf("0x%016X", uint64(i))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i IndexID) Marshal() ([]byte, error) {
|
func (i IndexID) Marshal() ([]byte, error) {
|
||||||
|
@ -915,3 +915,11 @@ func TestBlocksEqual(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIndexIDString(t *testing.T) {
|
||||||
|
// Index ID is a 64 bit, zero padded hex integer.
|
||||||
|
var i IndexID = 42
|
||||||
|
if i.String() != "0x000000000000002A" {
|
||||||
|
t.Error(i.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user