AthanorLabs / atomic-swap

💫 ETH-XMR atomic swap implementation
GNU Lesser General Public License v3.0
341 stars 44 forks source link

fix xmrtaker key overwrite on restart #423

Closed noot closed 1 year ago

noot commented 1 year ago

as title says, generateAndSetKeys should NOT have been called when restarting an ongoing swap state, as it overwrote the keys in the db. this would have only been an issue on xmrtaker double-restart during a swap.

added a unit test for this case, and also added a small fix for a case caught in the test in xmrtaker.swapState.ready()

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 50.00% and project coverage change: +0.62 :tada:

Comparison is base (0b59d9a) 59.48% compared to head (53a1e44) 60.10%.

:exclamation: Current head 53a1e44 differs from pull request most recent head 502f17e. Consider uploading reports for the commit 502f17e to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #423 +/- ## ========================================== + Coverage 59.48% 60.10% +0.62% ========================================== Files 120 120 Lines 10795 10805 +10 ========================================== + Hits 6421 6494 +73 + Misses 3669 3597 -72 - Partials 705 714 +9 ``` | [Impacted Files](https://codecov.io/gh/AthanorLabs/atomic-swap/pull/423?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [daemon/test\_support.go](https://codecov.io/gh/AthanorLabs/atomic-swap/pull/423?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZGFlbW9uL3Rlc3Rfc3VwcG9ydC5nbw==) | `99.26% <ø> (-0.01%)` | :arrow_down: | | [rpc/swap.go](https://codecov.io/gh/AthanorLabs/atomic-swap/pull/423?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cnBjL3N3YXAuZ28=) | `17.00% <0.00%> (-0.18%)` | :arrow_down: | | [protocol/xmrtaker/swap\_state.go](https://codecov.io/gh/AthanorLabs/atomic-swap/pull/423?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cHJvdG9jb2wveG1ydGFrZXIvc3dhcF9zdGF0ZS5nbw==) | `69.58% <56.25%> (+3.07%)` | :arrow_up: | ... and [10 files with indirect coverage changes](https://codecov.io/gh/AthanorLabs/atomic-swap/pull/423/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.