From: github-actions Date: Thu, 6 May 2021 12:07:34 +0000 (+0000) Subject: Publish autogenerated nightly docs X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/struct.LocalUpdate.html?a=commitdiff_plain;h=293273adb14507f3d7eb67c986526074eade4b3a;p=bitcoindevkit.org Publish autogenerated nightly docs --- diff --git a/static/docs-rs/bdk/nightly/latest/bdk/all.html b/static/docs-rs/bdk/nightly/latest/bdk/all.html index f44d53e264..e2bfd9099a 100644 --- a/static/docs-rs/bdk/nightly/latest/bdk/all.html +++ b/static/docs-rs/bdk/nightly/latest/bdk/all.html @@ -3,5 +3,5 @@

List of all items[] -

Structs

Enums

Traits

Macros

Functions

Typedefs

+

Structs

Enums

Traits

Macros

Functions

Typedefs

\ No newline at end of file diff --git a/static/docs-rs/bdk/nightly/latest/bdk/descriptor/template/index.html b/static/docs-rs/bdk/nightly/latest/bdk/descriptor/template/index.html index 0106499e17..1eef6f138c 100644 --- a/static/docs-rs/bdk/nightly/latest/bdk/descriptor/template/index.html +++ b/static/docs-rs/bdk/nightly/latest/bdk/descriptor/template/index.html @@ -1,7 +1,7 @@ bdk::descriptor::template - Rust

Module bdk::descriptor::template[][src]

Descriptor templates

+ Change settings

Module bdk::descriptor::template[][src]

Descriptor templates

This module contains the definition of various common script templates that are ready to be used. See the documentation of each template for an example.

Structs

diff --git a/static/docs-rs/bdk/nightly/latest/bdk/fn.version.html b/static/docs-rs/bdk/nightly/latest/bdk/fn.version.html index 6f0de9ce9c..82377436ec 100644 --- a/static/docs-rs/bdk/nightly/latest/bdk/fn.version.html +++ b/static/docs-rs/bdk/nightly/latest/bdk/fn.version.html @@ -1,6 +1,6 @@ version in bdk - Rust

Function bdk::version[][src]

pub fn version() -> &'static str

Get the version of BDK at runtime

+ Change settings

Function bdk::version[][src]

pub fn version() -> &'static str

Get the version of BDK at runtime

\ No newline at end of file diff --git a/static/docs-rs/bdk/nightly/latest/bdk/index.html b/static/docs-rs/bdk/nightly/latest/bdk/index.html index 2ccf29e2e6..b1dab66a2d 100644 --- a/static/docs-rs/bdk/nightly/latest/bdk/index.html +++ b/static/docs-rs/bdk/nightly/latest/bdk/index.html @@ -1,7 +1,7 @@ bdk - Rust

Crate bdk[][src]

A modern, lightweight, descriptor-based wallet library written in Rust.

+ Change settings

Crate bdk[][src]

A modern, lightweight, descriptor-based wallet library written in Rust.

About

The BDK library aims to be the core building block for Bitcoin wallets of any kind.

    @@ -149,7 +149,7 @@ BDK.

  • key-value-db: key value database based on sled for caching blockchain data

Re-exports

-
pub extern crate bitcoin;
pub extern crate electrum_client;
pub extern crate miniscript;
pub extern crate reqwest;
pub extern crate sled;
pub use descriptor::template;
pub use descriptor::HdKeyPaths;
pub use wallet::address_validator;
pub use wallet::signer;
pub use wallet::tx_builder::TxBuilder;
pub use wallet::Wallet;

Modules

+
pub extern crate bitcoin;
pub extern crate electrum_client;
pub extern crate miniscript;
pub extern crate reqwest;
pub extern crate sled;
pub use descriptor::template;
pub use descriptor::HdKeyPaths;
pub use wallet::address_validator;
pub use wallet::signer;
pub use wallet::signer::SignOptions;
pub use wallet::tx_builder::TxBuilder;
pub use wallet::Wallet;

Modules

blockchain

Blockchain backends

database

Database types

descriptor

Descriptors

diff --git a/static/docs-rs/bdk/nightly/latest/bdk/wallet/index.html b/static/docs-rs/bdk/nightly/latest/bdk/wallet/index.html index f37b7d99c7..b52c2cd580 100644 --- a/static/docs-rs/bdk/nightly/latest/bdk/wallet/index.html +++ b/static/docs-rs/bdk/nightly/latest/bdk/wallet/index.html @@ -1,7 +1,7 @@ bdk::wallet - Rust

Module bdk::wallet[][src]

Wallet

+ Change settings

Module bdk::wallet[][src]

Wallet

This module defines the Wallet structure.

Modules

address_validator

Address validation callbacks

diff --git a/static/docs-rs/bdk/nightly/latest/bdk/wallet/signer/index.html b/static/docs-rs/bdk/nightly/latest/bdk/wallet/signer/index.html index 0f9b99dddf..8ced6201a1 100644 --- a/static/docs-rs/bdk/nightly/latest/bdk/wallet/signer/index.html +++ b/static/docs-rs/bdk/nightly/latest/bdk/wallet/signer/index.html @@ -1,7 +1,7 @@ bdk::wallet::signer - Rust

Module bdk::wallet::signer[][src]

Generalized signers

+ Change settings

Module bdk::wallet::signer[][src]

Generalized signers

This module provides the ability to add customized signers to a Wallet through the Wallet::add_signer function.

@@ -50,7 +50,8 @@ through the Wallet::add_ );

Structs

-
SignerOrdering

Defines the order in which signers are called

+
SignOptions

Options for a software signer

+
SignerOrdering

Defines the order in which signers are called

SignersContainer

Container for multiple signers

Enums

SignerError

Signing error

