Skip to content

Commit 834b6cd

Browse files
committed
test-utils: Update persist_wallet_changeset to persist locked outpoints
1 parent 12aed94 commit 834b6cd

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/persist_test_utils.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::{
99
keychain_txout::{self},
1010
local_chain, tx_graph, ConfirmationBlockTime, DescriptorExt, Merge, SpkIterator,
1111
},
12+
locked_outpoints,
1213
miniscript::descriptor::{Descriptor, DescriptorPublicKey},
1314
ChangeSet, WalletPersister,
1415
};
@@ -113,11 +114,13 @@ where
113114
confirmation_time: 1755317160,
114115
};
115116

117+
let outpoint = OutPoint::new(hash!("Rust"), 0);
118+
116119
let tx_graph_changeset = tx_graph::ChangeSet::<ConfirmationBlockTime> {
117120
txs: [tx1.clone()].into(),
118121
txouts: [
119122
(
120-
OutPoint::new(hash!("Rust"), 0),
123+
outpoint,
121124
TxOut {
122125
value: Amount::from_sat(1300),
123126
script_pubkey: spk_at_index(&descriptor, 4),
@@ -157,14 +160,18 @@ where
157160
.into(),
158161
};
159162

163+
let locked_outpoints_changeset = locked_outpoints::ChangeSet {
164+
outpoints: [(outpoint, true)].into(),
165+
};
166+
160167
let mut changeset = ChangeSet {
161168
descriptor: Some(descriptor.clone()),
162169
change_descriptor: Some(change_descriptor.clone()),
163170
network: Some(Network::Testnet),
164171
local_chain: local_chain_changeset,
165172
tx_graph: tx_graph_changeset,
166173
indexer: keychain_txout_changeset,
167-
locked_outpoints: Default::default(),
174+
locked_outpoints: locked_outpoints_changeset,
168175
};
169176

170177
// persist and load
@@ -185,10 +192,12 @@ where
185192
confirmation_time: 1755317760,
186193
};
187194

195+
let outpoint = OutPoint::new(hash!("Bitcoin_fixes_things"), 1);
196+
188197
let tx_graph_changeset = tx_graph::ChangeSet::<ConfirmationBlockTime> {
189198
txs: [tx2.clone()].into(),
190199
txouts: [(
191-
OutPoint::new(hash!("Bitcoin_fixes_things"), 0),
200+
outpoint,
192201
TxOut {
193202
value: Amount::from_sat(10000),
194203
script_pubkey: spk_at_index(&descriptor, 21),
@@ -210,14 +219,18 @@ where
210219
.into(),
211220
};
212221

222+
let locked_outpoints_changeset = locked_outpoints::ChangeSet {
223+
outpoints: [(outpoint, true)].into(),
224+
};
225+
213226
let changeset_new = ChangeSet {
214227
descriptor: None,
215228
change_descriptor: None,
216229
network: None,
217230
local_chain: local_chain_changeset,
218231
tx_graph: tx_graph_changeset,
219232
indexer: keychain_txout_changeset,
220-
locked_outpoints: Default::default(),
233+
locked_outpoints: locked_outpoints_changeset,
221234
};
222235

223236
// persist, load and check if same as merged

0 commit comments

Comments
 (0)