Skip to content
Snippets Groups Projects
Commit 664c4430 authored by Moul's avatar Moul
Browse files

[fix] #323: Handle recipients pubkey with a checksum

Passed pubkeys with a checksum wasn't returned without the checksum

recipient/outputAddresses: Click stores the arguments in a tuple which
is immutable. Convert it to a list in order to be able to change it.
Though it is not necessary to return the value since it's a list.

outputAddresses: use enumerate in order to assign the pubkeys without the
checksum

ouputBackChange: remove duplicate call to check_public_key()
store pubkey in case it get erased by a boolean
Return the value as a string is not a pointer and does not get modified
in the parent scope as a list or a dict.

Add comments in check_transaction_values()

This feature was broken and forgotten since v0.5.0 release
parent 2fa97766
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
Pipeline #9365 passed
......@@ -111,7 +111,8 @@ async def send_transaction(
if allsources:
tx_amounts = [pubkey_amount[0]]
check_transaction_values(
recipients = list(recipients)
outputbackchange = check_transaction_values(
comment,
recipients,
outputbackchange,
......@@ -189,18 +190,27 @@ def compute_amounts(amounts, multiplicator):
def check_transaction_values(
comment, outputAddresses, outputBackChange, enough_source, issuer_pubkey
):
"""
Check the comment format
Check the pubkeys and the checksums of the recipients and the outputbackchange
In case of a valid checksum, assign and return the pubkey without the checksum
Check the balance is big enough for the transaction
"""
checkComment(comment)
for outputAddress in outputAddresses:
if check_public_key(outputAddress, True) is False:
for i, outputAddress in enumerate(outputAddresses):
outputAddresses[i] = check_public_key(outputAddress, True)
if not outputAddresses[i]:
message_exit(outputAddress)
if outputBackChange:
pubkey = outputBackChange
outputBackChange = check_public_key(outputBackChange, True)
if check_public_key(outputBackChange, True) is False:
message_exit(outputBackChange)
if not outputBackChange:
message_exit(pubkey)
if enough_source:
message_exit(
issuer_pubkey + " pubkey doesn’t have enough money for this transaction."
)
return outputBackChange
async def transaction_confirmation(
......
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