From: github-actions Date: Wed, 6 Jul 2022 14:48:23 +0000 (+0000) Subject: Publish autogenerated nightly docs X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/scripts/static/struct.Miniscript.html?a=commitdiff_plain;h=cdc639ec32f084db626c264a19aeefe6166c81d1;p=bitcoindevkit.org Publish autogenerated nightly docs --- diff --git a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/database/memory/index.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/database/memory/index.html index 817a2e8446..e2f09d6b49 100644 --- a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/database/memory/index.html +++ b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/database/memory/index.html @@ -6,7 +6,7 @@ logo

Module memory

logo
-

Module bdk::database::memory

source · []
Expand description

In-memory ephemeral database

+

Module bdk::database::memory

source · []
Expand description

In-memory ephemeral database

This module defines an in-memory database type called MemoryDatabase that is based on a BTreeMap.

Structs

diff --git a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/fn.get_funded_wallet.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/fn.get_funded_wallet.html index 3f9d1e9799..e4015f1136 100644 --- a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/fn.get_funded_wallet.html +++ b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/fn.get_funded_wallet.html @@ -6,6 +6,6 @@ logo
logo
pub fn get_funded_wallet(
    descriptor: &str
) -> (Wallet<AnyDatabase>, (String, Option<String>), Txid)
Expand description

Return a fake wallet that appears to be funded for testing.

+

Function bdk::wallet::get_funded_wallet

source · []
pub fn get_funded_wallet(
    descriptor: &str
) -> (Wallet<AnyDatabase>, (String, Option<String>), Txid)
Expand description

Return a fake wallet that appears to be funded for testing.

\ No newline at end of file diff --git a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/fn.wallet_name_from_descriptor.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/fn.wallet_name_from_descriptor.html index 6580a58edc..5b69b7a33b 100644 --- a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/fn.wallet_name_from_descriptor.html +++ b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/fn.wallet_name_from_descriptor.html @@ -6,7 +6,7 @@ logo
logo
pub fn wallet_name_from_descriptor<T>(
    descriptor: T,
    change_descriptor: Option<T>,
    network: Network,
    secp: &Secp256k1<All>
) -> Result<String, Error> where
    T: IntoWalletDescriptor
Expand description

Deterministically generate a unique name given the descriptors defining the wallet

+

Function bdk::wallet::wallet_name_from_descriptor

source · []
pub fn wallet_name_from_descriptor<T>(
    descriptor: T,
    change_descriptor: Option<T>,
    network: Network,
    secp: &Secp256k1<All>
) -> Result<String, Error> where
    T: IntoWalletDescriptor
Expand description

Deterministically generate a unique name given the descriptors defining the wallet

Compatible with wallet_name_from_descriptor

\ No newline at end of file diff --git a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/index.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/index.html index 4e95a97936..d2cb3340fd 100644 --- a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/index.html +++ b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/index.html @@ -6,7 +6,7 @@ logo

Module wallet

logo
-

Module bdk::wallet

source · []
Expand description

Wallet

+

Module bdk::wallet

source · []
Expand description

Wallet

This module defines the Wallet structure.

Modules

Address validation callbacks

