Define TX_FEE within test files only.

This commit is contained in:
Philipp Hoenisch 2021-04-28 14:52:34 +10:00
parent 0006130756
commit 002e7b38c3
No known key found for this signature in database
GPG Key ID: E5F8E74C672BC666
2 changed files with 8 additions and 4 deletions

View File

@ -8,6 +8,10 @@ pub const RPC_PORT: u16 = 18443;
pub const PORT: u16 = 18886;
pub const DATADIR: &str = "/home/bdk";
// Bitcoin regtest TX fee. The fee itself does not matter for our tests. It just
// has to be static so that we can assert on the amounts.
pub const TX_FEE: u64 = 10_000;
#[derive(Debug)]
pub struct Bitcoind {
args: BitcoindArgs,

View File

@ -634,12 +634,12 @@ impl TestContext {
let alice_submitted_cancel = btc_balance_after_swap
== self.bob_starting_balances.btc
- lock_tx_bitcoin_fee
- bitcoin::Amount::from_sat(bitcoin::TX_FEE);
- bitcoin::Amount::from_sat(bitcoind::TX_FEE);
let bob_submitted_cancel = btc_balance_after_swap
== self.bob_starting_balances.btc
- lock_tx_bitcoin_fee
- bitcoin::Amount::from_sat(2 * bitcoin::TX_FEE);
- bitcoin::Amount::from_sat(2 * bitcoind::TX_FEE);
// The cancel tx can be submitted by both Alice and Bob.
// Since we cannot be sure who submitted it we have to assert accordingly
@ -678,7 +678,7 @@ impl TestContext {
fn alice_redeemed_btc_balance(&self) -> bitcoin::Amount {
self.alice_starting_balances.btc + self.btc_amount
- bitcoin::Amount::from_sat(bitcoin::TX_FEE)
- bitcoin::Amount::from_sat(bitcoind::TX_FEE)
}
fn bob_redeemed_xmr_balance(&self) -> monero::Amount {
@ -717,7 +717,7 @@ impl TestContext {
fn alice_punished_btc_balance(&self) -> bitcoin::Amount {
self.alice_starting_balances.btc + self.btc_amount
- bitcoin::Amount::from_sat(2 * bitcoin::TX_FEE)
- bitcoin::Amount::from_sat(2 * bitcoind::TX_FEE)
}
fn bob_punished_xmr_balance(&self) -> monero::Amount {