Skip to content
This repository was archived by the owner on Apr 23, 2024. It is now read-only.

sdk/state: add validation that the channel has ingested/verified a formationTx before proposing/confirming payments or closes #280

Merged
merged 2 commits into from
Sep 1, 2021

Conversation

acharb
Copy link
Contributor

@acharb acharb commented Sep 1, 2021

WHAT
adds a validation to check that the channel.openExecutedAndValidated is true before proposing/confirming a payment or close

WHY
if the flag is true then the channel ingested the formation transaction and the channel is officially open. If it's false then the channel should not be able to make or confirm new payments or closes.

closes #235

@@ -93,7 +93,7 @@ func (c *Channel) ProposeClose() (CloseAgreement, error) {
}

// If the channel is not open yet, error.
if c.latestAuthorizedCloseAgreement.isEmpty() {
if c.latestAuthorizedCloseAgreement.isEmpty() || !c.openExecutedAndValidated {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grouped these checks together, I think if either fail we'd want to throw the same error

@acharb acharb marked this pull request as ready for review September 1, 2021 21:03
Copy link
Contributor

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏🏻

@acharb acharb merged commit 35f309a into main Sep 1, 2021
@acharb acharb deleted the acharb-error-not-open branch September 1, 2021 21:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sdk/state: error if proposing or confirming a payment or close if channel open is authorized but not executed
2 participants