Refactor the Receive Transaction Protocol into the Protocol pattern #1930
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Checklist:
development
branch.cargo-fmt --all
before pushing.