mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-19 01:04:43 +00:00
prevent transactions with < 6 confirmations from being used + hide mweb balances if mweb is off
This commit is contained in:
parent
0cd21f2fb6
commit
7ee8949a71
3 changed files with 35 additions and 4 deletions
|
@ -859,6 +859,36 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
|
|||
feeRatePerKb: Int64.parseInt(tx.feeRate) * 1000,
|
||||
));
|
||||
final tx2 = BtcTransaction.fromRaw(hex.encode(resp.rawTx));
|
||||
|
||||
// check if any of the inputs of this transaction are hog-ex:
|
||||
tx2.inputs.forEach((txInput) {
|
||||
bool isHogEx = true;
|
||||
|
||||
final utxo = unspentCoins
|
||||
.firstWhere((utxo) => utxo.hash == txInput.txId && utxo.vout == txInput.txIndex);
|
||||
|
||||
if (txInput.sequence.isEmpty) {
|
||||
isHogEx = false;
|
||||
}
|
||||
|
||||
// TODO: detect actual hog-ex inputs
|
||||
// print(txInput.sequence);
|
||||
// print(txInput.txIndex);
|
||||
// print(utxo.value);
|
||||
|
||||
if (!isHogEx) {
|
||||
return;
|
||||
}
|
||||
|
||||
int confirmations = utxo.confirmations ?? 0;
|
||||
if (confirmations < 6) {
|
||||
throw Exception(
|
||||
"A transaction input has less than 6 confirmations, please try again later.");
|
||||
}
|
||||
});
|
||||
|
||||
throw Exception("Not finished!");
|
||||
|
||||
tx.hexOverride = tx2
|
||||
.copyWith(
|
||||
witnesses: tx2.inputs.asMap().entries.map((e) {
|
||||
|
|
|
@ -369,14 +369,14 @@ abstract class BalanceViewModelBase with Store {
|
|||
}
|
||||
|
||||
bool _hasSecondAdditionalBalanceForWalletType(WalletType type) {
|
||||
if (wallet.type == WalletType.litecoin /*&& settingsStore.mwebEnabled*/) {
|
||||
if (wallet.type == WalletType.litecoin && settingsStore.mwebEnabled) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool _hasSecondAvailableBalanceForWalletType(WalletType type) {
|
||||
if (wallet.type == WalletType.litecoin /*&& settingsStore.mwebEnabled*/) {
|
||||
if (wallet.type == WalletType.litecoin && settingsStore.mwebEnabled) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -132,8 +132,8 @@ abstract class DashboardViewModelBase with Store {
|
|||
FilterItem(
|
||||
value: () => tradeFilterStore.displayLetsExchange,
|
||||
caption: ExchangeProviderDescription.letsExchange.title,
|
||||
onChanged: () =>
|
||||
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.letsExchange)),
|
||||
onChanged: () => tradeFilterStore
|
||||
.toggleDisplayExchange(ExchangeProviderDescription.letsExchange)),
|
||||
FilterItem(
|
||||
value: () => tradeFilterStore.displayStealthEx,
|
||||
caption: ExchangeProviderDescription.stealthEx.title,
|
||||
|
@ -443,6 +443,7 @@ abstract class DashboardViewModelBase with Store {
|
|||
settingsStore.hasEnabledMwebBefore = true;
|
||||
}
|
||||
|
||||
settingsStore.mwebEnabled = active;
|
||||
mwebScanningActive = active;
|
||||
bitcoin!.setMwebEnabled(wallet, active);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue