mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
fix: prevent RBF for Silent Payment addresses in Bitcoin transactions (#2760)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user