From: github-actions Date: Mon, 29 Aug 2022 08:38:34 +0000 (+0000) Subject: Publish autogenerated nightly docs X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/scripts/struct.NodeInfo.html?a=commitdiff_plain;h=95e9960b6a2b1c54f36daccc509b2b0526fa5221;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 e2f09d6b49..866d68db78 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/index.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk/wallet/index.html index 558a8f7f31..a014a082db 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/src/bdk/database/memory.rs.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/src/bdk/database/memory.rs.html index 9cd7b5383e..0f086f62a2 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 @@ -637,6 +637,25 @@ 630 631 632 +633 +634 +635 +636 +637 +638 +639 +640 +641 +642 +643 +644 +645 +646 +647 +648 +649 +650 +651
// Bitcoin Dev Kit
 // Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
 //
@@ -1125,7 +1144,8 @@
     }};
     ($db:expr, $tx_meta:expr, $current_height:expr, (@coinbase $is_coinbase:expr)$(,)?) => {{
         use std::str::FromStr;
-        use $crate::database::BatchOperations;
+        use $crate::database::SyncTime;
+        use $crate::database::{BatchOperations, Database};
         let mut db = $db;
         let tx_meta = $tx_meta;
         let current_height: Option<u32> = $current_height;
@@ -1151,14 +1171,32 @@
         };
 
         let txid = tx.txid();
+        // Set Confirmation time only if current height is provided.
+        // panics if `tx_meta.min_confirmation` is Some, and current_height is None.
         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,
+                height: current_height.expect("Current height is needed for testing transaction with min-confirmation values").checked_sub(conf as u32).unwrap() + 1,
                 timestamp: 0,
             });
 
+        // Set the database sync_time.
+        // Check if the current_height is less than already known sync height, apply the max
+        // If any of them is None, the other will be applied instead.
+        // If both are None, this will not be set.
+        if let Some(height) = db.get_sync_time().unwrap()
+                                .map(|sync_time| sync_time.block_time.height)
+                                .max(current_height) {
+            let sync_time = SyncTime {
+                block_time: BlockTime {
+                    height,
+                    timestamp: 0
+                }
+            };
+            db.set_sync_time(sync_time).unwrap();
+        }
+
         let tx_details = $crate::TransactionDetails {
             transaction: Some(tx.clone()),
             txid,
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 987fc2ee5f..edd459dc96 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
@@ -5422,6 +5422,58 @@
 5415
 5416
 5417
+5418
+5419
+5420
+5421
+5422
+5423
+5424
+5425
+5426
+5427
+5428
+5429
+5430
+5431
+5432
+5433
+5434
+5435
+5436
+5437
+5438
+5439
+5440
+5441
+5442
+5443
+5444
+5445
+5446
+5447
+5448
+5449
+5450
+5451
+5452
+5453
+5454
+5455
+5456
+5457
+5458
+5459
+5460
+5461
+5462
+5463
+5464
+5465
+5466
+5467
+5468
+5469
 
// Bitcoin Dev Kit
 // Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
 //
@@ -7350,6 +7402,12 @@
     // OP_PUSH.
     const P2WPKH_FAKE_WITNESS_SIZE: usize = 106;
 
+    #[test]
+    fn test_get_funded_wallet_balance() {
+        let (wallet, _, _) = get_funded_wallet(get_test_wpkh());
+        assert_eq!(wallet.get_balance().unwrap().confirmed, 50000);
+    }
+
     #[test]
     fn test_cache_addresses_fixed() {
         let db = MemoryDatabase::new();
@@ -7597,7 +7655,22 @@
 
     #[test]
     fn test_create_tx_default_locktime() {
-        let (wallet, _, _) = get_funded_wallet(get_test_wpkh());
+        let descriptors = testutils!(@descriptors (get_test_wpkh()));
+        let wallet = Wallet::new(
+            &descriptors.0,
+            None,
+            Network::Regtest,
+            AnyDatabase::Memory(MemoryDatabase::new()),
+        )
+        .unwrap();
+
+        let tx_meta = testutils! {
+                @tx ( (@external descriptors, 0) => 50_000 )
+        };
+
+        // Add the transaction to our db, but do not sync the db.
+        crate::populate_test_db!(wallet.database.borrow_mut(), tx_meta, None);
+
         let addr = wallet.get_address(New).unwrap();
         let mut builder = wallet.build_tx();
         builder.add_recipient(addr.script_pubkey(), 25_000);
@@ -7788,7 +7861,23 @@
 
     #[test]
     fn test_create_tx_default_sequence() {
-        let (wallet, _, _) = get_funded_wallet(get_test_wpkh());
+        let descriptors = testutils!(@descriptors (get_test_wpkh()));
+        let wallet = Wallet::new(
+            &descriptors.0,
+            None,
+            Network::Regtest,
+            AnyDatabase::Memory(MemoryDatabase::new()),
+        )
+        .unwrap();
+
+        let tx_meta = testutils! {
+                @tx ( (@external descriptors, 0) => 50_000 )
+        };
+
+        // Add the transaction to our db, but do not sync the db. Unsynced db
+        // should trigger the default sequence value for a new transaction as 0xFFFFFFFF
+        crate::populate_test_db!(wallet.database.borrow_mut(), tx_meta, None);
+
         let addr = wallet.get_address(New).unwrap();
         let mut builder = wallet.build_tx();
         builder.add_recipient(addr.script_pubkey(), 25_000);
@@ -8286,7 +8375,22 @@
 
     #[test]
     fn test_create_tx_policy_path_no_csv() {
-        let (wallet, _, _) = get_funded_wallet(get_test_a_or_b_plus_csv());
+        let descriptors = testutils!(@descriptors (get_test_wpkh()));
+        let wallet = Wallet::new(
+            &descriptors.0,
+            None,
+            Network::Regtest,
+            AnyDatabase::Memory(MemoryDatabase::new()),
+        )
+        .unwrap();
+
+        let tx_meta = testutils! {
+                @tx ( (@external descriptors, 0) => 50_000 )
+        };
+
+        // Add the transaction to our db, but do not sync the db. Unsynced db
+        // should trigger the default sequence value for a new transaction as 0xFFFFFFFF
+        crate::populate_test_db!(wallet.database.borrow_mut(), tx_meta, None);
 
         let external_policy = wallet.policies(KeychainKind::External).unwrap().unwrap();
         let root_id = external_policy.id;