mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +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,
|
feeRatePerKB: selectedTxFeeRate,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (feeForOneOutput < vSizeForOneOutput + 1) {
|
int amount = satoshiAmountToSend - feeForOneOutput;
|
||||||
feeForOneOutput = vSizeForOneOutput + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
final int amount = satoshiAmountToSend - feeForOneOutput;
|
|
||||||
dynamic txn = await buildTransaction(
|
dynamic txn = await buildTransaction(
|
||||||
utxoSigningData: utxoSigningData,
|
utxoSigningData: utxoSigningData,
|
||||||
recipients: recipientsArray,
|
recipients: recipientsArray,
|
||||||
satoshiAmounts: [amount],
|
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 = {
|
Map<String, dynamic> transactionObject = {
|
||||||
"hex": txn["hex"],
|
"hex": txn["hex"],
|
||||||
"recipient": recipientsArray[0],
|
"recipient": recipientsArray[0],
|
||||||
|
|
Loading…
Reference in a new issue