mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
invalid vsize fix
This commit is contained in:
parent
c7f1392734
commit
a8abd38827
1 changed files with 21 additions and 5 deletions
|
@ -1429,16 +1429,32 @@ class FiroWallet extends CoinServiceAPI
|
|||
feeRatePerKB: selectedTxFeeRate,
|
||||
);
|
||||
|
||||
if (feeForOneOutput < vSizeForOneOutput + 1) {
|
||||
feeForOneOutput = vSizeForOneOutput + 1;
|
||||
}
|
||||
|
||||
final int amount = satoshiAmountToSend - feeForOneOutput;
|
||||
int amount = satoshiAmountToSend - feeForOneOutput;
|
||||
dynamic txn = await buildTransaction(
|
||||
utxoSigningData: utxoSigningData,
|
||||
recipients: recipientsArray,
|
||||
satoshiAmounts: [amount],
|
||||
);
|
||||
|
||||
int count = 0;
|
||||
int fee = feeForOneOutput;
|
||||
int vsize = txn["vSize"] as int;
|
||||
|
||||
while (fee < vsize && count < 10) {
|
||||
// 10 being some reasonable max
|
||||
count++;
|
||||
fee += count;
|
||||
amount = satoshiAmountToSend - fee;
|
||||
|
||||
txn = await buildTransaction(
|
||||
utxoSigningData: utxoSigningData,
|
||||
recipients: recipientsArray,
|
||||
satoshiAmounts: [amount],
|
||||
);
|
||||
|
||||
vsize = txn["vSize"] as int;
|
||||
}
|
||||
|
||||
Map<String, dynamic> transactionObject = {
|
||||
"hex": txn["hex"],
|
||||
"recipient": recipientsArray[0],
|
||||
|
|
Loading…
Reference in a new issue