chore(chain): relax miniscript
feature flag scope
Still enable the `persist` submodule without `miniscript` feature flag. Only disable `CombinedChangeSet`. Also stop `cargo clippy` from complaining about unused imports when `miniscript` is disabled.
This commit is contained in:
parent
9e97ac0330
commit
36e82ec686
@ -50,7 +50,6 @@ pub use descriptor_ext::{DescriptorExt, DescriptorId};
|
||||
mod spk_iter;
|
||||
#[cfg(feature = "miniscript")]
|
||||
pub use spk_iter::*;
|
||||
#[cfg(feature = "miniscript")]
|
||||
pub mod persist;
|
||||
pub mod spk_client;
|
||||
|
||||
|
@ -4,18 +4,16 @@
|
||||
//! The [`CombinedChangeSet`] type encapsulates a combination of [`crate`] structures that are
|
||||
//! typically persisted together.
|
||||
|
||||
use crate::{indexed_tx_graph, keychain, local_chain, Anchor, Append};
|
||||
#[cfg(feature = "async")]
|
||||
use alloc::boxed::Box;
|
||||
#[cfg(feature = "async")]
|
||||
use async_trait::async_trait;
|
||||
use bitcoin::Network;
|
||||
use core::convert::Infallible;
|
||||
use core::default::Default;
|
||||
use core::fmt::{Debug, Display};
|
||||
|
||||
/// A changeset containing [`crate`] structures typically persisted together.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[cfg(feature = "miniscript")]
|
||||
#[cfg_attr(
|
||||
feature = "serde",
|
||||
derive(crate::serde::Deserialize, crate::serde::Serialize),
|
||||
@ -28,28 +26,30 @@ use core::fmt::{Debug, Display};
|
||||
)
|
||||
)]
|
||||
pub struct CombinedChangeSet<K, A> {
|
||||
/// Changes to the [`LocalChain`](local_chain::LocalChain).
|
||||
pub chain: local_chain::ChangeSet,
|
||||
/// Changes to [`IndexedTxGraph`](indexed_tx_graph::IndexedTxGraph).
|
||||
pub indexed_tx_graph: indexed_tx_graph::ChangeSet<A, keychain::ChangeSet<K>>,
|
||||
/// Changes to the [`LocalChain`](crate::local_chain::LocalChain).
|
||||
pub chain: crate::local_chain::ChangeSet,
|
||||
/// Changes to [`IndexedTxGraph`](crate::indexed_tx_graph::IndexedTxGraph).
|
||||
pub indexed_tx_graph: crate::indexed_tx_graph::ChangeSet<A, crate::keychain::ChangeSet<K>>,
|
||||
/// Stores the network type of the transaction data.
|
||||
pub network: Option<Network>,
|
||||
pub network: Option<bitcoin::Network>,
|
||||
}
|
||||
|
||||
impl<K, A> Default for CombinedChangeSet<K, A> {
|
||||
#[cfg(feature = "miniscript")]
|
||||
impl<K, A> core::default::Default for CombinedChangeSet<K, A> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
chain: Default::default(),
|
||||
indexed_tx_graph: Default::default(),
|
||||
chain: core::default::Default::default(),
|
||||
indexed_tx_graph: core::default::Default::default(),
|
||||
network: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<K: Ord, A: Anchor> Append for CombinedChangeSet<K, A> {
|
||||
#[cfg(feature = "miniscript")]
|
||||
impl<K: Ord, A: crate::Anchor> crate::Append for CombinedChangeSet<K, A> {
|
||||
fn append(&mut self, other: Self) {
|
||||
Append::append(&mut self.chain, other.chain);
|
||||
Append::append(&mut self.indexed_tx_graph, other.indexed_tx_graph);
|
||||
crate::Append::append(&mut self.chain, other.chain);
|
||||
crate::Append::append(&mut self.indexed_tx_graph, other.indexed_tx_graph);
|
||||
if other.network.is_some() {
|
||||
debug_assert!(
|
||||
self.network.is_none() || self.network == other.network,
|
||||
@ -64,8 +64,9 @@ impl<K: Ord, A: Anchor> Append for CombinedChangeSet<K, A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, A> From<local_chain::ChangeSet> for CombinedChangeSet<K, A> {
|
||||
fn from(chain: local_chain::ChangeSet) -> Self {
|
||||
#[cfg(feature = "miniscript")]
|
||||
impl<K, A> From<crate::local_chain::ChangeSet> for CombinedChangeSet<K, A> {
|
||||
fn from(chain: crate::local_chain::ChangeSet) -> Self {
|
||||
Self {
|
||||
chain,
|
||||
..Default::default()
|
||||
@ -73,10 +74,13 @@ impl<K, A> From<local_chain::ChangeSet> for CombinedChangeSet<K, A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, A> From<indexed_tx_graph::ChangeSet<A, keychain::ChangeSet<K>>>
|
||||
#[cfg(feature = "miniscript")]
|
||||
impl<K, A> From<crate::indexed_tx_graph::ChangeSet<A, crate::keychain::ChangeSet<K>>>
|
||||
for CombinedChangeSet<K, A>
|
||||
{
|
||||
fn from(indexed_tx_graph: indexed_tx_graph::ChangeSet<A, keychain::ChangeSet<K>>) -> Self {
|
||||
fn from(
|
||||
indexed_tx_graph: crate::indexed_tx_graph::ChangeSet<A, crate::keychain::ChangeSet<K>>,
|
||||
) -> Self {
|
||||
Self {
|
||||
indexed_tx_graph,
|
||||
..Default::default()
|
||||
|
@ -4,9 +4,9 @@ use crate::{
|
||||
collections::BTreeMap, keychain::Indexed, local_chain::CheckPoint,
|
||||
ConfirmationTimeHeightAnchor, TxGraph,
|
||||
};
|
||||
use alloc::{boxed::Box, vec::Vec};
|
||||
use alloc::boxed::Box;
|
||||
use bitcoin::{OutPoint, Script, ScriptBuf, Txid};
|
||||
use core::{fmt::Debug, marker::PhantomData, ops::RangeBounds};
|
||||
use core::marker::PhantomData;
|
||||
|
||||
/// Data required to perform a spk-based blockchain client sync.
|
||||
///
|
||||
@ -158,12 +158,13 @@ impl SyncRequest {
|
||||
/// This consumes the [`SyncRequest`] and returns the updated one.
|
||||
#[cfg(feature = "miniscript")]
|
||||
#[must_use]
|
||||
pub fn populate_with_revealed_spks<K: Clone + Ord + Debug + Send + Sync>(
|
||||
pub fn populate_with_revealed_spks<K: Clone + Ord + core::fmt::Debug + Send + Sync>(
|
||||
self,
|
||||
index: &crate::keychain::KeychainTxOutIndex<K>,
|
||||
spk_range: impl RangeBounds<K>,
|
||||
spk_range: impl core::ops::RangeBounds<K>,
|
||||
) -> Self {
|
||||
use alloc::borrow::ToOwned;
|
||||
use alloc::vec::Vec;
|
||||
self.chain_spks(
|
||||
index
|
||||
.revealed_spks(spk_range)
|
||||
@ -223,7 +224,7 @@ impl<K: Ord + Clone> FullScanRequest<K> {
|
||||
index: &crate::keychain::KeychainTxOutIndex<K>,
|
||||
) -> Self
|
||||
where
|
||||
K: Debug,
|
||||
K: core::fmt::Debug,
|
||||
{
|
||||
let mut req = Self::from_chain_tip(chain_tip);
|
||||
for (keychain, spks) in index.all_unbounded_spk_iters() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user