Commit 0f0bfcad authored by matograine's avatar matograine

debug if no passwords given

parent c76e1dab
Pipeline #7257 failed with stage
in 36 seconds
......@@ -61,7 +61,7 @@ def unlock_conditions(unlock, pubkey, timestamp_now, timestamp_block="0", passwo
CLTV_list = findall("CLTV\(" + regex_csv_cltv + "\)", unlock)
XHX_list = findall("XHX\(" + HASH_REGEX + "\)", unlock)
print ("DEBUG : unlock : " + unlock )
# print ("DEBUG : unlock : " + unlock )
for SIG in SIG_list:
if SIG == "SIG(" + pubkey + ")":
......@@ -79,7 +79,7 @@ def unlock_conditions(unlock, pubkey, timestamp_now, timestamp_block="0", passwo
unlock = unlock.replace(CSV, "True")
unlock = unlock.replace(CSV, "False")
for XHX in XHX_list:
print("DEBUG : passwords : " + "".join(passwords))
#print("DEBUG : passwords : " + "".join(passwords))
# print ("DEBUG : XHX_list : " + "".join(XHX_list))
pw = search(HASH_REGEX, XHX).group()
for password in passwords:
......@@ -94,7 +94,7 @@ def unlock_conditions(unlock, pubkey, timestamp_now, timestamp_block="0", passwo
u_password = try_password
# might be source of a bug if a tx contains several XHX unlock conditions
unlock = unlock.replace(XHX, "True")
print("DEBUG : XHX passé")
#print("DEBUG : XHX passé")
unlock = unlock.replace(XHX, "False")
# print ("DEBUG : eval_unlock : " + unlock)
if eval(unlock):
......
......@@ -275,8 +275,8 @@ async def get_locked_sources(pubkey, passwords=[]):
sources = await client(tx.sources, pubkey)
history = await client(tx.history, pubkey)
history = history["history"]
print ("DEBUG : blockchain_current_time : " + str(timestamp_now))
print ("DEBUG : passwords in get_loked_sources : " + "".join(passwords))
# print ("DEBUG : blockchain_current_time : " + str(timestamp_now))
# print ("DEBUG : passwords in get_loked_sources : " + "".join(passwords))
for source in sources["sources"]:
timestamp_block = source_time(history, source["identifier"])
# print ("DEBUG : delay : " + str(timestamp_now - timestamp_block))
......@@ -285,7 +285,7 @@ async def get_locked_sources(pubkey, passwords=[]):
unlock_password = unlock_conditions(
source["conditions"], pubkey, timestamp_now, timestamp_block, passwords
)
print ("DEBUG : unlock_password : " + str(unlock_password))
# print ("DEBUG : unlock_password : " + str(unlock_password))
if unlock_password:
amount = add_to_listinput(listinput, amount, source)
listunlocks.append(
......
......@@ -50,16 +50,15 @@ async def unlock_locked_sources(
"""
Main function
"""
if passwords :
password_list = check_password(passwords)
print ("DEBUG : passwords : " + "".join(password_list))
password_list = check_password(passwords)
#print ("DEBUG : passwords : " + "".join(password_list))
key = auth_method()
issuer_pubkey = key.pubkey
comment, outputbackchange = "", ""
# get available and unavailable locked amount
inputs = await get_locked_amount_from_pubkey(issuer_pubkey, password_list)
tx_amount, used_passwords, locked_amount = inputs[0], inputs[2], inputs[3]
print ("DEBUG : used_passwords : " + "".join(used_passwords))
#print ("DEBUG : used_passwords : " + "".join(used_passwords))
if tx_amount == 0:
message_exit(
"No source to unlock for key : "
......@@ -102,6 +101,8 @@ async def unlock_locked_sources(
def check_password(password):
if not password :
return list()
list_password = list()
password_list = password.split(":")
for password in password_list:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment