-
Notifications
You must be signed in to change notification settings - Fork 331
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable existing Compact Filters module
This commit comments out existing compact filters module so only nakamoto dependencies get compiled with compact_filters features.
- Loading branch information
1 parent
fc7fa22
commit 0a14d45
Showing
8 changed files
with
2,302 additions
and
2,297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,46 @@ | ||
// Bitcoin Dev Kit | ||
// Written in 2020 by Alekos Filini <[email protected]> | ||
// | ||
// Copyright (c) 2020-2021 Bitcoin Dev Kit Developers | ||
// | ||
// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE | ||
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. | ||
// You may not use this file except in accordance with one or both of these | ||
// licenses. | ||
// // Bitcoin Dev Kit | ||
// // Written in 2020 by Alekos Filini <[email protected]> | ||
// // | ||
// // Copyright (c) 2020-2021 Bitcoin Dev Kit Developers | ||
// // | ||
// // This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE | ||
// // or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. | ||
// // You may not use this file except in accordance with one or both of these | ||
// // licenses. | ||
|
||
use bdk::blockchain::compact_filters::*; | ||
use bdk::database::MemoryDatabase; | ||
use bdk::*; | ||
use bitcoin::*; | ||
use blockchain::compact_filters::CompactFiltersBlockchain; | ||
use blockchain::compact_filters::CompactFiltersError; | ||
use log::info; | ||
use std::sync::Arc; | ||
// use bdk::blockchain::compact_filters::*; | ||
// use bdk::database::MemoryDatabase; | ||
// use bdk::*; | ||
// use bitcoin::*; | ||
// use blockchain::compact_filters::CompactFiltersBlockchain; | ||
// use blockchain::compact_filters::CompactFiltersError; | ||
// use log::info; | ||
// use std::sync::Arc; | ||
|
||
/// This will return wallet balance using compact filters | ||
/// Requires a synced local bitcoin node 0.21 running on testnet with blockfilterindex=1 and peerblockfilters=1 | ||
fn main() -> Result<(), CompactFiltersError> { | ||
env_logger::init(); | ||
info!("start"); | ||
// /// This will return wallet balance using compact filters | ||
// /// Requires a synced local bitcoin node 0.21 running on testnet with blockfilterindex=1 and peerblockfilters=1 | ||
// fn main() -> Result<(), CompactFiltersError> { | ||
// env_logger::init(); | ||
// info!("start"); | ||
|
||
let num_threads = 4; | ||
let mempool = Arc::new(Mempool::default()); | ||
let peers = (0..num_threads) | ||
.map(|_| Peer::connect("localhost:18333", Arc::clone(&mempool), Network::Testnet)) | ||
.collect::<Result<_, _>>()?; | ||
let blockchain = CompactFiltersBlockchain::new(peers, "./wallet-filters", Some(500_000))?; | ||
info!("done {:?}", blockchain); | ||
let descriptor = "wpkh(tpubD6NzVbkrYhZ4X2yy78HWrr1M9NT8dKeWfzNiQqDdMqqa9UmmGztGGz6TaLFGsLfdft5iu32gxq1T4eMNxExNNWzVCpf9Y6JZi5TnqoC9wJq/*)"; | ||
// let num_threads = 4; | ||
// let mempool = Arc::new(Mempool::default()); | ||
// let peers = (0..num_threads) | ||
// .map(|_| Peer::connect("localhost:18333", Arc::clone(&mempool), Network::Testnet)) | ||
// .collect::<Result<_, _>>()?; | ||
// let blockchain = CompactFiltersBlockchain::new(peers, "./wallet-filters", Some(500_000))?; | ||
// info!("done {:?}", blockchain); | ||
// let descriptor = "wpkh(tpubD6NzVbkrYhZ4X2yy78HWrr1M9NT8dKeWfzNiQqDdMqqa9UmmGztGGz6TaLFGsLfdft5iu32gxq1T4eMNxExNNWzVCpf9Y6JZi5TnqoC9wJq/*)"; | ||
|
||
// let database = MemoryDatabase::default(); | ||
// let wallet = Arc::new(Wallet::new(descriptor, None, Network::Testnet, database).unwrap()); | ||
// wallet.sync(&blockchain, SyncOptions::default()).unwrap(); | ||
// info!("balance: {}", wallet.get_balance()?); | ||
// Ok(()) | ||
// } | ||
|
||
// TODO make a nakamoto example | ||
fn main() { | ||
|
||
let database = MemoryDatabase::default(); | ||
let wallet = Arc::new(Wallet::new(descriptor, None, Network::Testnet, database).unwrap()); | ||
wallet.sync(&blockchain, SyncOptions::default()).unwrap(); | ||
info!("balance: {}", wallet.get_balance()?); | ||
Ok(()) | ||
} |
Oops, something went wrong.