diff --git a/cw_bitcoin/lib/electrum_wallet.dart b/cw_bitcoin/lib/electrum_wallet.dart index c8609fd06..0dcc90d56 100644 --- a/cw_bitcoin/lib/electrum_wallet.dart +++ b/cw_bitcoin/lib/electrum_wallet.dart @@ -1956,10 +1956,9 @@ abstract class ElectrumWalletBase // that matches this received transaction, mark it as being from a peg out: for (final tx2 in transactionHistory.transactions.values) { final heightDiff = ((tx2.height ?? 0) - (tx.height ?? 0)).abs(); - // this isn't a perfect matching algorithm since we don't have the right input/output information from these transaction models (the addresses are in different formats), but this should be more than good enough for now as it's extremely unlikely a user receives the EXACT same amount from 2 different sources and one of them is a peg out and the other isn't AND the fees are also exactly the same within 5 blocks of each other + // this isn't a perfect matching algorithm since we don't have the right input/output information from these transaction models (the addresses are in different formats), but this should be more than good enough for now as it's extremely unlikely a user receives the EXACT same amount from 2 different sources and one of them is a peg out and the other isn't WITHIN 5 blocks of each other if (tx2.additionalInfo["isPegOut"] == true && tx2.amount == tx.amount && - tx2.fee == tx.fee && heightDiff <= 5) { tx.additionalInfo["fromPegOut"] = true; } diff --git a/cw_bitcoin/lib/litecoin_wallet.dart b/cw_bitcoin/lib/litecoin_wallet.dart index dafb73944..9a4b1965e 100644 --- a/cw_bitcoin/lib/litecoin_wallet.dart +++ b/cw_bitcoin/lib/litecoin_wallet.dart @@ -1039,7 +1039,6 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store { bool hasMwebInput = false; bool hasMwebOutput = false; - bool hasRegularInput = false; bool hasRegularOutput = false; for (final output in transactionCredentials.outputs) { @@ -1067,9 +1066,6 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store { if (utxo.utxo.scriptType == SegwitAddresType.mweb) { hasMwebInput = true; } - if (utxo.utxo.scriptType == SegwitAddresType.p2wpkh) { - hasRegularInput = true; - } } bool isPegIn = !hasMwebInput && hasMwebOutput; @@ -1127,18 +1123,13 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store { return tx ..addListener((transaction) async { - print( - "@@@@@@@@@@@@@@@@@@@@@@@@@############################# transaction: ${transaction.outputAddresses}"); final addresses = {}; transaction.inputAddresses?.forEach((id) async { - print("@@@@@@@@@@@@@@@@@@@@@@@@@ input address: $id"); final utxo = mwebUtxosBox.get(id); // await mwebUtxosBox.delete(id); // gets deleted in checkMwebUtxosSpent if (utxo == null) return; // mark utxo as spent so we add it to the unconfirmed balance (as negative): utxo.spent = true; - print( - "@@@@@@@@@@@@@@@@@@@@@@@@@ spent utxo: ${utxo.outputId} ${utxo.height} ${utxo.value}"); await mwebUtxosBox.put(id, utxo); final addressRecord = walletAddresses.allAddresses .firstWhere((addressRecord) => addressRecord.address == utxo.address);