New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
createWalletFull
, importOutputs
and exportKeyImages
cannot function correctly when a deposit is made to a subaddress with large index
#99
Comments
I print the number of outputs and the decoded outputs, the result is: It seems the outputs have not been imported successfully. Or the outputs hex itself is incorrect. But the view-only wallet correctly shows the balances, transfers, etc. What could possibly cause view-only wallet to export incorrect output? Or, since outputhex is exported from one machine, and importing outputhex and export key images is from another machine, could the two machines' environment cause this? |
I still wasn't able to recreate the error. As far as I can tell, the library code should always initialize this field from This suggests an unexpected error is occurring in wallet2's If you're running against v0.18.0.0, there's at least one known issue with the output export/import but it may be unrelated. |
@woodser I found the bug. I made two deposits: one at the primary address, one at the subaddress with index 181162. If I set up the view-only wallet to scan just 1000 subaddresses, thus skipping the one at index 181162, the outputhex contains only 1 utxo and can be imported into the offline wallet, and key images can be exported without error. But if I set up the view-only wallet to scan 1 million subaddresses, thus including the one at index 181162, the outputhex will be much longer and cannot be properly imported into the offline wallet, and key images cannot be exported (see above error). So my question is, when instantiating the offline wallet with |
createWalletFull
, importOutputs
and exportKeyImages
cannot function correctly when a deposit is made to a subaddress with large index
@will-yjn How are you setting up the wallet to scan only a subset of subaddresses? |
@woodser sorry. I thought it defaults to 1000 subaddress. I just check the doc: https://monerodocs.org/interacting/monero-wallet-cli-reference/#performance. By default it checks So first I set up the view wallet without specifying ...will throw the error:
To reproduce the bug: generate a subaddress at index 1:181162, make a deposit to the primary address and this subaddress, set up the view wallet with |
The full wallet doesn't currently support creating new wallets with subaddress lookahead which also caused errors in my tests with big subaddress indices. I'll add support for the next release. In the meantime, you could either create the offline wallet using monero-wallet-cli and I confirmed this works with deposits at index 1:181162. |
Subaddress lookahead is now supported in the v0.7.4 release when creating full wallets. For example: const wallet = await monerojs.createWalletFull({
networkType: MoneroNetworkType.MAINNET,
password: "...",
primaryAddress: "...",
privateSpendKey: "...",
privateViewKey: "...",
accountLookahead: 1,
subaddressLookahead: 1000000
}); |
It worked. But once I set subaddressLookahead to be above |
Not to my knowledge. The wasm is generally underpowered because it's running single threaded. There's an effort to support multithreading which could help a lot. Otherwise it's dependent on the wallet implementation from monero-project. |
Cool. I'm going to close this issue and follow that thread. |
Hi there,
I use the view-only wallet plus offline wallet mechanism to sign keyImages.
I use
try catch
s to locate the error to be throw by the last line above:TypeError: (intermediate value) is not iterable
. I check themonero-javascript
repo and doubt if it is thrown by the line in the red box below:..., because a
null
value is not iterable.From my understanding
that._module.export_key_images(that._cppAddress, all, callback);
calls the wasm function which was translated from c++. Is there a way to debug the wasm code? Below is an excerpt frommonero_wasm_bridge.cpp
:I suppose something went wrong at this line
doc.AddMember("keyImages", monero_utils::to_rapidjson_val(doc.GetAllocator(), key_images), doc.GetAllocator());
Somehow the doc object cannot locate memory or something, so the later half returnsnull
. Do you know what causes the original error whenexportKeyImages
, or what could causedoc.AddMember
to return a bug?The text was updated successfully, but these errors were encountered: