Open elibroftw opened 2 years ago
Also the seed for the wallets is the same but the accounts are different.
Can you explain this in more detail?
I'm using the same wallet for RPC and GUI, but sending and receiving from two different accounts.
https://github.com/comit-network/xmr-btc-swap/issues/523#issuecomment-846487263 I'm not the only one experiencing this bug
I built a web wallet that is using the RPC interface and the monero-wallet-rpc
binary, and it does not show the slightest problem of picking up pending transactions. (Pending transactions are displayed with a red "Pending" in the Type column.) Of course it uses the call you mention, get_transfers
, because it's the only one and thus no way around it, as far as I remember.
So no idea what's the reason for your problems, but I highly doubt it can be a general problem in the RPC daemon or even in the wallet.
@rbrunner7 did you see the comment I linked to Comit's swap tool? They also experience the same problem.
Is there a specific way to call get transfers then?
Yes, I checked the link. It may well possible that there are special circumstances that prevent pending transfers getting reported, and if yes, it's the big question how to sensibly narrow down here. Their comment is without any details thus unfortunately it's not helpful in this regard.
As I had a dedicated goal of always showing all transactions in all states in my web wallet, I think any error there would have jumped at me. So I can confirm that the call at least works pretty reliably under some circumstances; it's certainly not completely broken.
Is there a specific way to call get transfers then?
Not that I know of. You set, like you did, the pending
boolean, and call get_transfers
.
Okay but am I calling get transfers incorrectly then? Or is it a bug if the incoming transfer for one account is the outgoing of another account?
Maybe only some such combinations are problematic, yeah. Maybe if you send to yourself, from one account to another, you only get a pool
transfer reported, but not a pending
one? I myself don't know, never tried that, and my web wallet does not support accounts.
Quite in general, the RPC daemon pretty much uses the same calls into wallet2
as the CLI wallet does. If there is a problem you should have a good chance to catch it with the CLI wallet as well, which would be much easier to reproduce for people and then investigate.
The issue isn't just from me. I linked a comment which shows the commit people have also faced this issue.
The bug is not present in the wallet-cli
@rbrunner7 , do I need to use "pool": True
? https://monerodocs.org/interacting/monero-wallet-rpc-reference/#get_transfers
If this works, then it's a bug if pending: true
also requires pool: true
.
I had a look at the code of wallet_rpc_server::on_get_transfers
: It's simple enough, and all I saw is a clean separation between the pending
and the pool
boolean in the processing. No surprising dependence between those two in sight anywhere so that it would only work with both set.
The code also looks unchanged sine aeons, written and last modified by @moneromooo-monero 5 years ago.
I would say the riddle is still unsolved.
I'll just run experiments again when I get the time.
load_dotenv('.env')
import requests
monero_rpc_session.auth = HTTPDigestAuth('monero', os.environ['SIMPLE_PWD'])
XMR_RPC_ENDPOINT = 'http://127.0.0.1:38088/json_rpc' XMR_RPC_AUTH = HTTPDigestAuth('monero', os.environ['XMR_RPC_PW'])
def xmr_rpc_api(method_name, params): rpc_defaults = {'jsonrpc': '2.0', 'id': '0'} if '_in' in params: params['in'] = params.pop('_in') return requests.post(XMR_RPC_ENDPOINT, json={rpc_defaults, 'method': method_name, 'params': params}, auth=XMR_RPC_AUTH)
r = xmr_rpc_api('get_transfers', _in=True, out=False, pending=True, account_index=1, subaddr_indices=[]).json() print(r['result'].keys())
Got: