mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-29 20:16:33 -05:00
feat(wallet): Use mempool histogram for fee estimation (#358)
* feat(wallet): Use mempool.space as a secondary fee estimation source * fix: warn if mempool client cannot be instantiated * make clippy happy * nitpick: rename clippy_check to clippy in justfile * rename `estimate_fee_rate_from_mempool` to `estimate_fee_rate_from_histogram` for clarity * dprint fmt * make clippy happy * change teacing level back to debug! * change log levels * refactors * refactor: estimate_fee and min_relay_fee * serde camel case Co-authored-by: Byron Hambly <byron@hambly.dev> * refactors * Add comments, use Weight struct where possible * fmt, fix testrs * dont fallback to bitcoin::MAX, fail instead * make mempool space optional * fmt * refactor: use estimate_fee(...) in max_giveable(...) * refactor max_giveable(...) * refactor max_giveeable to return fee as well, remove safety margin for fee * fix compile * fmtr * fix(integration test): Use pre-calculated cancel / punish fees for assert_alice_punished * fix(integration test): Use real fees for asserts * sync wallet before transaction_fee call * split send_to_address into sweep_balance_to_address_dynamic_fee --------- Co-authored-by: Byron Hambly <byron@hambly.dev>
This commit is contained in:
parent
854b14939e
commit
091ba57547
23 changed files with 995 additions and 358 deletions
|
|
@ -12,6 +12,7 @@ pub enum Bob {
|
|||
btc_amount: bitcoin::Amount,
|
||||
#[serde(with = "crate::bitcoin::address_serde")]
|
||||
change_address: bitcoin::Address,
|
||||
tx_lock_fee: bitcoin::Amount,
|
||||
},
|
||||
ExecutionSetupDone {
|
||||
state2: bob::State2,
|
||||
|
|
@ -54,9 +55,11 @@ impl From<BobState> for Bob {
|
|||
BobState::Started {
|
||||
btc_amount,
|
||||
change_address,
|
||||
tx_lock_fee,
|
||||
} => Bob::Started {
|
||||
btc_amount,
|
||||
change_address,
|
||||
tx_lock_fee,
|
||||
},
|
||||
BobState::SwapSetupCompleted(state2) => Bob::ExecutionSetupDone { state2 },
|
||||
BobState::BtcLocked {
|
||||
|
|
@ -96,9 +99,11 @@ impl From<Bob> for BobState {
|
|||
Bob::Started {
|
||||
btc_amount,
|
||||
change_address,
|
||||
tx_lock_fee,
|
||||
} => BobState::Started {
|
||||
btc_amount,
|
||||
change_address,
|
||||
tx_lock_fee,
|
||||
},
|
||||
Bob::ExecutionSetupDone { state2 } => BobState::SwapSetupCompleted(state2),
|
||||
Bob::BtcLocked {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue