From 8000d7d73346bba9b299bd95b7fba30c080e52be Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Sun, 7 Apr 2013 16:23:19 -0400 Subject: [PATCH] Show error if encodeAddress function is given a RIPE hash that is not 20 bytes long --- addresses.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addresses.py b/addresses.py index 65c2bf66..7b2650df 100644 --- a/addresses.py +++ b/addresses.py @@ -96,6 +96,8 @@ def calculateInventoryHash(data): def encodeAddress(version,stream,ripe): if version >= 2: + if len(ripe) != 20: + sys.stderr.write('Programming error in encodeAddress: The length of a given ripe hash was not 20.') if ripe[:2] == '\x00\x00': ripe = ripe[2:] elif ripe[:1] == '\x00':