monero-ts: Scan TXS stuck on newer version
Hi
I don’t know what is going on, but the code below works in 0.7.12:
import monerojs from 'monero-javascript';
// import monerojs from 'monero-ts'; // if you use newer versions, it won't work
const wallet = await monerojs.createWalletFull({
password: 'ssp',
networkType: 'testnet',
privateSpendKey: '356a1684d97dca6270799749f03a0cf0331bc9cc9392bf626b1af4285a53f90d',
server: 'http://node.monerodevs.org:28089',
proxyToWorker: false,
});
await wallet.scanTxs(['2c4dacb50197ae631da53a4f5fd8baca44386e8e53fe1c7d348db5d3e88133b2']);
const syncRange = await wallet.getNumBlocksToUnlock();
console.log(syncRange);
But the same code above, doesn’t work on v0.8 or v0.9, it just stuck and then returns [0, 0].
P.S. tested on both node v16 and v20.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 19 (7 by maintainers)
Worth checking the logs, but guessing it’s this refresh call here that’s taking a while:
https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/wallet/wallet2.cpp#L1925-L1927
In order to make sure the wallet’s blockchain state is in a correct state after the call to
scan_tx, it syncs starting from that tx (block 2214401) to chain tip (2510617 as of this writing). As noted in that TODO, could either usefast_refreshfor that purpose with some refactoring, or just allow updating the wallet’s blockchain state to be handled on next refresh loop