Improve the validator

This commit is contained in:
idk 2019-04-05 21:09:48 -04:00
parent ae5c4f834c
commit 42839924e7

View File

@ -283,9 +283,9 @@ func garlic32BtS(b []byte) (string, error) {
func garlic32Validate(b []byte) error {
// an i2p base64 for an Encrypted Leaseset v2 will be at least 35 bytes
// long
if len(b) > 35 {
// other than that, they will be at least 32 bytes
if len(b) < 32 {
if len(b) < 35 {
// other than that, they will be exactly 32 bytes
if len(b) != 32 {
return fmt.Errorf("failed to validate garlic addr: %s not an i2p base32 address. len: %d\n", b, len(b))
}
}