fix: prevent RBF for Silent Payment addresses in Bitcoin transactions (#2760)

This commit is contained in:
Konstantin Ullrich
2025-12-23 02:29:30 +01:00
committed by GitHub
parent efcd38e6b1
commit 6e9d76e457
@@ -1,3 +1,4 @@
import 'package:cake_wallet/core/address_validator.dart';
import 'package:cake_wallet/tron/tron.dart';
import 'package:cake_wallet/wownero/wownero.dart';
import 'package:cw_core/currency_for_wallet_type.dart';
@@ -947,6 +948,16 @@ abstract class TransactionDetailsViewModelBase with Store {
Future<void> _checkForRBF(TransactionInfo tx) async {
if (wallet.type == WalletType.bitcoin &&
transactionInfo.direction == TransactionDirection.outgoing) {
final descriptionKey = '${transactionInfo.txHash}_${wallet.walletAddresses.primaryAddress}';
final description = transactionDescriptionBox.values
.firstWhereOrNull((val) => val.id == descriptionKey || val.id == transactionInfo.txHash);
if (RegExp(AddressValidator.silentPaymentAddressPatternMainnet)
.hasMatch(description?.recipientAddress ?? "")) {
canReplaceByFee = false;
return;
}
rawTransaction = await bitcoin!.canReplaceByFee(wallet, tx);
if (rawTransaction != null) {
canReplaceByFee = true;