woodser / monero-java

Java library for using Monero
https://woodser.github.io/monero-java/javadocs/
MIT License
106 stars 39 forks source link

MoneroWalletRpc Get tx not working #22

Closed kunalransing closed 4 years ago

kunalransing commented 5 years ago

Verion: 0.1.3-SNAPSHOT Java code:

MoneroWalletRpc walletRpc = new MoneroWalletRpc(DOMAIN,USERNAME,PASSWORD);
MoneroTxWallet txWallet = walletRpc.getTx("b390d693542417cb2ab55de60536028104ae1358776db24ae7d84a19d105f101");
System.out.println(txWallet.getPaymentId());

Error Log:

Exception in thread "main" java.lang.AssertionError: value asserted as true but was false
    at common.utils.GenUtils.assertTrue(GenUtils.java:17)
    at monero.wallet.MoneroWalletRpc.convertRpcTxWithTransfer(MoneroWalletRpc.java:1944)
    at monero.wallet.MoneroWalletRpc.getTransfers(MoneroWalletRpc.java:719)
    at monero.wallet.MoneroWalletRpc.getTxs(MoneroWalletRpc.java:581)
    at monero.wallet.MoneroWalletDefault.getTxs(MoneroWalletDefault.java:138)
    at monero.wallet.MoneroWalletDefault.getTx(MoneroWalletDefault.java:129)
woodser commented 5 years ago

I have not been able to recreate the error.

Are you using monero-wallet-rpc version 0.14.1.0 or higher? Looking at that code, I do not see why the assertion should fail (i.e. subaddr_indices should be returned).

If you are using monero-wallet-rpc version 0.14.1.0 or higher:

Thanks.

kunalransing commented 5 years ago

RPC version: monero-v0.14.0.2 Daemon: testnet.xmrchain.net:28081 Wallet age: Sep 23, 2019
Network Type: testnet Mnemonic: myth ability hiker aquarium smash exquisite vibrate hedgehog ginger fences vowels toenail school null rejoices vowels wayside nodes asleep lynx biweekly sword woken yawning smash

woodser commented 5 years ago

Thanks. I wasn't able to recreate the error after importing the wallet and calling walletRpc.getTx("b390d693542417cb2ab55de60536028104ae1358776db24ae7d84a19d105f101"). A field that method uses, subaddress_indices, was added to monero-wallet-rpc in the last few releases.

Can you try calling walletRpc.rescanBlockchain()? That method will discard local wallet (e.g. destinations, tx notes) and recreate the wallet from the blockchain.

kunalransing commented 5 years ago

Hi, Sorry for the late reply. I run walletRpc.rescanBlockchain() then tried to getTx() but still same error. BTW I can see above tx in log but getTx() throw Exception. Please check attached log file. xmr_gettx_log.txt

woodser commented 5 years ago

@kunalransing This issue is likely caused by running an old version of monero-wallet-rpc (v0.14.0.2). Updating to the latest (v0.14.1.0+) should resolve the issue.

kunalransing commented 5 years ago

Thanks. Solved issue when used version v0.14.1.2.