dirty peercoin fee calc hack

This commit is contained in:
julian 2024-05-10 15:54:41 -06:00
parent 1b8fb18c74
commit e5d89f15bd
2 changed files with 14 additions and 13 deletions

View file

@ -49,22 +49,21 @@ class PeercoinWallet extends Bip39HDWallet
@override
Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) {
// TODO: check ppc fee stuff
throw Exception("TODO");
// return Amount(
// rawValue: BigInt.from(
// ((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() *
// (feeRatePerKB / 1000).ceil(),
// ),
// fractionDigits: cryptoCurrency.fractionDigits,
// );
// TODO: actually do this properly for peercoin
// this is probably wrong for peercoin
return Amount(
rawValue: BigInt.from(
((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() *
(feeRatePerKB / 1000).ceil(),
),
fractionDigits: cryptoCurrency.fractionDigits,
);
}
/// we can just pretend vSize is size for peercoin
@override
int estimateTxFee({required int vSize, required int feeRatePerKB}) {
// TODO: check ppc fee stuff
throw Exception("TODO");
// return vSize * (feeRatePerKB / 1000).ceil();
return vSize * (feeRatePerKB / 1000).ceil();
}
// ===========================================================================

View file

@ -24,6 +24,7 @@ import 'package:stackwallet/wallets/crypto_currency/coins/firo.dart';
import 'package:stackwallet/wallets/crypto_currency/intermediate/bip39_hd_currency.dart';
import 'package:stackwallet/wallets/models/tx_data.dart';
import 'package:stackwallet/wallets/wallet/impl/bitcoin_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/peercoin_wallet.dart';
import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart';
@ -768,7 +769,8 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
return txData.copyWith(
raw: clTx.toHex(),
vSize: clTx.vSize(),
// dirty shortcut for peercoin's weirdness
vSize: this is PeercoinWallet ? clTx.size : clTx.vSize(),
tempTx: TransactionV2(
walletId: walletId,
blockHash: null,