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 @override
Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) { Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) {
// TODO: check ppc fee stuff // TODO: actually do this properly for peercoin
throw Exception("TODO"); // this is probably wrong for peercoin
// return Amount( return Amount(
// rawValue: BigInt.from( rawValue: BigInt.from(
// ((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() * ((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() *
// (feeRatePerKB / 1000).ceil(), (feeRatePerKB / 1000).ceil(),
// ), ),
// fractionDigits: cryptoCurrency.fractionDigits, fractionDigits: cryptoCurrency.fractionDigits,
// ); );
} }
/// we can just pretend vSize is size for peercoin
@override @override
int estimateTxFee({required int vSize, required int feeRatePerKB}) { int estimateTxFee({required int vSize, required int feeRatePerKB}) {
// TODO: check ppc fee stuff return vSize * (feeRatePerKB / 1000).ceil();
throw Exception("TODO");
// 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/crypto_currency/intermediate/bip39_hd_currency.dart';
import 'package:stackwallet/wallets/models/tx_data.dart'; import 'package:stackwallet/wallets/models/tx_data.dart';
import 'package:stackwallet/wallets/wallet/impl/bitcoin_wallet.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/intermediate/bip39_hd_wallet.dart';
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/paynym_interface.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( return txData.copyWith(
raw: clTx.toHex(), raw: clTx.toHex(),
vSize: clTx.vSize(), // dirty shortcut for peercoin's weirdness
vSize: this is PeercoinWallet ? clTx.size : clTx.vSize(),
tempTx: TransactionV2( tempTx: TransactionV2(
walletId: walletId, walletId: walletId,
blockHash: null, blockHash: null,