Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* 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 * maker watchers periodically check for maker payment spend * remove the watcher_search_for_swap_tx_spend method * fix payment search interval * small fixes * add more watcher taker fee validations * validate taker fee lock_time with taker payment * remove debugging leftover * improve swap watcher integration tests * fix small timing issues in taker swap * adjust swap watcher timings and add more integration tests * remove redundant taker_payment_lock field from the watcher message * use maker payment hash instead of tx bytes * add missing implementations for watcher_search_for_swap_tx_spend * add test_watcher_validate_taker_fee * add WatcherValidateTakerFeeInput struct * use taker payment hash instead of hex in watcher message * remove redundant taker_pub field from the watcher message * use derive_htlc_key_pair to sign watcher messages * apply minor fixes * fix a bug in test_watcher_validate_taker_fee * remove the taker_amount field and its usages * remove the wait_for_confirmations_by_hash method * implement helper methods for WatcherContext * remove wait_for_confirmations from RefundTakerPayment state * increase wait_for_taker_refund_deadline * pass the secret_hash to the wait_for_htlc_tx_spend method * make watchers sleep before calling can_refund_htlc * fix a clippy warning * add more helper functions for WatcherContext * use debug macro instead of log * fix formatting * retry watcher_validate_taker_fee in case of error * define TAKER_PAYMENT_SPEND_SEARCH_INTERVAL separately in different modules * implement get_tx_hex_by_hash for the missing coins * validate taker payment locking script * fix a bug in docker_tests_inner * fix formatting * remove an unused test case * add DEFAULT_SWAP_VIN constant * remove loop to search for taker payment * fix taker payment locking script validation * move the loop out from watcher_search_for_swap_tx_spend * use helper functions for mycoin, mycoin1 and kmd configuration * remove logs before errors * fix a mistake in test_get_max_taker_vol_dust_threshold * use or_mm_err instead of ok_or_else * add as_slice method for Script and Bytes structs * use configurations for watcher variables * improve error handling * refactor the WaitForTakerPaymentSpend state * reduce TAKER_PAYMENT_SPEND_SEARCH_INTERVAL to 1 for tests * refactor get_tx_hex_by_hash_impl and get_raw_transaction_impl methods * change watcher log messages * use try_s macro instead of map_err * use constants for logs used in watcher tests * add new struct WatcherConf * fix a success case name * implement Default for WatcherConf * fix the name of wait_for_taker_payment_conf methods
- Loading branch information