diff --git a/static/docs-rs/bdk/nightly/latest/bdk/wallet/signer/sidebar-items.js b/static/docs-rs/bdk/nightly/latest/bdk/wallet/signer/sidebar-items.js index 8f3e3d79b6..5700429cf3 100644 --- a/static/docs-rs/bdk/nightly/latest/bdk/wallet/signer/sidebar-items.js +++ b/static/docs-rs/bdk/nightly/latest/bdk/wallet/signer/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"enum":[["SignerError","Signing error"],["SignerId","Identifier of a signer in the `SignersContainers`. Used as a key to find the right signer among multiple of them"]],"struct":[["SignerOrdering","Defines the order in which signers are called"],["SignersContainer","Container for multiple signers"]],"trait":[["Signer","Trait for signers"]]}); \ No newline at end of file +initSidebarItems({"enum":[["SignerError","Signing error"],["SignerId","Identifier of a signer in the `SignersContainers`. Used as a key to find the right signer among multiple of them"]],"struct":[["SignOptions","Options for a software signer"],["SignerOrdering","Defines the order in which signers are called"],["SignersContainer","Container for multiple signers"]],"trait":[["Signer","Trait for signers"]]}); \ No newline at end of file diff --git a/static/docs-rs/bdk/nightly/latest/bdk/wallet/signer/struct.SignOptions.html b/static/docs-rs/bdk/nightly/latest/bdk/wallet/signer/struct.SignOptions.html new file mode 100644 index 0000000000..b2fa8b5d59 --- /dev/null +++ b/static/docs-rs/bdk/nightly/latest/bdk/wallet/signer/struct.SignOptions.html @@ -0,0 +1,53 @@ +SignOptions in bdk::wallet::signer - Rust + +

Struct bdk::wallet::signer::SignOptions[][src]

pub struct SignOptions {
+    pub trust_witness_utxo: bool,
+    pub assume_height: Option<u32>,
+}

Options for a software signer

+

Adjust the behavior of our software signers and the way a transaction is finalized

+

+ Fields

trust_witness_utxo: bool

Whether the signer should trust the witness_utxo, if the non_witness_utxo hasn’t been +provided

+

Defaults to false to mitigate the “SegWit bug” which chould trick the wallet into +paying a fee larger than expected.

+

Some wallets, especially if relatively old, might not provide the non_witness_utxo for +SegWit transactions in the PSBT they generate: in those cases setting this to true +should correctly produce a signature, at the expense of an increased trust in the creator +of the PSBT.

+

For more details see: https://blog.trezor.io/details-of-firmware-updates-for-trezor-one-version-1-9-1-and-trezor-model-t-version-2-3-1-1eba8f60f2dd

+
assume_height: Option<u32>

Whether the wallet should assume a specific height has been reached when trying to finalize +a transaction

+

The wallet will only “use” a timelock to satisfy the spending policy of an input if the +timelock height has already been reached. This option allows overriding the “current height” to let the +wallet use timelocks in the future to spend a coin.

+

Trait Implementations

impl Clone for SignOptions[src]

fn clone(&self) -> SignOptions[src]

Returns a copy of the value. Read more

+

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

+

