implement unreserve

This commit is contained in:
julian 2023-10-13 12:48:17 -06:00
parent 63b03e5b57
commit 5b37b94668

View file

@ -318,6 +318,26 @@ mixin FusionWalletInterface {
broadcastTransaction: (String txHex) => _getWalletCachedElectrumX()
.electrumXClient
.broadcastTransaction(rawTx: txHex),
unReserveAddresses: (List<fusion.Address> addresses) async {
final List<Future<void>> futures = [];
for (final addr in addresses) {
futures.add(
_db.getAddress(_walletId, addr.address).then(
(address) async {
if (address == null) {
// matching address not found in db so cannot mark as unreserved
// just ignore I guess. Should never actually happen in practice.
// Might be useful check in debugging cases?
return;
} else {
await _unReserveAddress(address);
}
},
),
);
}
await Future.wait(futures);
},
);
// Add unfrozen stack UTXOs.