mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-03 17:29:23 +00:00
firo private send vsize check
This commit is contained in:
parent
b0aed63b18
commit
5653bf173d
1 changed files with 12 additions and 0 deletions
|
@ -623,6 +623,7 @@ Future<dynamic> isolateCreateJoinSplitTransaction(
|
||||||
"value": amount,
|
"value": amount,
|
||||||
"fees": Format.satoshisToAmount(fee).toDouble(),
|
"fees": Format.satoshisToAmount(fee).toDouble(),
|
||||||
"fee": fee,
|
"fee": fee,
|
||||||
|
"vSize": extTx.virtualSize(),
|
||||||
"jmintValue": changeToMint,
|
"jmintValue": changeToMint,
|
||||||
"publicCoin": "jmintData.publicCoin",
|
"publicCoin": "jmintData.publicCoin",
|
||||||
"spendCoinIndexes": spendCoinIndexes,
|
"spendCoinIndexes": spendCoinIndexes,
|
||||||
|
@ -1142,6 +1143,17 @@ class FiroWallet extends CoinServiceAPI {
|
||||||
throw Exception("Error Creating Transaction!");
|
throw Exception("Error Creating Transaction!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
final fee = txHexOrError["fee"] as int;
|
||||||
|
final vSize = txHexOrError["vSize"] as int;
|
||||||
|
|
||||||
|
Logging.instance.log("prepared fee: $fee", level: LogLevel.Info);
|
||||||
|
Logging.instance.log("prepared vSize: $vSize", level: LogLevel.Info);
|
||||||
|
|
||||||
|
// fee should never be less than vSize sanity check
|
||||||
|
if (fee < vSize) {
|
||||||
|
throw Exception(
|
||||||
|
"Error in fee calculation: Transaction fee cannot be less than vSize");
|
||||||
|
}
|
||||||
return txHexOrError as Map<String, dynamic>;
|
return txHexOrError as Map<String, dynamic>;
|
||||||
}
|
}
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
|
|
Loading…
Reference in a new issue