mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-12 09:27:01 +00:00
add logging to fee btc calc
This commit is contained in:
parent
18db74d57d
commit
9dc5f91a04
1 changed files with 32 additions and 19 deletions
|
@ -2373,25 +2373,38 @@ class BitcoinWallet extends CoinServiceAPI
|
|||
return transactionObject;
|
||||
}
|
||||
|
||||
final int vSizeForOneOutput = (await buildTransaction(
|
||||
utxosToUse: utxoObjectsToUse,
|
||||
utxoSigningData: utxoSigningData,
|
||||
recipients: [_recipientAddress],
|
||||
satoshiAmounts: [satoshisBeingUsed - 1],
|
||||
))["vSize"] as int;
|
||||
final int vSizeForTwoOutPuts = (await buildTransaction(
|
||||
utxosToUse: utxoObjectsToUse,
|
||||
utxoSigningData: utxoSigningData,
|
||||
recipients: [
|
||||
_recipientAddress,
|
||||
await _getCurrentAddressForChain(1, DerivePathTypeExt.primaryFor(coin)),
|
||||
],
|
||||
satoshiAmounts: [
|
||||
satoshiAmountToSend,
|
||||
// should/can we just set this to 0 ?
|
||||
max(0, satoshisBeingUsed - satoshiAmountToSend - 1),
|
||||
],
|
||||
))["vSize"] as int;
|
||||
final int vSizeForOneOutput;
|
||||
try {
|
||||
vSizeForOneOutput = (await buildTransaction(
|
||||
utxosToUse: utxoObjectsToUse,
|
||||
utxoSigningData: utxoSigningData,
|
||||
recipients: [_recipientAddress],
|
||||
satoshiAmounts: [satoshisBeingUsed - 1],
|
||||
))["vSize"] as int;
|
||||
} catch (e) {
|
||||
Logging.instance.log("vSizeForOneOutput: $e", level: LogLevel.Error);
|
||||
rethrow;
|
||||
}
|
||||
|
||||
final int vSizeForTwoOutPuts;
|
||||
try {
|
||||
vSizeForTwoOutPuts = (await buildTransaction(
|
||||
utxosToUse: utxoObjectsToUse,
|
||||
utxoSigningData: utxoSigningData,
|
||||
recipients: [
|
||||
_recipientAddress,
|
||||
await _getCurrentAddressForChain(
|
||||
1, DerivePathTypeExt.primaryFor(coin)),
|
||||
],
|
||||
satoshiAmounts: [
|
||||
satoshiAmountToSend,
|
||||
max(0, satoshisBeingUsed - satoshiAmountToSend - 1),
|
||||
],
|
||||
))["vSize"] as int;
|
||||
} catch (e) {
|
||||
Logging.instance.log("vSizeForTwoOutPuts: $e", level: LogLevel.Error);
|
||||
rethrow;
|
||||
}
|
||||
|
||||
// Assume 1 output, only for recipient and no change
|
||||
final feeForOneOutput = estimateTxFee(
|
||||
|
|
Loading…
Reference in a new issue