diff --git a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/struct.Wallet.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/struct.Wallet.html index 3be7f893bb..19452c801e 100644 --- a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/struct.Wallet.html +++ b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/struct.Wallet.html @@ -14,7 +14,7 @@ Its main components are:

  • A Database where it tracks transactions and utxos related to the descriptors.
  • signers that can contribute signatures to addresses instantiated from the descriptors.
  • -

    Implementations

    👎 Deprecated:

    Just use Wallet::new – all wallets are offline now!

    +

    Implementations

    👎 Deprecated:

    Just use Wallet::new – all wallets are offline now!

    Create a new “offline” wallet

    Create a wallet.

    The only way this can fail is if the descriptors passed in do not match the checksums in database.

    @@ -77,7 +77,7 @@ wallet’s database.

    }; // sign and broadcast ...
    -

    Bump the fee of a transaction previously created with this wallet.

    +

    Bump the fee of a transaction previously created with this wallet.

    Returns an error if the transaction is already confirmed or doesn’t explicitly signal replace by fee (RBF). If the transaction can be fee bumped then it returns a TxBuilder pre-populated with the inputs and outputs of the original transaction.

    @@ -102,7 +102,7 @@ pre-populated with the inputs and outputs of the original transaction.

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

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

    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 @@ -116,18 +116,18 @@ in this library will.

    }; let finalized = wallet.sign(&mut psbt, SignOptions::default())?; assert!(finalized, "we should have signed all the inputs");
    -

    Return the spending policies for the wallet’s descriptor

    -

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

    Return the spending policies for the wallet’s descriptor

    +

    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

    -

    Try to finalize a PSBT

    +

    Try to finalize a PSBT

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

    -

    Return the secp256k1 context used for all signing operations

    -

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

    -

    get the corresponding PSBT Input for a LocalUtxo

    -

    Return an immutable reference to the internal database

    -

    Sync the internal database with the blockchain

    -

    Return the checksum of the public descriptor associated to keychain

    +

    Return the secp256k1 context used for all signing operations

    +

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

    +

    get the corresponding PSBT Input for a LocalUtxo

    +

    Return an immutable reference to the internal database

    +

    Sync the internal database with the blockchain

    +

    Return the checksum of the public descriptor associated to keychain

    Internally calls Self::get_descriptor_for_keychain to fetch the right descriptor

    Trait Implementations

    Formats the value using the given formatter. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    diff --git a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/src/bdk/database/memory.rs.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/src/bdk/database/memory.rs.html index 6eff42dbe7..9cd7b5383e 100644 --- a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/src/bdk/database/memory.rs.html +++ b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/src/bdk/database/memory.rs.html @@ -634,6 +634,9 @@ 627 628 629 +630 +631 +632
    // Bitcoin Dev Kit
     // Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
     //
    @@ -1148,10 +1151,13 @@
             };
     
             let txid = tx.txid();
    -        let confirmation_time = tx_meta.min_confirmations.map(|conf| $crate::BlockTime {
    -            height: current_height.unwrap().checked_sub(conf as u32).unwrap(),
    -            timestamp: 0,
    -        });
    +        let confirmation_time = tx_meta
    +            .min_confirmations
    +            .and_then(|v| if v == 0 { None } else { Some(v) })
    +            .map(|conf| $crate::BlockTime {
    +                height: current_height.unwrap().checked_sub(conf as u32).unwrap() + 1,
    +                timestamp: 0,
    +            });
     
             let tx_details = $crate::TransactionDetails {
                 transaction: Some(tx.clone()),
    diff --git a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/src/bdk/wallet/mod.rs.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/src/bdk/wallet/mod.rs.html
    index 00e7b44e73..2d6ce6cc65 100644
    --- a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/src/bdk/wallet/mod.rs.html
    +++ b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/src/bdk/wallet/mod.rs.html
    @@ -4783,6 +4783,96 @@
     4776
     4777
     4778
    +4779
    +4780
    +4781
    +4782
    +4783
    +4784
    +4785
    +4786
    +4787
    +4788
    +4789
    +4790
    +4791
    +4792
    +4793
    +4794
    +4795
    +4796
    +4797
    +4798
    +4799
    +4800
    +4801
    +4802
    +4803
    +4804
    +4805
    +4806
    +4807
    +4808
    +4809
    +4810
    +4811
    +4812
    +4813
    +4814
    +4815
    +4816
    +4817
    +4818
    +4819
    +4820
    +4821
    +4822
    +4823
    +4824
    +4825
    +4826
    +4827
    +4828
    +4829
    +4830
    +4831
    +4832
    +4833
    +4834
    +4835
    +4836
    +4837
    +4838
    +4839
    +4840
    +4841
    +4842
    +4843
    +4844
    +4845
    +4846
    +4847
    +4848
    +4849
    +4850
    +4851
    +4852
    +4853
    +4854
    +4855
    +4856
    +4857
    +4858
    +4859
    +4860
    +4861
    +4862
    +4863
    +4864
    +4865
    +4866
    +4867
    +4868
     
    // Bitcoin Dev Kit
     // Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
     //
    @@ -5684,8 +5774,6 @@
         /// # Ok::<(), bdk::Error>(())
         /// ```
         // TODO: support for merging multiple transactions while bumping the fees
    -    // TODO: option to force addition of an extra output? seems bad for privacy to update the
    -    // change
         pub fn build_fee_bump(
             &self,
             txid: Txid,
    @@ -7049,7 +7137,6 @@
                 .drain_to(drain_addr.script_pubkey())
                 .drain_wallet();
             let (psbt, details) = builder.finish().unwrap();
    -        dbg!(&psbt);
             let outputs = psbt.unsigned_tx.output;
     
             assert_eq!(outputs.len(), 2);
    @@ -8646,6 +8733,99 @@
             assert_eq!(details.fee.unwrap_or(0), 250);
         }
     
    +    #[test]
    +    #[should_panic(expected = "InsufficientFunds")]
    +    fn test_bump_fee_unconfirmed_inputs_only() {
    +        // We try to bump the fee, but:
    +        // - We can't reduce the change, as we have no change
    +        // - All our UTXOs are unconfirmed
    +        // So, we fail with "InsufficientFunds", as per RBF rule 2:
    +        // The replacement transaction may only include an unconfirmed input
    +        // if that input was included in one of the original transactions.
    +        let (wallet, descriptors, _) = get_funded_wallet(get_test_wpkh());
    +        let addr = Address::from_str("2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX").unwrap();
    +        let mut builder = wallet.build_tx();
    +        builder
    +            .drain_wallet()
    +            .drain_to(addr.script_pubkey())
    +            .enable_rbf();
    +        let (psbt, mut original_details) = builder.finish().unwrap();
    +        // Now we receive one transaction with 0 confirmations. We won't be able to use that for
    +        // fee bumping, as it's still unconfirmed!
    +        crate::populate_test_db!(
    +            wallet.database.borrow_mut(),
    +            testutils! (@tx ( (@external descriptors, 0) => 25_000 ) (@confirmations 0)),
    +            Some(100),
    +        );
    +        let mut tx = psbt.extract_tx();
    +        let txid = tx.txid();
    +        for txin in &mut tx.input {
    +            txin.witness.push([0x00; 108]); // fake signature
    +            wallet
    +                .database
    +                .borrow_mut()
    +                .del_utxo(&txin.previous_output)
    +                .unwrap();
    +        }
    +        original_details.transaction = Some(tx);
    +        wallet
    +            .database
    +            .borrow_mut()
    +            .set_tx(&original_details)
    +            .unwrap();
    +
    +        let mut builder = wallet.build_fee_bump(txid).unwrap();
    +        builder.fee_rate(FeeRate::from_sat_per_vb(25.0));
    +        builder.finish().unwrap();
    +    }
    +
    +    #[test]
    +    fn test_bump_fee_unconfirmed_input() {
    +        // We create a tx draining the wallet and spending one confirmed
    +        // and one unconfirmed UTXO. We check that we can fee bump normally
    +        // (BIP125 rule 2 only apply to newly added unconfirmed input, you can
    +        // always fee bump with an unconfirmed input if it was included in the
    +        // original transaction)
    +        let (wallet, descriptors, _) = get_funded_wallet(get_test_wpkh());
    +        let addr = Address::from_str("2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX").unwrap();
    +        // We receive a tx with 0 confirmations, which will be used as an input
    +        // in the drain tx.
    +        crate::populate_test_db!(
    +            wallet.database.borrow_mut(),
    +            testutils! (@tx ( (@external descriptors, 0) => 25_000 ) (@confirmations 0)),
    +            Some(100),
    +        );
    +        let mut builder = wallet.build_tx();
    +        builder
    +            .drain_wallet()
    +            .drain_to(addr.script_pubkey())
    +            .enable_rbf();
    +        let (psbt, mut original_details) = builder.finish().unwrap();
    +        let mut tx = psbt.extract_tx();
    +        let txid = tx.txid();
    +        for txin in &mut tx.input {
    +            txin.witness.push([0x00; 108]); // fake signature
    +            wallet
    +                .database
    +                .borrow_mut()
    +                .del_utxo(&txin.previous_output)
    +                .unwrap();
    +        }
    +        original_details.transaction = Some(tx);
    +        wallet
    +            .database
    +            .borrow_mut()
    +            .set_tx(&original_details)
    +            .unwrap();
    +
    +        let mut builder = wallet.build_fee_bump(txid).unwrap();
    +        builder
    +            .fee_rate(FeeRate::from_sat_per_vb(15.0))
    +            .allow_shrinking(addr.script_pubkey())
    +            .unwrap();
    +        builder.finish().unwrap();
    +    }
    +
         #[test]
         fn test_sign_single_xprv() {
             let (wallet, _, _) = get_funded_wallet("wpkh(tprv8ZgxMBicQKsPd3EupYiPRhaMooHKUHJxNsTfYuScep13go8QFfHdtkG9nRkFGb7busX4isf6X9dURGCoKgitaApQ6MupRhZMcELAxTBRJgS/*)");
    @@ -9510,7 +9690,7 @@
     
             crate::populate_test_db!(
                 wallet.database.borrow_mut(),
    -            testutils! (@tx ( (@external descriptors, 0) => 25_000 ) (@confirmations 0)),
    +            testutils! (@tx ( (@external descriptors, 0) => 25_000 ) (@confirmations 1)),
                 Some(confirmation_time),
                 (@coinbase true)
             );