fic particl txs

This commit is contained in:
sneurlax 2024-01-12 14:10:17 -06:00
parent 152b516947
commit 3753a699ab

View file

@ -398,18 +398,18 @@ class ParticlWallet extends Bip39HDWallet
final vSize = builtTx.virtualSize(); final vSize = builtTx.virtualSize();
// Strip trailing 0x00 bytes from hex. // Strip trailing 0x00 bytes from hex.
String hexString = builtTx.toHex(); //
// This is done to match the previous particl_wallet implementation.
// Ensure the string has an even length. // TODO: [prio=low] Rework Particl tx construction so as to obviate this.
String hexString = builtTx.toHex(isParticl: true).toString();
if (hexString.length % 2 != 0) { if (hexString.length % 2 != 0) {
// Ensure the string has an even length.
Logging.instance.log("Hex string has odd length, which is unexpected.", Logging.instance.log("Hex string has odd length, which is unexpected.",
level: LogLevel.Error); level: LogLevel.Error);
throw Exception("Invalid hex string length."); throw Exception("Invalid hex string length.");
} }
// Strip up trailing '00' bytes.
int numStrips = 0; int numStrips = 0;
int maxStrips = 3; // Strip up to 3 (match previous particl_wallet). int maxStrips = 3; // Strip up to 3 0x00s (match previous particl_wallet).
while (hexString.endsWith('00') && hexString.length > 2) { while (hexString.endsWith('00') && hexString.length > 2) {
hexString = hexString.substring(0, hexString.length - 2); hexString = hexString.substring(0, hexString.length - 2);
numStrips++; numStrips++;