Skip to content

Commit bd8737d

Browse files
committed
update last info index when registering inputs
1 parent b3927e4 commit bd8737d

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/wallet.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ define_entity_info!(Wallet, {
5151
/// Set of multi-party payjoin sessions that this wallet is participating in
5252
pub(crate) active_multi_party_payjoins: HashMap<BulletinBoardId, MultiPartyPayjoinSession>,
5353
/// UTXOs registered in the order book by this wallet
54-
// TODO: this should be moved to wallet data
5554
pub(crate) registered_inputs: OrdSet<Outpoint>,
5655
}
5756
);
@@ -439,13 +438,21 @@ impl<'a> WalletHandleMut<'a> {
439438
if self.info().registered_inputs.contains(outpoint) {
440439
return;
441440
}
442-
self.info_mut().registered_inputs.insert(*outpoint);
441+
let mut latest_info = self.info().clone();
442+
latest_info.registered_inputs.insert(*outpoint);
443+
self.update_info(latest_info);
443444
info!(
444445
"Wallet {:?} registered input {:?} in order book",
445446
self.id, outpoint
446447
);
447448
}
448449

450+
pub(crate) fn update_info(&mut self, info: WalletInfo) {
451+
let id = WalletInfoId(self.sim.wallet_info.len());
452+
self.sim.wallet_info.push(info);
453+
self.data_mut().last_wallet_info_id = id;
454+
}
455+
449456
pub(crate) fn do_action(&'a mut self, action: &Action) {
450457
match action {
451458
Action::Wait => {}

0 commit comments

Comments
 (0)