From 3e5cbbb21958a3a2938fb135d0c670afeb1d111c Mon Sep 17 00:00:00 2001 From: n9lsjr Date: Mon, 19 Feb 2024 23:34:06 +0100 Subject: [PATCH] Fix optimizer --- utils/wallet.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/utils/wallet.js b/utils/wallet.js index 8f6ff1a..e9779ca 100644 --- a/utils/wallet.js +++ b/utils/wallet.js @@ -166,22 +166,16 @@ async function optimizeMessages(wallet, nbrOfTxs, fee = 10000, attempt = 0) { if (attempt > 10) { return false } - console.log("Optimizing!") + if (wallet.subWallets.getAddresses().length === 1) { - console.log("Creating subwallet!") const [spendKey, viewKey] = wallet.getPrimaryAddressPrivateKeys() const subWalletKeys = await crypto.generateDeterministicSubwalletKeys(spendKey, 1) await wallet.importSubWallet(subWalletKeys.private_key) - console.log("Subwallet created!", wallet.subWallets.getAddresses()) } const [walletHeight, localHeight, networkHeight] = wallet.getSyncStatus() - console.log("Got addresses", wallet.getAddresses()) - console.log("Test get addresses", wallet.subWallets.getAddresses()) - - let inputs = await wallet.subWallets.getSpendableTransactionInputs(wallet.subWallets.getAddresses()[1], networkHeight) - - console.log("Got inputs!", inputs) + + let inputs = await wallet.subWallets.getSpendableTransactionInputs([wallet.subWallets.getAddresses()[1]], networkHeight) if (inputs.length > 8) { return inputs.length