Handle requests with auction when deploying webapps from registry
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 35s
Deploy Test / Run deploy test suite (pull_request) Successful in 5m6s
Webapp Test / Run webapp test suite (pull_request) Successful in 4m53s
K8s Deployment Control Test / Run deployment control suite on kind/k8s (pull_request) Successful in 6m52s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 8m26s
Smoke Test / Run basic test suite (pull_request) Successful in 3m59s

This commit is contained in:
Prathamesh Musale 2024-10-01 19:25:17 +05:30
parent 74edf16d14
commit 0694c31807

View File

@ -345,6 +345,12 @@ def dump_known_requests(filename, requests, status="SEEN"):
"my payment address are examined).",
is_flag=True,
)
@click.option(
"--auction-requests",
help="Handle requests with auction id set (skips payment confirmation).",
is_flag=True,
default=False,
)
@click.option(
"--config-upload-dir",
help="The directory containing uploaded config.",
@ -385,6 +391,7 @@ def command( # noqa: C901
private_key_file,
private_key_passphrase,
all_requests,
auction_requests,
):
if request_id and discover:
print("Cannot specify both --request-id and --discover", file=sys.stderr)
@ -579,6 +586,21 @@ def command( # noqa: C901
requests_to_execute = []
if min_required_payment:
for r in requests_to_check_for_payment:
if (not r.attributes.payment) and r.attributes.auction:
if not auction_requests:
main_logger.log(f"Skipping request {r.id}: not handling requests with auction.")
dump_known_requests(state_file, [r], status="SKIP")
else:
# Check if we are in auction winners
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,