Skip to content

Commit

Permalink
Delete unused code
Browse files Browse the repository at this point in the history
Code cleanup: deletes input_type.rs, output_type.rs and weight.rs which
are no longer needed.
  • Loading branch information
spacebear21 committed Oct 3, 2024
1 parent 84f121e commit 34a88be
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 439 deletions.
319 changes: 0 additions & 319 deletions payjoin/src/input_type.rs

This file was deleted.

4 changes: 0 additions & 4 deletions payjoin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ pub use v2::OhttpKeys;
#[cfg(feature = "io")]
pub mod io;

#[cfg(any(feature = "send", feature = "receive"))]
pub(crate) mod input_type;
#[cfg(any(feature = "send", feature = "receive"))]
pub(crate) mod psbt;
#[cfg(any(feature = "send", all(feature = "receive", feature = "v2")))]
Expand All @@ -45,8 +43,6 @@ mod request;
pub use request::*;

mod uri;
#[cfg(any(feature = "send", feature = "receive"))]
pub(crate) mod weight;

#[cfg(feature = "base64")]
pub use bitcoin::base64;
Expand Down
25 changes: 0 additions & 25 deletions payjoin/src/output_type.rs

This file was deleted.

17 changes: 0 additions & 17 deletions payjoin/src/psbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pub(crate) trait PsbtExt: Sized {
/// thing for outputs.
fn validate(self) -> Result<Self, InconsistentPsbt>;
fn validate_input_utxos(&self, treat_missing_as_error: bool) -> Result<(), PsbtInputsError>;
fn calculate_fee(&self) -> bitcoin::Amount;
}

impl PsbtExt for Psbt {
Expand Down Expand Up @@ -91,22 +90,6 @@ impl PsbtExt for Psbt {
.map_err(|error| PsbtInputsError { index, error })
})
}

fn calculate_fee(&self) -> bitcoin::Amount {
let mut total_outputs = bitcoin::Amount::ZERO;
let mut total_inputs = bitcoin::Amount::ZERO;

for output in &self.unsigned_tx.output {
total_outputs += output.value;
}

for input in self.input_pairs() {
total_inputs += input.previous_txout().unwrap().value;
}
log::debug!(" total_inputs: {}", total_inputs);
log::debug!("- total_outputs: {}", total_outputs);
total_inputs - total_outputs
}
}

/// Gets redeemScript from the script_sig following BIP16 rules regarding P2SH spending.
Expand Down
Loading

0 comments on commit 34a88be

Please sign in to comment.