forked from jl777/SuperNET
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[r2r] Extend swap watcher node functionality for UTXO (#1496)
* add initial swap watcher node functionality * broadcast watcher message immediately after taker payment is sent * rename the WatcherData struct to TakerSwapWatcherData * use separate SwapWatcherMsg for watchers * make taker send the entire spending transaction to watcher nodes * broadcast watcher message periodically in wait_for_taker_payment_spend * check if transaction outputs is empty in p2sh_spending_tx * fix minor details * move utxo coin generation methods to docker_tests_common * use Mm2TestConf for watcher node tests * prevent running multiple watcher threads for the same swap * remove async from spawn_taker_swap_watcher * check if htlc spend fee is greater than the transaction output * add empty line at the end of docker_tests_common * discard prev_transaction mutability after modification * check if transaction outputs is empty in utxo_common functions * use the drop_mutability macro * move all watcher related code to the swap_watcher module * improve the taker_swap_watchers usage * remove unused types and structs * check if the transaction script has instructions * check if the transaction has any inputs * fix minor stuff * make watchers validate taker payment at most once * release taker_swap_watchers lock after inserting the uuid to the set * fix the error type in instruction iterator * reorder taker_swap_watchers lock/release structure * use separate files for large json test strings * remove watcher arguments from test helper functions * propagate watcher messages whether the node is watcher or not * remove swap lock related code from the swap_watcher * remove running_swaps related code from swap_watcher * check if a watcher with the same uuid exists before spawning a thread * fix minor problems * remove AtomicSwap implementation from swap_watcher * make taker trigger a WatcherMessageSent event only if it is actually sent * remove an unnecessary line * log error if watcher message could not be sent * improve mutex usage for the taker_swap_watchers * fix formatting * add state machines, watcher refund and ValidatePaymentError * use DuplicateCache for taker_swap_watchers * remove println statements * make the watchers wait for half the locktime before spending the maker payment * make the watchers wait for the taker before refunding * add refund transaction confirmation for watchers * check at watchers if the taker payment is already spent or refunded * validate the public keys in the watcher message * validate taker fees at watchers * fix state implementation return types * fix a bug in test_watcher_node * change the name of test_watcher_node * fix a bug in test_validate_maker_payment_malicious * Fix ValidatePaymentError usage * add preimage suffix to watcher-related transaction methods * fix error handling * separate WatcherOps from SwapOps * fix error match usage * reduce bchd_grpc module visibility to pub(crate) * fix a bug in qrc20_tests * inline WatcherOps functions * increase dynamic fees for watcher preimages * fix ethereum watcher preimage fee approximation * take back unnecessary changes * inline SwapOps functions * use taker fee hash for logs instead of uuid * extend TAKER_SWAP_ENTRY_TIMEOUT to 6 hours * remove swap_unique_data field from WatcherSearchForSwapTxSpendInput struct * fix error handling * remove unnecessary taker swap removal in Stopped state * improve match usage * use WAIT_FOR_TAKER_PAYMENT_INTERVAL const * inline DuplicateCache remove method * add functions for wait taker/maker payment confirmation durations * improve error handling * rename check_all_inputs_signed_by_pub method * add small fixes * fix WatcherError naming
- Loading branch information
1 parent
4de3cf2
commit 4d2071f
Showing
25 changed files
with
1,682 additions
and
719 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.