Skip to content

Commit 0291f44

Browse files
authored
Merge pull request #340 from rishkwal/rk/hardcode-transaction-fee
fix: hardcode the transaction fee
2 parents 531275d + 6143f67 commit 0291f44

File tree

12 files changed

+6
-19
lines changed

12 files changed

+6
-19
lines changed

src/bin/taker.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ struct Cli {
5454
/// Sets the transaction count.
5555
#[clap(name = "tx_count", default_value = "3")]
5656
pub tx_count: u32,
57-
/// Sets the fee-rate.
58-
#[clap(name = "fee_rate", default_value = "1000")]
59-
pub fee_rate: u64,
6057
/// Sets the required on-chain confirmations.
6158
#[clap(name = "required_confirms", default_value = "1000")]
6259
pub required_confirms: u64,
@@ -118,7 +115,6 @@ fn main() -> Result<(), TakerError> {
118115
maker_count: args.maker_count,
119116
tx_count: args.tx_count,
120117
required_confirms: args.required_confirms,
121-
fee_rate: Amount::from_sat(args.fee_rate),
122118
};
123119

124120
let mut taker = Taker::init(

src/taker/api.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ pub const RECONNECT_SHORT_SLEEP_DELAY: u64 = 10;
7171
pub const RECONNECT_LONG_SLEEP_DELAY: u64 = 60;
7272
pub const SHORT_LONG_SLEEP_DELAY_TRANSITION: u32 = 60;
7373
pub const RECONNECT_ATTEMPT_TIMEOUT_SEC: u64 = 300;
74+
// TODO: Maker should decide this miner fee
75+
// This fee is used for both funding and contract txs.
76+
pub const MINER_FEE: u64 = 1000;
7477

7578
/// Swap specific parameters. These are user's policy and can differ among swaps.
7679
/// SwapParams govern the criteria to find suitable set of makers from the offerbook.
@@ -87,8 +90,6 @@ pub struct SwapParams {
8790
// TODO: Following two should be moved to TakerConfig as global configuration.
8891
/// Confirmation count required for funding txs.
8992
pub required_confirms: u64,
90-
/// Fee rate for funding txs.
91-
pub fee_rate: Amount,
9293
}
9394

9495
// Defines the Taker's position in the current ongoing swap.
@@ -463,7 +464,7 @@ impl Taker {
463464
&hashlock_pubkeys,
464465
self.get_preimage_hash(),
465466
swap_locktime,
466-
self.ongoing_swap_state.swap_params.fee_rate,
467+
Amount::from_sat(MINER_FEE),
467468
)?;
468469

469470
let contract_reedemscripts = outgoing_swapcoins
@@ -954,7 +955,7 @@ impl Taker {
954955
next_peer_multisig_pubkeys: next_peer_multisig_pubkeys.clone(),
955956
next_peer_hashlock_pubkeys: next_peer_hashlock_pubkeys.clone(),
956957
next_maker_refund_locktime: maker_refund_locktime,
957-
next_maker_fee_rate: self.ongoing_swap_state.swap_params.fee_rate,
958+
next_maker_fee_rate: Amount::from_sat(MINER_FEE),
958959
};
959960

960961
let this_maker_info = ThisMakerInfo {
@@ -1196,7 +1197,7 @@ impl Taker {
11961197
previous_funding_output,
11971198
maker_funding_tx_value,
11981199
next_contract_redeemscript,
1199-
self.ongoing_swap_state.swap_params.fee_rate,
1200+
Amount::from_sat(MINER_FEE),
12001201
)
12011202
},
12021203
)

tests/abort1.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ fn test_stop_taker_after_setup() {
138138
maker_count: 2,
139139
tx_count: 3,
140140
required_confirms: 1,
141-
fee_rate: Amount::from_sat(1000),
142141
};
143142

144143
info!("Initiating coinswap protocol");

tests/abort2_case1.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ fn test_abort_case_2_move_on_with_other_makers() {
114114
maker_count: 2,
115115
tx_count: 3,
116116
required_confirms: 1,
117-
fee_rate: Amount::from_sat(1000),
118117
};
119118

120119
info!("Initiating coinswap protocol");

tests/abort2_case2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ fn test_abort_case_2_recover_if_no_makers_found() {
130130
maker_count: 2,
131131
tx_count: 3,
132132
required_confirms: 1,
133-
fee_rate: Amount::from_sat(1000),
134133
};
135134

136135
// Calculate Original balance excluding fidelity bonds.

tests/abort2_case3.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ fn maker_drops_after_sending_senders_sigs() {
113113
maker_count: 2,
114114
tx_count: 3,
115115
required_confirms: 1,
116-
fee_rate: Amount::from_sat(1000),
117116
};
118117

119118
info!("Initiating coinswap protocol");

tests/abort3_case1.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ fn abort3_case1_close_at_contract_sigs_for_recvr_and_sender() {
114114
maker_count: 2,
115115
tx_count: 3,
116116
required_confirms: 1,
117-
fee_rate: Amount::from_sat(1000),
118117
};
119118

120119
// Spawn a Taker coinswap thread.

tests/abort3_case2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ fn abort3_case2_close_at_contract_sigs_for_recvr() {
111111
maker_count: 2,
112112
tx_count: 3,
113113
required_confirms: 1,
114-
fee_rate: Amount::from_sat(1000),
115114
};
116115

117116
// Spawn a Taker coinswap thread.

tests/abort3_case3.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ fn abort3_case3_close_at_hash_preimage_handover() {
109109
maker_count: 2,
110110
tx_count: 3,
111111
required_confirms: 1,
112-
fee_rate: Amount::from_sat(1000),
113112
};
114113

115114
// Spawn a Taker coinswap thread.

tests/malice1.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ fn malice1_taker_broadcast_contract_prematurely() {
137137
maker_count: 2,
138138
tx_count: 3,
139139
required_confirms: 1,
140-
fee_rate: Amount::from_sat(1000),
141140
};
142141

143142
// Calculate Original balance excluding fidelity bonds.

0 commit comments

Comments
 (0)