From ad73c0d4e73fe138ebbbc39d6a335167ba7c9923 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sun, 9 Oct 2016 23:41:48 +0200 Subject: [PATCH] fix ecdsa_address_decode --- ecdsa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ecdsa.c b/ecdsa.c index bbf361053e..fe73c48666 100644 --- a/ecdsa.c +++ b/ecdsa.c @@ -936,9 +936,9 @@ int ecdsa_address_decode(const char *addr, uint32_t version, uint8_t *out) if (version <= 0xFF) { return base58_decode_check(addr, out, 21) == 21 && out[0] == (version & 0xFF); } else if (version <= 0xFFFF) { - return base58_decode_check(addr, out, 22) == 22 && out[0] == ((version >> 8)) && out[1] == (version & 0xFF); - } else if (version <= 0xFFFF) { - return base58_decode_check(addr, out, 23) == 23 && out[0] == ((version >> 16)) && out[1] == ((version >> 8) & 0xFF) && out[2] == (version & 0xFF); + return base58_decode_check(addr, out, 22) == 22 && out[0] == ((version >> 8) & 0xFF) && out[1] == (version & 0xFF); + } else if (version <= 0xFFFFFF) { + return base58_decode_check(addr, out, 23) == 23 && out[0] == ((version >> 16) & 0xFF) && out[1] == ((version >> 8) & 0xFF) && out[2] == (version & 0xFF); } else { return base58_decode_check(addr, out, 24) == 24 && out[0] == (version >> 24) && out[1] == ((version >> 16) & 0xFF) && out[2] == ((version >> 8) & 0xFF) && out[3] == (version & 0xFF); }