Skip to content

Commit

Permalink
More detailed logs, fix
Browse files Browse the repository at this point in the history
  • Loading branch information
n9lsjr committed Feb 19, 2024
1 parent c3b154b commit 23c9dbb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions utils/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,22 @@ async function optimizeMessages(wallet, nbrOfTxs, fee = 10000, attempt = 0) {
return false
}
console.log("Optimizing!")
if (wallet.getAddresses().length === 1) {
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!")
console.log("Subwallet created!", wallet.subWallets.getAddresses())
}

const [walletHeight, localHeight, networkHeight] = wallet.getSyncStatus()

let inputs = await wallet.subWallets.getSpendableTransactionInputs(wallet.getAddresses()[1], networkHeight)
console.log("Got addresses", wallet.getAddresses())
console.log("Test get addresses", wallet.subWallets.getAddresses())

console.log("Got inputs!", inputs)
let inputs = await wallet.subWallets.getSpendableTransactionInputs(wallet.subWallets.getAddresses()[1], networkHeight)

console.log("Got inputs!", inputs)

if (inputs.length > 8) {
return inputs.length
}
Expand Down

0 comments on commit 23c9dbb

Please sign in to comment.