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

Refactor the Receive Transaction Protocol into the Protocol pattern #1930

Merged
merged 1 commit into from
Jun 3, 2020

Conversation

philipr-za
Copy link
Contributor

Description

This PR refactors the Receive Transaction Protocol in the Transaction Service. It moves all the logic for handling accepting a transaction, sending the reply and waiting for the finalised transaction into a self contained Protocol pattern. This protocol was added to the Transaction Service and plumbed in as with the previous protocols.

All the send operations in the Send and Receive transaction protocols were updated to follow the strategy of attempt direct and only send via SAF if discovery is needed or the direct send times out.

It was also decided that the Send and Receive transaction protocols should not monitor the liveness of the counterparty for resending purposes so that was removed from the Send Transaction Protocol. This PR also removes the test_resend_of_tx_on_pong_event which tested this functionality.

The Send Transaction Protocol was also cleaned up to better reflect the stages it can be started in.

A test was added to test that both the send and receive transaction protocols restart when the wallet starts up again.

How Has This Been Tested?

Tests updated and new test provided that tests that the protocols restart on startup.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Feature refactor (No new feature or functional changes, but performance or technical debt improvements)
  • New Tests
  • Documentation

Checklist:

  • I'm merging against the development branch.
  • I ran cargo-fmt --all before pushing.
  • I have squashed my commits into a single commit.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

sdbondi
sdbondi previously approved these changes Jun 3, 2020
Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

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

LGTM - just the 🖇️

This PR refactors the Receive Transaction Protocol in the Transaction Service. It moves all the logic for handling accepting a transaction, sending the reply and waiting for the finalised transaction into a self contained Protocol pattern. This protocol was added to the Transaction Service and plumbed in as with the previous protocols.

All the send operations in the Send and Receive transaction protocols were updated to follow the strategy of attempt direct and only send via SAF if discovery is needed or the direct send times out.

It was also decided that the Send and Receive transaction protocols should not monitor the liveness of the counterparty for resending purposes so that was removed from the Send Transaction Protocol. This PR also removes the `test_resend_of_tx_on_pong_event` which tested this functionality.

The Send Transaction Protocol was also cleaned up to better reflect the stages it can be started in.

A test was added to test that both the send and receive transaction protocols restart when the wallet starts up again.
@philipr-za philipr-za force-pushed the philip-refactor-tx-receive-protocol branch from 3c073be to cfcbe10 Compare June 3, 2020 10:50
@philipr-za
Copy link
Contributor Author

Sorted out the clippy stuff.

@sdbondi sdbondi merged commit d2793b7 into development Jun 3, 2020
@CjS77 CjS77 deleted the philip-refactor-tx-receive-protocol branch June 9, 2020 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants