mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +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
|
||||
if (changeAmount >= _dustLimitP2PKH &&
|
||||
satoshisBeingUsed - amountToSend - changeAmount == feeForWithChange) {
|
||||
final txn = await _createNotificationTx(
|
||||
var txn = await _createNotificationTx(
|
||||
targetPaymentCodeString: targetPaymentCodeString,
|
||||
utxosToUse: utxoObjectsToUse,
|
||||
utxoSigningData: utxoSigningData,
|
||||
|
@ -464,6 +464,18 @@ mixin PaynymWalletInterface {
|
|||
|
||||
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 = {
|
||||
"hex": txn.item1,
|
||||
"recipientPaynym": targetPaymentCodeString,
|
||||
|
|
Loading…
Reference in a new issue