impl Debug for SignOptions[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

+

impl Default for SignOptions[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

+

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

+

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

+

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

+

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

+

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an +Instrumented wrapper. Read more

+

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an +Instrumented wrapper. Read more

+

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

+

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

+

type Init = T

The type for initializers.

+

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

+

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

+

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

+

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

+

impl<T> Same<T> for T

type Output = T

Should always be Self

+

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

+

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

+

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

+ \ No newline at end of file diff --git a/static/docs-rs/bdk/nightly/latest/bdk/wallet/struct.Wallet.html b/static/docs-rs/bdk/nightly/latest/bdk/wallet/struct.Wallet.html index a50611b054..325615acaf 100644 --- a/static/docs-rs/bdk/nightly/latest/bdk/wallet/struct.Wallet.html +++ b/static/docs-rs/bdk/nightly/latest/bdk/wallet/struct.Wallet.html @@ -10,7 +10,7 @@ needs to operate, like generatin implements Blockchain, or “offline” if it is the unit type (). Offline wallets only expose methods that don’t need any interaction with the blockchain to work.

Implementations

impl<D> Wallet<(), D> where
    D: BatchDatabase
[src]

pub fn new_offline<E: IntoWalletDescriptor>(
    descriptor: E,
    change_descriptor: Option<E>,
    network: Network,
    database: D
) -> Result<Self, Error>
[src]

Create a new “offline” wallet

-

impl<B, D> Wallet<B, D> where
    D: BatchDatabase
[src]

pub fn get_address(&self, address_index: AddressIndex) -> Result<Address, Error>[src]

Return a derived address using the external descriptor, see AddressIndex for +

impl<B, D> Wallet<B, D> where
    D: BatchDatabase
[src]

pub fn get_address(&self, address_index: AddressIndex) -> Result<Address, Error>[src]

Return a derived address using the external descriptor, see AddressIndex for available address index selection strategies. If none of the keys in the descriptor are derivable (ie. does not end with /*) then the same address will always be returned for any AddressIndex.

pub fn is_mine(&self, script: &Script) -> Result<bool, Error>[src]

Return whether or not a script is part of this wallet (either internal or external)

@@ -59,7 +59,7 @@ only output’s value in order to increase the fees.

.enable_rbf(); builder.finish()? }; -let _ = wallet.sign(&mut psbt, None)?; +let _ = wallet.sign(&mut psbt, SignOptions::default())?; let tx = psbt.extract_tx(); // broadcast tx but it's taking too long to confirm so we want to bump the fee let (mut psbt, _) = { @@ -69,11 +69,15 @@ only output’s value in order to increase the fees.

builder.finish()? }; -let _ = wallet.sign(&mut psbt, None)?; +let _ = wallet.sign(&mut psbt, SignOptions::default())?; let fee_bumped_tx = psbt.extract_tx(); // broadcast fee_bumped_tx to replace original
-

pub fn sign(
    &self,
    psbt: &mut PSBT,
    assume_height: Option<u32>
) -> Result<bool, Error>
[src]

Sign a transaction with all the wallet’s signers, in the order specified by every signer’s +

pub fn sign(
    &self,
    psbt: &mut PSBT,
    sign_options: SignOptions
) -> Result<bool, Error>
[src]

Sign a transaction with all the wallet’s signers, in the order specified by every signer’s SignerOrdering

+

The SignOptions can be used to tweak the behavior of the software signers, and the way +the transaction is finalized at the end. Note that it can’t be guaranteed that every +signers will follow the options, but the “software signers” (WIF keys and xprv) defined +in this library will.

Example

 let (mut psbt, _) = {
@@ -81,21 +85,22 @@ only output’s value in order to increase the fees.

builder.add_recipient(to_address.script_pubkey(), 50_000); builder.finish()? }; -let finalized = wallet.sign(&mut psbt, None)?; +let finalized = wallet.sign(&mut psbt, SignOptions::default())?; assert!(finalized, "we should have signed all the inputs");
-

pub fn policies(&self, keychain: KeychainKind) -> Result<Option<Policy>, Error>[src]

Return the spending policies for the wallet’s descriptor

-

pub fn public_descriptor(
    &self,
    keychain: KeychainKind
) -> Result<Option<ExtendedDescriptor>, Error>
[src]

Return the “public” version of the wallet’s descriptor, meaning a new descriptor that has +

pub fn policies(&self, keychain: KeychainKind) -> Result<Option<Policy>, Error>[src]

Return the spending policies for the wallet’s descriptor

+

pub fn public_descriptor(
    &self,
    keychain: KeychainKind
) -> Result<Option<ExtendedDescriptor>, Error>
[src]

Return the “public” version of the wallet’s descriptor, meaning a new descriptor that has the same structure but with every secret key removed

This can be used to build a watch-only version of a wallet

-

pub fn finalize_psbt(
    &self,
    psbt: &mut PSBT,
    assume_height: Option<u32>
) -> Result<bool, Error>
[src]

Try to finalize a PSBT

-

pub fn secp_ctx(&self) -> &Secp256k1<All>[src]

Return the secp256k1 context used for all signing operations

-

pub fn get_descriptor_for_keychain(
    &self,
    keychain: KeychainKind
) -> &ExtendedDescriptor
[src]

Returns the descriptor used to create adddresses for a particular keychain.

-

pub fn get_psbt_input(
    &self,
    utxo: LocalUtxo,
    sighash_type: Option<SigHashType>,
    force_non_witness_utxo: bool
) -> Result<Input, Error>
[src]

get the corresponding PSBT Input for a LocalUtxo

-

impl<B, D> Wallet<B, D> where
    B: Blockchain,
    D: BatchDatabase
[src]

pub fn new<E: IntoWalletDescriptor>(
    descriptor: E,
    change_descriptor: Option<E>,
    network: Network,
    database: D,
    client: B
) -> Result<Self, Error>
[src]

Create a new “online” wallet

-

pub fn sync<P: 'static + Progress>(
    &self,
    progress_update: P,
    max_address_param: Option<u32>
) -> Result<(), Error>
[src]

Sync the internal database with the blockchain

-

pub fn client(&self) -> &B[src]

Return a reference to the internal blockchain client

-

pub fn network(&self) -> Network[src]

Get the Bitcoin network the wallet is using.

-

pub fn broadcast(&self, tx: Transaction) -> Result<Txid, Error>[src]

Broadcast a transaction to the network

+

pub fn finalize_psbt(
    &self,
    psbt: &mut PSBT,
    sign_options: SignOptions
) -> Result<bool, Error>
[src]

Try to finalize a PSBT

+

The SignOptions can be used to tweak the behavior of the finalizer.

+

pub fn secp_ctx(&self) -> &Secp256k1<All>[src]

Return the secp256k1 context used for all signing operations

+

pub fn get_descriptor_for_keychain(
    &self,
    keychain: KeychainKind
) -> &ExtendedDescriptor
[src]

Returns the descriptor used to create adddresses for a particular keychain.

+

pub fn get_psbt_input(
    &self,
    utxo: LocalUtxo,
    sighash_type: Option<SigHashType>,
    only_witness_utxo: bool
) -> Result<Input, Error>
[src]

get the corresponding PSBT Input for a LocalUtxo

+

impl<B, D> Wallet<B, D> where
    B: Blockchain,
    D: BatchDatabase
[src]

pub fn new<E: IntoWalletDescriptor>(
    descriptor: E,
    change_descriptor: Option<E>,
    network: Network,
    database: D,
    client: B
) -> Result<Self, Error>
[src]

Create a new “online” wallet

+

pub fn sync<P: 'static + Progress>(
    &self,
    progress_update: P,
    max_address_param: Option<u32>
) -> Result<(), Error>
[src]

Sync the internal database with the blockchain

+

pub fn client(&self) -> &B[src]

Return a reference to the internal blockchain client

+

pub fn network(&self) -> Network[src]

Get the Bitcoin network the wallet is using.

+

pub fn broadcast(&self, tx: Transaction) -> Result<Txid, Error>[src]

Broadcast a transaction to the network

Trait Implementations

impl<B: Debug, D: Debug> Debug for Wallet<B, D>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<B, D> !RefUnwindSafe for Wallet<B, D>

impl<B, D> Send for Wallet<B, D> where
    B: Send,
    D: Send

impl<B, D> !Sync for Wallet<B, D>

impl<B, D> Unpin for Wallet<B, D> where
    B: Unpin,
    D: Unpin

impl<B, D> !UnwindSafe for Wallet<B, D>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

diff --git a/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/enum.ChangeSpendPolicy.html b/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/enum.ChangeSpendPolicy.html index ae0440c648..93cb81ee1b 100644 --- a/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/enum.ChangeSpendPolicy.html +++ b/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/enum.ChangeSpendPolicy.html @@ -1,7 +1,7 @@ ChangeSpendPolicy in bdk::wallet::tx_builder - Rust

Enum bdk::wallet::tx_builder::ChangeSpendPolicy[][src]

pub enum ChangeSpendPolicy {
+                Change settings

Enum bdk::wallet::tx_builder::ChangeSpendPolicy[][src]

pub enum ChangeSpendPolicy {
     ChangeAllowed,
     OnlyChange,
     ChangeForbidden,
@@ -11,27 +11,27 @@
 
ChangeAllowed

Use both change and non-change outputs (default)

OnlyChange

Only use change outputs (see TxBuilder::only_spend_change)

ChangeForbidden

Only use non-change outputs (see TxBuilder::do_not_spend_change)

-

Trait Implementations

impl Clone for ChangeSpendPolicy[src]

fn clone(&self) -> ChangeSpendPolicy[src]

Returns a copy of the value. Read more

+

Trait Implementations

impl Clone for ChangeSpendPolicy[src]

fn clone(&self) -> ChangeSpendPolicy[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

-

impl Debug for ChangeSpendPolicy[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

-

impl Default for ChangeSpendPolicy[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

-

impl Hash for ChangeSpendPolicy[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

+

impl Debug for ChangeSpendPolicy[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

+

impl Default for ChangeSpendPolicy[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

+

impl Hash for ChangeSpendPolicy[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

-

impl Ord for ChangeSpendPolicy[src]

fn cmp(&self, other: &ChangeSpendPolicy) -> Ordering[src]

This method returns an Ordering between self and other. Read more

+

impl Ord for ChangeSpendPolicy[src]

fn cmp(&self, other: &ChangeSpendPolicy) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

-

impl PartialEq<ChangeSpendPolicy> for ChangeSpendPolicy[src]

fn eq(&self, other: &ChangeSpendPolicy) -> bool[src]

This method tests for self and other values to be equal, and is used +

impl PartialEq<ChangeSpendPolicy> for ChangeSpendPolicy[src]

fn eq(&self, other: &ChangeSpendPolicy) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

-

impl PartialOrd<ChangeSpendPolicy> for ChangeSpendPolicy[src]

fn partial_cmp(&self, other: &ChangeSpendPolicy) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

+

impl PartialOrd<ChangeSpendPolicy> for ChangeSpendPolicy[src]

fn partial_cmp(&self, other: &ChangeSpendPolicy) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

-

impl Copy for ChangeSpendPolicy[src]

impl Eq for ChangeSpendPolicy[src]

impl StructuralEq for ChangeSpendPolicy[src]

impl StructuralPartialEq for ChangeSpendPolicy[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

+

impl Copy for ChangeSpendPolicy[src]

impl Eq for ChangeSpendPolicy[src]

impl StructuralEq for ChangeSpendPolicy[src]

impl StructuralPartialEq for ChangeSpendPolicy[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<Q, K> Equivalent<K> for Q where
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized
[src]

pub fn equivalent(&self, key: &K) -> bool[src]

Compare self to key and return true if they are equal.

diff --git a/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/enum.TxOrdering.html b/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/enum.TxOrdering.html index 5398582a75..fb7526467b 100644 --- a/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/enum.TxOrdering.html +++ b/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/enum.TxOrdering.html @@ -1,7 +1,7 @@ TxOrdering in bdk::wallet::tx_builder - Rust

Enum bdk::wallet::tx_builder::TxOrdering[][src]

pub enum TxOrdering {
+                Change settings

Enum bdk::wallet::tx_builder::TxOrdering[][src]

pub enum TxOrdering {
     Shuffle,
     Untouched,
     Bip69Lexicographic,
@@ -11,28 +11,28 @@
 
Shuffle

Randomized (default)

Untouched

Unchanged

Bip69Lexicographic

BIP69 / Lexicographic

-

Implementations

impl TxOrdering[src]

pub fn sort_tx(&self, tx: &mut Transaction)[src]

Sort transaction inputs and outputs by TxOrdering variant

-

Trait Implementations

impl Clone for TxOrdering[src]

fn clone(&self) -> TxOrdering[src]

Returns a copy of the value. Read more

+

Implementations

impl TxOrdering[src]

pub fn sort_tx(&self, tx: &mut Transaction)[src]

Sort transaction inputs and outputs by TxOrdering variant

+

Trait Implementations

impl Clone for TxOrdering[src]

fn clone(&self) -> TxOrdering[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

-

impl Debug for TxOrdering[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

-

impl Default for TxOrdering[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

-

impl Hash for TxOrdering[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

+

impl Debug for TxOrdering[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

+

impl Default for TxOrdering[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

+

impl Hash for TxOrdering[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

-

impl Ord for TxOrdering[src]

fn cmp(&self, other: &TxOrdering) -> Ordering[src]

This method returns an Ordering between self and other. Read more

+

impl Ord for TxOrdering[src]

fn cmp(&self, other: &TxOrdering) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

-

impl PartialEq<TxOrdering> for TxOrdering[src]

fn eq(&self, other: &TxOrdering) -> bool[src]

This method tests for self and other values to be equal, and is used +

impl PartialEq<TxOrdering> for TxOrdering[src]

fn eq(&self, other: &TxOrdering) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

-

impl PartialOrd<TxOrdering> for TxOrdering[src]

fn partial_cmp(&self, other: &TxOrdering) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

+

impl PartialOrd<TxOrdering> for TxOrdering[src]

fn partial_cmp(&self, other: &TxOrdering) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

-

impl Copy for TxOrdering[src]

impl Eq for TxOrdering[src]

impl StructuralEq for TxOrdering[src]

impl StructuralPartialEq for TxOrdering[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

+

impl Copy for TxOrdering[src]

impl Eq for TxOrdering[src]

impl StructuralEq for TxOrdering[src]

impl StructuralPartialEq for TxOrdering[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<Q, K> Equivalent<K> for Q where
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized
[src]

pub fn equivalent(&self, key: &K) -> bool[src]

Compare self to key and return true if they are equal.

diff --git a/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/index.html b/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/index.html index 8e27685947..0f2319bdf8 100644 --- a/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/index.html +++ b/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/index.html @@ -1,7 +1,7 @@ bdk::wallet::tx_builder - Rust

Module bdk::wallet::tx_builder[][src]

Transaction builder

+ Change settings

Module bdk::wallet::tx_builder[][src]

Transaction builder

Example

 // create a TxBuilder from a wallet
diff --git a/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/struct.TxBuilder.html b/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/struct.TxBuilder.html
index ce9f41254f..8d05f28763 100644
--- a/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/struct.TxBuilder.html
+++ b/static/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/struct.TxBuilder.html
@@ -1,6 +1,6 @@
 TxBuilder in bdk::wallet::tx_builder - Rust
 
-
 // Bitcoin Dev Kit
 // Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
@@ -1184,11 +1185,12 @@
 mod test {
     // test existing descriptor templates, make sure they are expanded to the right descriptors
 
+    use std::str::FromStr;
+
     use super::*;
     use crate::descriptor::derived::AsDerived;
     use crate::descriptor::{DescriptorError, DescriptorMeta};
     use crate::keys::ValidNetworks;
-    use bitcoin::hashes::core::str::FromStr;
     use bitcoin::network::constants::Network::Regtest;
     use bitcoin::secp256k1::Secp256k1;
     use miniscript::descriptor::{DescriptorPublicKey, DescriptorTrait, KeyMap};
diff --git a/static/docs-rs/bdk/nightly/latest/src/bdk/lib.rs.html b/static/docs-rs/bdk/nightly/latest/src/bdk/lib.rs.html
index 04c5d8a8cb..f2ea1a8cce 100644
--- a/static/docs-rs/bdk/nightly/latest/src/bdk/lib.rs.html
+++ b/static/docs-rs/bdk/nightly/latest/src/bdk/lib.rs.html
@@ -266,6 +266,7 @@
 263
 264
 265
+266
 
 // Bitcoin Dev Kit
 // Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
@@ -525,6 +526,7 @@
 pub use types::*;
 pub use wallet::address_validator;
 pub use wallet::signer;
+pub use wallet::signer::SignOptions;
 pub use wallet::tx_builder::TxBuilder;
 pub use wallet::Wallet;
 
diff --git a/static/docs-rs/bdk/nightly/latest/src/bdk/wallet/mod.rs.html b/static/docs-rs/bdk/nightly/latest/src/bdk/wallet/mod.rs.html
index b08f1749b9..693f2e00de 100644
--- a/static/docs-rs/bdk/nightly/latest/src/bdk/wallet/mod.rs.html
+++ b/static/docs-rs/bdk/nightly/latest/src/bdk/wallet/mod.rs.html
@@ -3758,6 +3758,51 @@
 3755
 3756
 3757
+3758
+3759
+3760
+3761
+3762
+3763
+3764
+3765
+3766
+3767
+3768
+3769
+3770
+3771
+3772
+3773
+3774
+3775
+3776
+3777
+3778
+3779
+3780
+3781
+3782
+3783
+3784
+3785
+3786
+3787
+3788
+3789
+3790
+3791
+3792
+3793
+3794
+3795
+3796
+3797
+3798
+3799
+3800
+3801
+3802
 
 // Bitcoin Dev Kit
 // Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
@@ -3807,7 +3852,7 @@
 
 use address_validator::AddressValidator;
 use coin_selection::DefaultCoinSelectionAlgorithm;
-use signer::{Signer, SignerOrdering, SignersContainer};
+use signer::{SignOptions, Signer, SignerOrdering, SignersContainer};
 use tx_builder::{BumpFee, CreateTx, FeePolicy, TxBuilder, TxParams};
 use utils::{check_nlocktime, check_nsequence_rbf, After, Older, SecpCtx, DUST_LIMIT_SATOSHI};
 
@@ -4467,7 +4512,7 @@
     ///         .enable_rbf();
     ///     builder.finish()?
     /// };
-    /// let _ = wallet.sign(&mut psbt, None)?;
+    /// let _ = wallet.sign(&mut psbt, SignOptions::default())?;
     /// let tx = psbt.extract_tx();
     /// // broadcast tx but it's taking too long to confirm so we want to bump the fee
     /// let (mut psbt, _) =  {
@@ -4477,7 +4522,7 @@
     ///     builder.finish()?
     /// };
     ///
-    /// let _ = wallet.sign(&mut psbt, None)?;
+    /// let _ = wallet.sign(&mut psbt, SignOptions::default())?;
     /// let fee_bumped_tx = psbt.extract_tx();
     /// // broadcast fee_bumped_tx to replace original
     /// # Ok::<(), bdk::Error>(())
@@ -4594,6 +4639,11 @@
     /// Sign a transaction with all the wallet's signers, in the order specified by every signer's
     /// [`SignerOrdering`]
     ///
+    /// The [`SignOptions`] can be used to tweak the behavior of the software signers, and the way
+    /// the transaction is finalized at the end. Note that it can't be guaranteed that *every*
+    /// signers will follow the options, but the "software signers" (WIF keys and `xprv`) defined
+    /// in this library will.
+    ///
     /// ## Example
     ///
     /// ```
@@ -4609,13 +4659,21 @@
     ///     builder.add_recipient(to_address.script_pubkey(), 50_000);
     ///     builder.finish()?
     /// };
-    /// let  finalized = wallet.sign(&mut psbt, None)?;
+    /// let  finalized = wallet.sign(&mut psbt, SignOptions::default())?;
     /// assert!(finalized, "we should have signed all the inputs");
     /// # Ok::<(), bdk::Error>(())
-    pub fn sign(&self, psbt: &mut PSBT, assume_height: Option<u32>) -> Result<bool, Error> {
+    pub fn sign(&self, psbt: &mut PSBT, sign_options: SignOptions) -> Result<bool, Error> {
         // this helps us doing our job later
         self.add_input_hd_keypaths(psbt)?;
 
+        // If we aren't allowed to use `witness_utxo`, ensure that every input has the
+        // `non_witness_utxo`
+        if !sign_options.trust_witness_utxo
+            && psbt.inputs.iter().any(|i| i.non_witness_utxo.is_none())
+        {
+            return Err(Error::Signer(signer::SignerError::MissingNonWitnessUtxo));
+        }
+
         for signer in self
             .signers
             .signers()
@@ -4632,7 +4690,7 @@
         }
 
         // attempt to finalize
-        self.finalize_psbt(psbt, assume_height)
+        self.finalize_psbt(psbt, sign_options)
     }
 
     /// Return the spending policies for the wallet's descriptor
@@ -4668,11 +4726,9 @@
     }
 
     /// Try to finalize a PSBT
-    pub fn finalize_psbt(
-        &self,
-        psbt: &mut PSBT,
-        assume_height: Option<u32>,
-    ) -> Result<bool, Error> {
+    ///
+    /// The [`SignOptions`] can be used to tweak the behavior of the finalizer.
+    pub fn finalize_psbt(&self, psbt: &mut PSBT, sign_options: SignOptions) -> Result<bool, Error> {
         let tx = &psbt.global.unsigned_tx;
         let mut finished = true;
 
@@ -4688,7 +4744,7 @@
                 .borrow()
                 .get_tx(&input.previous_output.txid, false)?
                 .map(|tx| tx.height.unwrap_or(std::u32::MAX));
-            let current_height = assume_height.or(self.current_height);
+            let current_height = sign_options.assume_height.or(self.current_height);
 
             debug!(
                 "Input #{} - {}, using `create_height` = {:?}, `current_height` = {:?}",
@@ -5019,28 +5075,23 @@
 
             match utxo {
                 Utxo::Local(utxo) => {
-                    *psbt_input = match self.get_psbt_input(
-                        utxo,
-                        params.sighash,
-                        params.force_non_witness_utxo,
-                    ) {
-                        Ok(psbt_input) => psbt_input,
-                        Err(e) => match e {
-                            Error::UnknownUtxo => Input {
-                                sighash_type: params.sighash,
-                                ..Input::default()
+                    *psbt_input =
+                        match self.get_psbt_input(utxo, params.sighash, params.only_witness_utxo) {
+                            Ok(psbt_input) => psbt_input,
+                            Err(e) => match e {
+                                Error::UnknownUtxo => Input {
+                                    sighash_type: params.sighash,
+                                    ..Input::default()
+                                },
+                                _ => return Err(e),
                             },
-                            _ => return Err(e),
-                        },
-                    }
+                        }
                 }
                 Utxo::Foreign {
                     psbt_input: foreign_psbt_input,
                     outpoint,
                 } => {
-                    if params.force_non_witness_utxo
-                        && foreign_psbt_input.non_witness_utxo.is_none()
-                    {
+                    if !params.only_witness_utxo && foreign_psbt_input.non_witness_utxo.is_none() {
                         return Err(Error::Generic(format!(
                             "Missing non_witness_utxo on foreign utxo {}",
                             outpoint
@@ -5084,7 +5135,7 @@
         &self,
         utxo: LocalUtxo,
         sighash_type: Option<SigHashType>,
-        force_non_witness_utxo: bool,
+        only_witness_utxo: bool,
     ) -> Result<Input, Error> {
         // Try to find the prev_script in our db to figure out if this is internal or external,
         // and the derivation index
@@ -5111,7 +5162,7 @@
             if desc.is_witness() {
                 psbt_input.witness_utxo = Some(prev_tx.output[prev_output.vout as usize].clone());
             }
-            if !desc.is_witness() || force_non_witness_utxo {
+            if !desc.is_witness() || !only_witness_utxo {
                 psbt_input.non_witness_utxo = Some(prev_tx);
             }
         }
@@ -5998,6 +6049,7 @@
         let mut builder = wallet.build_tx();
         builder
             .set_single_recipient(addr.script_pubkey())
+            .only_witness_utxo()
             .drain_wallet();
         let (psbt, _) = builder.finish().unwrap();
 
@@ -6016,20 +6068,18 @@
             .drain_wallet();
         let (psbt, _) = builder.finish().unwrap();
 
-        assert!(psbt.inputs[0].non_witness_utxo.is_none());
         assert!(psbt.inputs[0].witness_utxo.is_some());
     }
 
     #[test]
-    fn test_create_tx_both_non_witness_utxo_and_witness_utxo() {
+    fn test_create_tx_both_non_witness_utxo_and_witness_utxo_default() {
         let (wallet, _, _) =
             get_funded_wallet("wsh(pk(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW))");
         let addr = wallet.get_address(New).unwrap();
         let mut builder = wallet.build_tx();
         builder
             .set_single_recipient(addr.script_pubkey())
-            .drain_wallet()
-            .force_non_witness_utxo();
+            .drain_wallet();
         let (psbt, _) = builder.finish().unwrap();
 
         assert!(psbt.inputs[0].non_witness_utxo.is_some());
@@ -6167,6 +6217,7 @@
         let (wallet1, _, _) = get_funded_wallet(get_test_wpkh());
         let (wallet2, _, _) =
             get_funded_wallet("wpkh(cVbZ8ovhye9AoAHFsqobCf7LxbXDAECy9Kb8TZdfsDYMZGBUyCnm)");
+
         let addr = Address::from_str("2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX").unwrap();
         let utxo = wallet2.list_unspent().unwrap().remove(0);
         let foreign_utxo_satisfaction = wallet2
@@ -6182,6 +6233,7 @@
         let mut builder = wallet1.build_tx();
         builder
             .add_recipient(addr.script_pubkey(), 60_000)
+            .only_witness_utxo()
             .add_foreign_utxo(utxo.outpoint, psbt_input, foreign_utxo_satisfaction)
             .unwrap();
         let (mut psbt, details) = builder.finish().unwrap();
@@ -6201,14 +6253,30 @@
             "foreign_utxo should be in there"
         );
 
-        let finished = wallet1.sign(&mut psbt, None).unwrap();
+        let finished = wallet1
+            .sign(
+                &mut psbt,
+                SignOptions {
+                    trust_witness_utxo: true,
+                    ..Default::default()
+                },
+            )
+            .unwrap();
 
         assert!(
             !finished,
             "only one of the inputs should have been signed so far"
         );
 
-        let finished = wallet2.sign(&mut psbt, None).unwrap();
+        let finished = wallet2
+            .sign(
+                &mut psbt,
+                SignOptions {
+                    trust_witness_utxo: true,
+                    ..Default::default()
+                },
+            )
+            .unwrap();
         assert!(finished, "all the inputs should have been signed now");
     }
 
@@ -6286,7 +6354,7 @@
     }
 
     #[test]
-    fn test_add_foreign_utxo_force_non_witness_utxo() {
+    fn test_add_foreign_utxo_only_witness_utxo() {
         let (wallet1, _, _) = get_funded_wallet(get_test_wpkh());
         let (wallet2, _, txid2) =
             get_funded_wallet("wpkh(cVbZ8ovhye9AoAHFsqobCf7LxbXDAECy9Kb8TZdfsDYMZGBUyCnm)");
@@ -6299,9 +6367,7 @@
             .unwrap();
 
         let mut builder = wallet1.build_tx();
-        builder
-            .add_recipient(addr.script_pubkey(), 60_000)
-            .force_non_witness_utxo();
+        builder.add_recipient(addr.script_pubkey(), 60_000);
 
         {
             let mut builder = builder.clone();
@@ -6318,6 +6384,22 @@
             );
         }
 
+        {
+            let mut builder = builder.clone();
+            let psbt_input = psbt::Input {
+                witness_utxo: Some(utxo2.txout.clone()),
+                ..Default::default()
+            };
+            builder
+                .only_witness_utxo()
+                .add_foreign_utxo(utxo2.outpoint, psbt_input, satisfaction_weight)
+                .unwrap();
+            assert!(
+                builder.finish().is_ok(),
+                "psbt_input with just witness_utxo should succeed when `only_witness_utxo` is enabled"
+            );
+        }
+
         {
             let mut builder = builder.clone();
             let tx2 = wallet2
@@ -6337,7 +6419,7 @@
                 .unwrap();
             assert!(
                 builder.finish().is_ok(),
-                "psbt_input with non_witness_utxo should succeed with force_non_witness_utxo"
+                "psbt_input with non_witness_utxo should succeed by default"
             );
         }
     }
@@ -7229,7 +7311,7 @@
             .drain_wallet();
         let (mut psbt, _) = builder.finish().unwrap();
 
-        let finalized = wallet.sign(&mut psbt, None).unwrap();
+        let finalized = wallet.sign(&mut psbt, Default::default()).unwrap();
         assert_eq!(finalized, true);
 
         let extracted = psbt.extract_tx();
@@ -7246,7 +7328,7 @@
             .drain_wallet();
         let (mut psbt, _) = builder.finish().unwrap();
 
-        let finalized = wallet.sign(&mut psbt, None).unwrap();
+        let finalized = wallet.sign(&mut psbt, Default::default()).unwrap();
         assert_eq!(finalized, true);
 
         let extracted = psbt.extract_tx();
@@ -7263,7 +7345,7 @@
             .drain_wallet();
         let (mut psbt, _) = builder.finish().unwrap();
 
-        let finalized = wallet.sign(&mut psbt, None).unwrap();
+        let finalized = wallet.sign(&mut psbt, Default::default()).unwrap();
         assert_eq!(finalized, true);
 
         let extracted = psbt.extract_tx();
@@ -7280,7 +7362,7 @@
             .drain_wallet();
         let (mut psbt, _) = builder.finish().unwrap();
 
-        let finalized = wallet.sign(&mut psbt, None).unwrap();
+        let finalized = wallet.sign(&mut psbt, Default::default()).unwrap();
         assert_eq!(finalized, true);
 
         let extracted = psbt.extract_tx();
@@ -7298,7 +7380,7 @@
             .drain_wallet();
         let (mut psbt, _) = builder.finish().unwrap();
 
-        let finalized = wallet.sign(&mut psbt, None).unwrap();
+        let finalized = wallet.sign(&mut psbt, Default::default()).unwrap();
         assert_eq!(finalized, true);
 
         let extracted = psbt.extract_tx();
@@ -7318,7 +7400,7 @@
         psbt.inputs[0].bip32_derivation.clear();
         assert_eq!(psbt.inputs[0].bip32_derivation.len(), 0);
 
-        let finalized = wallet.sign(&mut psbt, None).unwrap();
+        let finalized = wallet.sign(&mut psbt, Default::default()).unwrap();
         assert_eq!(finalized, true);
 
         let extracted = psbt.extract_tx();
@@ -7367,7 +7449,15 @@
 
         psbt.inputs.push(dud_input);
         psbt.global.unsigned_tx.input.push(bitcoin::TxIn::default());
-        let is_final = wallet.sign(&mut psbt, None).unwrap();
+        let is_final = wallet
+            .sign(
+                &mut psbt,
+                SignOptions {
+                    trust_witness_utxo: true,
+                    ..Default::default()
+                },
+            )
+            .unwrap();
         assert!(
             !is_final,
             "shouldn't be final since we can't sign one of the inputs"
diff --git a/static/docs-rs/bdk/nightly/latest/src/bdk/wallet/signer.rs.html b/static/docs-rs/bdk/nightly/latest/src/bdk/wallet/signer.rs.html
index 87a5f5860f..f8a883989d 100644
--- a/static/docs-rs/bdk/nightly/latest/src/bdk/wallet/signer.rs.html
+++ b/static/docs-rs/bdk/nightly/latest/src/bdk/wallet/signer.rs.html
@@ -688,6 +688,60 @@
 685
 686
 687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
 
 // Bitcoin Dev Kit
 // Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
@@ -1118,6 +1172,43 @@
     }
 }
 
+/// Options for a software signer
+///
+/// Adjust the behavior of our software signers and the way a transaction is finalized
+#[derive(Debug, Clone)]
+pub struct SignOptions {
+    /// Whether the signer should trust the `witness_utxo`, if the `non_witness_utxo` hasn't been
+    /// provided
+    ///
+    /// Defaults to `false` to mitigate the "SegWit bug" which chould trick the wallet into
+    /// paying a fee larger than expected.
+    ///
+    /// Some wallets, especially if relatively old, might not provide the `non_witness_utxo` for
+    /// SegWit transactions in the PSBT they generate: in those cases setting this to `true`
+    /// should correctly produce a signature, at the expense of an increased trust in the creator
+    /// of the PSBT.
+    ///
+    /// For more details see: <https://blog.trezor.io/details-of-firmware-updates-for-trezor-one-version-1-9-1-and-trezor-model-t-version-2-3-1-1eba8f60f2dd>
+    pub trust_witness_utxo: bool,
+
+    /// Whether the wallet should assume a specific height has been reached when trying to finalize
+    /// a transaction
+    ///
+    /// The wallet will only "use" a timelock to satisfy the spending policy of an input if the
+    /// timelock height has already been reached. This option allows overriding the "current height" to let the
+    /// wallet use timelocks in the future to spend a coin.
+    pub assume_height: Option<u32>,
+}
+
+impl Default for SignOptions {
+    fn default() -> Self {
+        SignOptions {
+            trust_witness_utxo: false,
+            assume_height: None,
+        }
+    }
+}
+
 pub(crate) trait ComputeSighash {
     fn sighash(
         psbt: &psbt::PartiallySignedTransaction,
@@ -1183,20 +1274,37 @@
         }
 
         let psbt_input = &psbt.inputs[input_index];
+        let tx_input = &psbt.global.unsigned_tx.input[input_index];
 
         let sighash = psbt_input.sighash_type.unwrap_or(SigHashType::All);
 
-        let witness_utxo = psbt_input
-            .witness_utxo
-            .as_ref()
-            .ok_or(SignerError::MissingNonWitnessUtxo)?;
-        let value = witness_utxo.value;
+        // Always try first with the non-witness utxo
+        let utxo = if let Some(prev_tx) = &psbt_input.non_witness_utxo {
+            // Check the provided prev-tx
+            if prev_tx.txid() != tx_input.previous_output.txid {
+                return Err(SignerError::InvalidNonWitnessUtxo);
+            }
+
+            // The output should be present, if it's missing the `non_witness_utxo` is invalid
+            prev_tx
+                .output
+                .get(tx_input.previous_output.vout as usize)
+                .ok_or(SignerError::InvalidNonWitnessUtxo)?
+        } else if let Some(witness_utxo) = &psbt_input.witness_utxo {
+            // Fallback to the witness_utxo. If we aren't allowed to use it, signing should fail
+            // before we get to this point
+            witness_utxo
+        } else {
+            // Nothing has been provided
+            return Err(SignerError::MissingNonWitnessUtxo);
+        };
+        let value = utxo.value;
 
         let script = match psbt_input.witness_script {
             Some(ref witness_script) => witness_script.clone(),
             None => {
-                if witness_utxo.script_pubkey.is_v0_p2wpkh() {
-                    p2wpkh_script_code(&witness_utxo.script_pubkey)
+                if utxo.script_pubkey.is_v0_p2wpkh() {
+                    p2wpkh_script_code(&utxo.script_pubkey)
                 } else if psbt_input
                     .redeem_script
                     .as_ref()
diff --git a/static/docs-rs/bdk/nightly/latest/src/bdk/wallet/tx_builder.rs.html b/static/docs-rs/bdk/nightly/latest/src/bdk/wallet/tx_builder.rs.html
index 4462c8570b..45e2e157be 100644
--- a/static/docs-rs/bdk/nightly/latest/src/bdk/wallet/tx_builder.rs.html
+++ b/static/docs-rs/bdk/nightly/latest/src/bdk/wallet/tx_builder.rs.html
@@ -853,6 +853,7 @@
 850
 851
 852
+853
 
 // Bitcoin Dev Kit
 // Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
@@ -1002,7 +1003,7 @@
     pub(crate) rbf: Option<RbfValue>,
     pub(crate) version: Option<Version>,
     pub(crate) change_policy: ChangeSpendPolicy,
-    pub(crate) force_non_witness_utxo: bool,
+    pub(crate) only_witness_utxo: bool,
     pub(crate) add_global_xpubs: bool,
     pub(crate) include_output_redeem_witness_script: bool,
     pub(crate) bumping_fee: Option<PreviousFee>,
@@ -1192,10 +1193,10 @@
     /// 1. The `psbt_input` does not contain a `witness_utxo` or `non_witness_utxo`.
     /// 2. The data in `non_witness_utxo` does not match what is in `outpoint`.
     ///
-    /// Note if you set [`force_non_witness_utxo`] any `psbt_input` you pass to this method must
+    /// Note unless you set [`only_witness_utxo`] any `psbt_input` you pass to this method must
     /// have `non_witness_utxo` set otherwise you will get an error when [`finish`] is called.
     ///
-    /// [`force_non_witness_utxo`]: Self::force_non_witness_utxo
+    /// [`only_witness_utxo`]: Self::only_witness_utxo
     /// [`finish`]: Self::finish
     /// [`max_satisfaction_weight`]: miniscript::Descriptor::max_satisfaction_weight
     pub fn add_foreign_utxo(
@@ -1320,12 +1321,13 @@
         self
     }
 
-    /// Fill-in the [`psbt::Input::non_witness_utxo`](bitcoin::util::psbt::Input::non_witness_utxo) field even if the wallet only has SegWit
-    /// descriptors.
+    /// Only Fill-in the [`psbt::Input::witness_utxo`](bitcoin::util::psbt::Input::witness_utxo) field when spending from
+    /// SegWit descriptors.
     ///
-    /// This is useful for signers which always require it, like Trezor hardware wallets.
-    pub fn force_non_witness_utxo(&mut self) -> &mut Self {
-        self.params.force_non_witness_utxo = true;
+    /// This reduces the size of the PSBT, but some signers might reject them due to the lack of
+    /// the `non_witness_utxo`.
+    pub fn only_witness_utxo(&mut self) -> &mut Self {
+        self.params.only_witness_utxo = true;
         self
     }