Skip to content
Snippets Groups Projects
Commit 71dddfb1 authored by Moul's avatar Moul
Browse files

[mod] #237: Move back to ':' pubkey and checksum delimiter

Update parsing, help. Change word
parent 7cc9116d
No related branches found
No related tags found
2 merge requests!146Merge dev into master branch to complete v0.8.0 development cycle,!132Multiple enhancements
...@@ -22,7 +22,7 @@ from silkaj.constants import PUBKEY_PATTERN ...@@ -22,7 +22,7 @@ from silkaj.constants import PUBKEY_PATTERN
PUBKEY_DELIMITED_PATTERN = "^{0}$".format(PUBKEY_PATTERN) PUBKEY_DELIMITED_PATTERN = "^{0}$".format(PUBKEY_PATTERN)
CHECKSUM_PATTERN = "[1-9A-HJ-NP-Za-km-z]{3}" CHECKSUM_PATTERN = "[1-9A-HJ-NP-Za-km-z]{3}"
PUBKEY_CHECKSUM_PATTERN = "^{0}!{1}$".format(PUBKEY_PATTERN, CHECKSUM_PATTERN) PUBKEY_CHECKSUM_PATTERN = "^{0}:{1}$".format(PUBKEY_PATTERN, CHECKSUM_PATTERN)
def check_public_key(pubkey, display_error): def check_public_key(pubkey, display_error):
...@@ -34,7 +34,7 @@ def check_public_key(pubkey, display_error): ...@@ -34,7 +34,7 @@ def check_public_key(pubkey, display_error):
if re.search(re.compile(PUBKEY_DELIMITED_PATTERN), pubkey): if re.search(re.compile(PUBKEY_DELIMITED_PATTERN), pubkey):
return pubkey return pubkey
elif re.search(re.compile(PUBKEY_CHECKSUM_PATTERN), pubkey): elif re.search(re.compile(PUBKEY_CHECKSUM_PATTERN), pubkey):
pubkey, checksum = pubkey.split("!") pubkey, checksum = pubkey.split(":")
pubkey_byte = b58_decode(pubkey) pubkey_byte = b58_decode(pubkey)
checksum_calculed = b58_encode( checksum_calculed = b58_encode(
hash.sha256( hash.sha256(
...@@ -44,7 +44,7 @@ def check_public_key(pubkey, display_error): ...@@ -44,7 +44,7 @@ def check_public_key(pubkey, display_error):
if checksum_calculed == checksum: if checksum_calculed == checksum:
return pubkey return pubkey
else: else:
print("Error: bad checksum for following public key:") print("Error: Wrong checksum for following public key:")
return False return False
elif display_error: elif display_error:
......
...@@ -76,7 +76,7 @@ from duniterpy.documents.transaction import OutputSource, Unlock, SIGParameter ...@@ -76,7 +76,7 @@ from duniterpy.documents.transaction import OutputSource, Unlock, SIGParameter
"-r", "-r",
multiple=True, multiple=True,
required=True, required=True,
help="Pubkey(s)’ recipients + optional checksum:\n-r <pubkey>[!checksum]\n\ help="Pubkey(s)’ recipients + optional checksum:\n-r <pubkey>[:checksum]\n\
Sending to many recipients is possible:\n\ Sending to many recipients is possible:\n\
* With one amount, all will receive the amount\n\ * With one amount, all will receive the amount\n\
* With many amounts (one per recipient)", * With many amounts (one per recipient)",
...@@ -84,7 +84,7 @@ Sending to many recipients is possible:\n\ ...@@ -84,7 +84,7 @@ Sending to many recipients is possible:\n\
@option("--comment", "-c", default="", help="Comment") @option("--comment", "-c", default="", help="Comment")
@option( @option(
"--outputBackChange", "--outputBackChange",
help="Pubkey recipient to send the rest of the transaction: <pubkey[!checksum]>", help="Pubkey recipient to send the rest of the transaction: <pubkey[:checksum]>",
) )
@option("--yes", "-y", is_flag=True, help="Assume yes. Do not prompt confirmation") @option("--yes", "-y", is_flag=True, help="Assume yes. Do not prompt confirmation")
@coroutine @coroutine
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment