Skip to content

Commit bf9a904

Browse files
committed
deprecate wallet::ChangeSet fields
Since these fields(`descriptor`, `change_descriptor`) will be replaced by `keyring` when we have the multi-keychain wallet.
1 parent c422104 commit bf9a904

4 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/persist_test_utils.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ fn spk_at_index(descriptor: &Descriptor<DescriptorPublicKey>, index: u32) -> Scr
7474
/// We create a dummy [`ChangeSet`], persist it and check if loaded [`ChangeSet`] matches
7575
/// the persisted one. We then create another such dummy [`ChangeSet`], persist it and load it to
7676
/// check if merged [`ChangeSet`] is returned.
77+
#[allow(deprecated)]
7778
pub fn persist_wallet_changeset<Store, CreateStore>(filename: &str, create_store: CreateStore)
7879
where
7980
CreateStore: Fn(&Path) -> anyhow::Result<Store>,
@@ -250,6 +251,7 @@ where
250251
/// We create a dummy [`ChangeSet`] for first wallet and persist it then we create a dummy
251252
/// [`ChangeSet`] for second wallet and persist that. Finally we load these two [`ChangeSet`]s and
252253
/// check if they were persisted correctly.
254+
#[allow(deprecated)]
253255
pub fn persist_multiple_wallet_changesets<Store, CreateStores>(
254256
filename: &str,
255257
create_dbs: CreateStores,
@@ -357,6 +359,7 @@ where
357359
///
358360
/// We create a dummy [`ChangeSet`] with only descriptor fields populated, persist it and check if
359361
/// loaded [`ChangeSet`] has the same descriptors as what we persisted.
362+
#[allow(deprecated)]
360363
pub fn persist_keychains<Store, CreateStore>(filename: &str, create_store: CreateStore)
361364
where
362365
CreateStore: Fn(&Path) -> anyhow::Result<Store>,
@@ -399,6 +402,7 @@ where
399402
///
400403
/// We create a dummy [`ChangeSet`] with only descriptor field populated, persist it and check if
401404
/// loaded [`ChangeSet`] has the same descriptor as what we persisted.
405+
#[allow(deprecated)]
402406
pub fn persist_single_keychain<Store, CreateStore>(filename: &str, create_store: CreateStore)
403407
where
404408
CreateStore: Fn(&Path) -> anyhow::Result<Store>,

src/wallet/changeset.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ type IndexedTxGraphChangeSet =
105105
#[derive(Default, Debug, Clone, PartialEq, Deserialize, Serialize)]
106106
pub struct ChangeSet {
107107
/// Descriptor for recipient addresses.
108+
#[deprecated(since = "3.0.0", note = "To be removed in v5.0")]
108109
pub descriptor: Option<Descriptor<DescriptorPublicKey>>,
109110
/// Descriptor for change addresses.
111+
#[deprecated(since = "3.0.0", note = "To be removed in v5.0")]
110112
pub change_descriptor: Option<Descriptor<DescriptorPublicKey>>,
111113
/// Stores the network type of the transaction data.
112114
pub network: Option<bitcoin::Network>,
@@ -122,6 +124,7 @@ pub struct ChangeSet {
122124

123125
impl Merge for ChangeSet {
124126
/// Merge another [`ChangeSet`] into itself.
127+
#[allow(deprecated)]
125128
fn merge(&mut self, other: Self) {
126129
if other.descriptor.is_some() {
127130
debug_assert!(
@@ -154,6 +157,7 @@ impl Merge for ChangeSet {
154157
Merge::merge(&mut self.indexer, other.indexer);
155158
}
156159

160+
#[allow(deprecated)]
157161
fn is_empty(&self) -> bool {
158162
self.descriptor.is_none()
159163
&& self.change_descriptor.is_none()
@@ -215,6 +219,7 @@ impl ChangeSet {
215219
}
216220

217221
/// Recover a [`ChangeSet`] from sqlite database.
222+
#[allow(deprecated)]
218223
pub fn from_sqlite(db_tx: &chain::rusqlite::Transaction) -> chain::rusqlite::Result<Self> {
219224
use bitcoin::{OutPoint, Txid};
220225
use chain::rusqlite::OptionalExtension;
@@ -269,6 +274,7 @@ impl ChangeSet {
269274
}
270275

271276
/// Persist [`ChangeSet`] to sqlite database.
277+
#[allow(deprecated)]
272278
pub fn persist_to_sqlite(
273279
&self,
274280
db_tx: &chain::rusqlite::Transaction,

src/wallet/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ impl Wallet {
309309
/// Create a new [`Wallet`] with given `params`.
310310
///
311311
/// Refer to [`Wallet::create`] for more.
312+
#[allow(deprecated)]
312313
pub fn create_with_params(params: CreateParams) -> Result<Self, DescriptorError> {
313314
let secp = SecpCtx::new();
314315
let network = params.network;
@@ -428,6 +429,7 @@ impl Wallet {
428429
/// Load [`Wallet`] from the given previously persisted [`ChangeSet`] and `params`.
429430
///
430431
/// Returns `Ok(None)` if the changeset is empty. Refer to [`Wallet::load`] for more.
432+
#[allow(deprecated)]
431433
pub fn load_with_params(
432434
changeset: ChangeSet,
433435
params: LoadParams,

src/wallet/persisted.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ impl<E: fmt::Display> fmt::Display for CreateWithPersistError<E> {
393393
impl<E: fmt::Debug + fmt::Display> std::error::Error for CreateWithPersistError<E> {}
394394

395395
/// Helper function to display basic information about a [`ChangeSet`].
396+
#[allow(deprecated)]
396397
fn changeset_info(f: &mut fmt::Formatter<'_>, changeset: &ChangeSet) -> fmt::Result {
397398
let network = changeset
398399
.network

0 commit comments

Comments
 (0)