Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UpdateConnection to endpoint #3985

Closed
2 of 3 tasks
DimitrisJim opened this issue Jun 29, 2023 · 1 comment · Fixed by #5719
Closed
2 of 3 tasks

Add UpdateConnection to endpoint #3985

DimitrisJim opened this issue Jun 29, 2023 · 1 comment · Fixed by #5719
Assignees
Labels
nice-to-have testing Testing package and unit/integration tests type: code hygiene Clean up code but without changing functionality or interfaces

Comments

@DimitrisJim
Copy link
Contributor

DimitrisJim commented Jun 29, 2023

Summary

Would be nice to add a helper function on Endpoint that takes care of setting connection fields as needed, see relevant issue #3984 for channels. SImilar to that, we could have an UpdateConnection function that handles updating connection fields.

func (endpoint *Endpoint) UpdateConnection(updater func(connection *connectiontypes.ConnectionEnd)) error {
	connection := endpoint.GetConnection()

	updater(&connection)
	endpoint.SetConnection(connection)

	endpoint.Chain.Coordinator.CommitBlock(endpoint.Chain)

	return endpoint.Counterparty.UpdateClient()
}

Adding this function allows SetConnection/GetConnection to be private or, possibly, inlined into UpdateConnection.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
@DimitrisJim DimitrisJim added testing Testing package and unit/integration tests nice-to-have type: code hygiene Clean up code but without changing functionality or interfaces labels Jun 29, 2023
@DimitrisJim
Copy link
Contributor Author

Would be best to implement and refactor relevant usages after 04-channel-ugprades has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nice-to-have testing Testing package and unit/integration tests type: code hygiene Clean up code but without changing functionality or interfaces
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants