Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion crates/sage-wallet/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,17 @@ impl Wallet {
ctx: &mut SpendContext,
spends: &mut Spends,
actions: &[Action],
) -> Result<(), WalletError> {
self.select_spends_excluding(ctx, spends, actions, &[])
.await
}

pub async fn select_spends_excluding(
&self,
ctx: &mut SpendContext,
spends: &mut Spends,
actions: &[Action],
excluded_coin_ids: &[Bytes32],
) -> Result<(), WalletError> {
let mut deltas = Deltas::from_actions(actions);

Expand All @@ -199,8 +210,9 @@ impl Wallet {
deltas.update(id).input += cat.selected_amount();
}

let selected_coin_ids: HashSet<Bytes32> =
let mut selected_coin_ids: HashSet<Bytes32> =
spends.non_settlement_coin_ids().into_iter().collect();
selected_coin_ids.extend(excluded_coin_ids);

for &id in deltas.ids() {
let delta = deltas.get(&id).copied().unwrap_or_default();
Expand Down
Loading
Loading