mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-11 13:14:32 +00:00
handle fee rounding error
This commit is contained in:
parent
3940c88e44
commit
c06c3935ca
1 changed files with 13 additions and 1 deletions
|
@ -455,7 +455,7 @@ mixin PaynymWalletInterface {
|
||||||
// check estimates are correct and build notification tx
|
// check estimates are correct and build notification tx
|
||||||
if (changeAmount >= _dustLimitP2PKH &&
|
if (changeAmount >= _dustLimitP2PKH &&
|
||||||
satoshisBeingUsed - amountToSend - changeAmount == feeForWithChange) {
|
satoshisBeingUsed - amountToSend - changeAmount == feeForWithChange) {
|
||||||
final txn = await _createNotificationTx(
|
var txn = await _createNotificationTx(
|
||||||
targetPaymentCodeString: targetPaymentCodeString,
|
targetPaymentCodeString: targetPaymentCodeString,
|
||||||
utxosToUse: utxoObjectsToUse,
|
utxosToUse: utxoObjectsToUse,
|
||||||
utxoSigningData: utxoSigningData,
|
utxoSigningData: utxoSigningData,
|
||||||
|
@ -464,6 +464,18 @@ mixin PaynymWalletInterface {
|
||||||
|
|
||||||
int feeBeingPaid = satoshisBeingUsed - amountToSend - changeAmount;
|
int feeBeingPaid = satoshisBeingUsed - amountToSend - changeAmount;
|
||||||
|
|
||||||
|
// make sure minimum fee is accurate if that is being used
|
||||||
|
if (txn.item2 - feeBeingPaid == 1) {
|
||||||
|
changeAmount -= 1;
|
||||||
|
feeBeingPaid += 1;
|
||||||
|
txn = await _createNotificationTx(
|
||||||
|
targetPaymentCodeString: targetPaymentCodeString,
|
||||||
|
utxosToUse: utxoObjectsToUse,
|
||||||
|
utxoSigningData: utxoSigningData,
|
||||||
|
change: changeAmount,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, dynamic> transactionObject = {
|
Map<String, dynamic> transactionObject = {
|
||||||
"hex": txn.item1,
|
"hex": txn.item1,
|
||||||
"recipientPaynym": targetPaymentCodeString,
|
"recipientPaynym": targetPaymentCodeString,
|
||||||
|
|
Loading…
Reference in a new issue