Normal fee for non-mweb txns

This commit is contained in:
Hector Chu 2024-04-25 23:13:41 +01:00
parent c96424256e
commit b1caf79c1b
2 changed files with 8 additions and 0 deletions

View file

@ -1250,6 +1250,7 @@ abstract class ElectrumWalletBase
totalConfirmed += confirmed;
totalUnconfirmed += unconfirmed;
addressRecord.balance = confirmed + unconfirmed;
if (confirmed > 0 || unconfirmed > 0) {
addressRecord.setAsUsed();
}

View file

@ -291,6 +291,13 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
String? memo,
required int feeRate}) async {
final spendsMweb = utxos.any((utxo) => utxo.utxo.scriptType == SegwitAddresType.mweb);
final paysToMweb = outputs.any((output) =>
output.toOutput.scriptPubKey.getAddressType() == SegwitAddresType.mweb);
if (!spendsMweb && !paysToMweb) {
return await super.calcFee(utxos: utxos, outputs: outputs,
network: network, memo: memo, feeRate: feeRate);
}
final txb = BitcoinTransactionBuilder(utxos: utxos,
outputs: outputs, fee: BigInt.zero, network: network);
final scanSecret = mwebHd.derive(0x80000000).privKey!;