From fc69d42acf636d56e8131f34e482780bd36b645d Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Sun, 7 Apr 2013 16:46:13 -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, 1 insertion(+), 1 deletion(-) diff --git a/addresses.py b/addresses.py index 7b2650df..402f3a7d 100644 --- a/addresses.py +++ b/addresses.py @@ -97,7 +97,7 @@ 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.') + raise Exception("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':