Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add process_and_select_coins function #727

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::convert::AsRef;
use std::ops::Sub;

use bitcoin::blockdata::transaction::{OutPoint, Transaction, TxOut};
use bitcoin::{hash_types::Txid, util::psbt};
use bitcoin::{hash_types::Txid, util::psbt, Script};

use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -177,6 +177,18 @@ pub struct WeightedUtxo {
pub utxo: Utxo,
}

/// A wallet owned script_pubkey with the weight of the `witness` + `scriptSig` in [weight units]
/// to spend from it.
/// Useful to optimize reducing the waste metric in coin selection algorithms.
/// [weight units]: <https://en.bitcoin.it/wiki/Weight_units>
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct WeightedScriptPubkey {
/// The weight of the witness data and `scriptSig` expressed in [weight units].
pub satisfaction_weight: usize,
/// The script_pubkey
pub script_pubkey: Script,
}

#[derive(Debug, Clone, PartialEq)]
/// An unspent transaction output (UTXO).
pub enum Utxo {
Expand Down
Loading