Update handling for deployment requests with auction
This commit is contained in:
parent
b59c2ee4be
commit
1a55bc4df3
@ -584,40 +584,49 @@ def command( # noqa: C901
|
|||||||
requests_to_check_for_payment.append(r)
|
requests_to_check_for_payment.append(r)
|
||||||
|
|
||||||
requests_to_execute = []
|
requests_to_execute = []
|
||||||
if min_required_payment:
|
for r in requests_to_check_for_payment:
|
||||||
for r in requests_to_check_for_payment:
|
# Check if auction id is set
|
||||||
if (not r.attributes.payment) and r.attributes.auction:
|
if r.attributes.auction:
|
||||||
if not auction_requests:
|
if auction_requests:
|
||||||
main_logger.log(f"Skipping request {r.id}: not handling requests with auction.")
|
# Check if the deployer payment address is an auction winner
|
||||||
|
auction_id = r.attributes.auction
|
||||||
|
auction = laconic.get_auction(auction_id)
|
||||||
|
if not auction:
|
||||||
|
main_logger.log(
|
||||||
|
f"Skipping request {r.id}: unable to locate auction: {auction_id}"
|
||||||
|
)
|
||||||
dump_known_requests(state_file, [r], status="SKIP")
|
dump_known_requests(state_file, [r], status="SKIP")
|
||||||
else:
|
elif payment_address in auction.winnerAddresses:
|
||||||
# Check if we are in auction winners
|
main_logger.log(f"{r.id}: auction winnner address confirmed.")
|
||||||
auction_id = r.attributes.auction
|
|
||||||
auction = laconic.get_auction(auction_id)
|
|
||||||
if not auction:
|
|
||||||
raise Exception(f"Unable to locate auction: {auction_id}")
|
|
||||||
|
|
||||||
if payment_address in auction.winnerAddresses:
|
|
||||||
main_logger.log(f"{r.id}: Auction winnner address confirmed.")
|
|
||||||
requests_to_execute.append(r)
|
|
||||||
else:
|
|
||||||
main_logger.log(f"{r.id}: Confirming payment...")
|
|
||||||
if confirm_payment(
|
|
||||||
laconic,
|
|
||||||
r,
|
|
||||||
payment_address,
|
|
||||||
min_required_payment,
|
|
||||||
main_logger,
|
|
||||||
):
|
|
||||||
main_logger.log(f"{r.id}: Payment confirmed.")
|
|
||||||
requests_to_execute.append(r)
|
requests_to_execute.append(r)
|
||||||
else:
|
else:
|
||||||
main_logger.log(
|
main_logger.log(
|
||||||
f"Skipping request {r.id}: unable to verify payment."
|
f"Skipping request {r.id}: deployer payment address not found in auction winners."
|
||||||
)
|
)
|
||||||
dump_known_requests(state_file, [r], status="UNPAID")
|
dump_known_requests(state_file, [r], status="SKIP")
|
||||||
else:
|
else:
|
||||||
requests_to_execute = requests_to_check_for_payment
|
main_logger.log(
|
||||||
|
f"Skipping request {r.id}: not handling requests with auction."
|
||||||
|
)
|
||||||
|
dump_known_requests(state_file, [r], status="SKIP")
|
||||||
|
elif min_required_payment:
|
||||||
|
main_logger.log(f"{r.id}: Confirming payment...")
|
||||||
|
if confirm_payment(
|
||||||
|
laconic,
|
||||||
|
r,
|
||||||
|
payment_address,
|
||||||
|
min_required_payment,
|
||||||
|
main_logger,
|
||||||
|
):
|
||||||
|
main_logger.log(f"{r.id}: Payment confirmed.")
|
||||||
|
requests_to_execute.append(r)
|
||||||
|
else:
|
||||||
|
main_logger.log(
|
||||||
|
f"Skipping request {r.id}: unable to verify payment."
|
||||||
|
)
|
||||||
|
dump_known_requests(state_file, [r], status="UNPAID")
|
||||||
|
else:
|
||||||
|
requests_to_execute.append(r)
|
||||||
|
|
||||||
main_logger.log(
|
main_logger.log(
|
||||||
"Found %d unsatisfied request(s) to process." % len(requests_to_execute)
|
"Found %d unsatisfied request(s) to process." % len(requests_to_execute)
|
||||||
|
@ -341,7 +341,7 @@ class LaconicRegistryClient:
|
|||||||
except: # noqa: E722
|
except: # noqa: E722
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if len(results):
|
if results and len(results):
|
||||||
return results[0]
|
return results[0]
|
||||||
|
|
||||||
if require:
|
if require:
|
||||||
|
Loading…
Reference in New Issue
Block a user