Allow payment reuse for application redeployment
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 41s
Deploy Test / Run deploy test suite (pull_request) Successful in 5m38s
K8s Deployment Control Test / Run deployment control suite on kind/k8s (pull_request) Successful in 6m48s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 8m48s
Webapp Test / Run webapp test suite (pull_request) Successful in 5m14s
Smoke Test / Run basic test suite (pull_request) Successful in 4m3s
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 41s
Deploy Test / Run deploy test suite (pull_request) Successful in 5m38s
K8s Deployment Control Test / Run deployment control suite on kind/k8s (pull_request) Successful in 6m48s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 8m48s
Webapp Test / Run webapp test suite (pull_request) Successful in 5m14s
Smoke Test / Run basic test suite (pull_request) Successful in 4m3s
This commit is contained in:
parent
f64ef5d128
commit
1c3dfceb30
@ -616,6 +616,7 @@ def command( # noqa: C901
|
|||||||
if confirm_payment(
|
if confirm_payment(
|
||||||
laconic,
|
laconic,
|
||||||
r,
|
r,
|
||||||
|
lrn,
|
||||||
payment_address,
|
payment_address,
|
||||||
min_required_payment,
|
min_required_payment,
|
||||||
main_logger,
|
main_logger,
|
||||||
|
@ -798,7 +798,7 @@ def skip_by_tag(r, include_tags, exclude_tags):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def confirm_payment(laconic: LaconicRegistryClient, record, payment_address, min_amount, logger):
|
def confirm_payment(laconic: LaconicRegistryClient, record, deployer_lrn, payment_address, min_amount, logger):
|
||||||
req_owner = laconic.get_owner(record)
|
req_owner = laconic.get_owner(record)
|
||||||
if req_owner == payment_address:
|
if req_owner == payment_address:
|
||||||
# No need to confirm payment if the sender and recipient are the same account.
|
# No need to confirm payment if the sender and recipient are the same account.
|
||||||
@ -846,16 +846,19 @@ def confirm_payment(laconic: LaconicRegistryClient, record, payment_address, min
|
|||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Check if the payment was already used on a
|
# Check if the payment was already used on a deployment
|
||||||
used = laconic.app_deployments(
|
used = laconic.app_deployments(
|
||||||
{"deployer": payment_address, "payment": tx.hash}, all=True
|
{"deployer": deployer_lrn, "payment": tx.hash}, all=True
|
||||||
)
|
)
|
||||||
if len(used):
|
if len(used):
|
||||||
logger.log(f"{record.id}: payment {tx.hash} already used on deployment {used}")
|
# Check that payment was used for deployment of same application
|
||||||
return False
|
app_record = laconic.get_record(record.attributes.application, require=True)
|
||||||
|
if app_record.id != used[0].attributes.application:
|
||||||
|
logger.log(f"{record.id}: payment {tx.hash} already used on a different application deployment {used}")
|
||||||
|
return False
|
||||||
|
|
||||||
used = laconic.app_deployment_removals(
|
used = laconic.app_deployment_removals(
|
||||||
{"deployer": payment_address, "payment": tx.hash}, all=True
|
{"deployer": deployer_lrn, "payment": tx.hash}, all=True
|
||||||
)
|
)
|
||||||
if len(used):
|
if len(used):
|
||||||
logger.log(
|
logger.log(
|
||||||
|
Loading…
Reference in New Issue
Block a user