default to locked if mn collat call fails for safety reasons

This commit is contained in:
julian 2024-06-25 12:53:28 -06:00
parent 7f0d4bc126
commit eb7aa24a0a
2 changed files with 14 additions and 7 deletions

View file

@ -1165,7 +1165,7 @@ class ElectrumXClient {
level: LogLevel.Info,
);
return response as bool? ?? false;
return response as bool;
} catch (e) {
Logging.instance.log(e, level: LogLevel.Error);
rethrow;

View file

@ -631,16 +631,23 @@ class FiroWallet<T extends ElectrumXCurrencyInterface> extends Bip39HDWallet<T>
BigInt.from(jsonUTXO["value"] as int);
if (blocked) {
blocked = await electrumXClient.isMasterNodeCollateral(
txid: jsonTX!["txid"] as String,
index: jsonUTXO["tx_pos"] as int,
);
try {
blocked = await electrumXClient.isMasterNodeCollateral(
txid: jsonTX!["txid"] as String,
index: jsonUTXO["tx_pos"] as int,
);
} catch (_) {
// call failed, lock utxo just in case
// it should logically already be blocked
// but just in case
blocked = true;
}
}
if (blocked) {
blockedReason = "Masternode collateral. "
blockedReason = "Possible masternode collateral. "
"Unlock and spend at your own risk.";
label = "Masternode collateral";
label = "Possible masternode collateral";
}
}