Skip to content

Commit 911dd73

Browse files
committed
wollet: another test for Update v4 last update
1 parent 4029253 commit 911dd73

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

lwk_wollet/src/update.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,54 @@ mod test {
12011201
assert_eq!(update.last_unused.internal, 8);
12021202
}
12031203

1204+
#[test]
1205+
fn test_apply_v4_update_fetch_max_semantics() {
1206+
let desc: WolletDescriptor = lwk_test_util::wollet_descriptor_string().parse().unwrap();
1207+
let network = Network::default_regtest();
1208+
let mut wollet = WolletBuilder::new(network, desc).build().unwrap();
1209+
1210+
wollet
1211+
.apply_update(Update {
1212+
version: 4,
1213+
wollet_status: wollet.status(),
1214+
new_txs: DownloadTxResult::default(),
1215+
txid_height_new: vec![],
1216+
txid_height_delete: vec![],
1217+
timestamps: vec![],
1218+
scripts_with_blinding_pubkey: vec![],
1219+
tip: super::default_blockheader(),
1220+
unspent: vec![],
1221+
last_unused: LastUnused {
1222+
external: 7,
1223+
internal: 11,
1224+
},
1225+
})
1226+
.unwrap();
1227+
1228+
assert_eq!(wollet.address(None).unwrap().index(), 7);
1229+
1230+
wollet
1231+
.apply_update(Update {
1232+
version: 4,
1233+
wollet_status: wollet.status(),
1234+
new_txs: DownloadTxResult::default(),
1235+
txid_height_new: vec![],
1236+
txid_height_delete: vec![],
1237+
timestamps: vec![],
1238+
scripts_with_blinding_pubkey: vec![],
1239+
tip: super::default_blockheader(),
1240+
unspent: vec![],
1241+
last_unused: LastUnused {
1242+
external: 3,
1243+
internal: 5,
1244+
},
1245+
})
1246+
.unwrap();
1247+
1248+
assert_eq!(wollet.address(None).unwrap().index(), 7);
1249+
assert_eq!(wollet.change(None).unwrap().index(), 11);
1250+
}
1251+
12041252
#[test]
12051253
fn test_update_decription() {
12061254
let update = Update::deserialize(&lwk_test_util::update_test_vector_bytes()).unwrap();

0 commit comments

Comments
 (0)