Skip to content

Commit

Permalink
Update get_utxos fn, fix locked_utxos bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sosaucily authored and Tibo-lg committed Sep 7, 2023
1 parent a127853 commit 4592f9d
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions simple-wallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,24 +257,25 @@ where
.coin_select(self, Vec::new(), utxos, fee_rate, amount, &dummy_drain)
.map_err(|e| Error::WalletError(Box::new(e)))?;
let mut res = Vec::new();
if lock_utxos {
for utxo in selection.selected {
let local_utxo = if let BdkUtxo::Local(l) = utxo {
l
} else {
panic!();
};
let org = org_utxos
.iter()
.find(|x| x.tx_out == local_utxo.txout && x.outpoint == local_utxo.outpoint)
.unwrap();
for utxo in selection.selected {
let local_utxo = if let BdkUtxo::Local(l) = utxo {
l
} else {
panic!();
};
let org = org_utxos
.iter()
.find(|x| x.tx_out == local_utxo.txout && x.outpoint == local_utxo.outpoint)
.unwrap();
if lock_utxos {
let updated = Utxo {
reserved: true,
..org.clone()
};
res.push(org.clone());
self.storage.upsert_utxo(&updated)?;
}
res.push(org.clone());

}
Ok(res)
}
Expand Down

0 comments on commit 4592f9d

Please sign in to comment.