-
Notifications
You must be signed in to change notification settings - Fork 71
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
Support retrieving newer txs only in light wallet REST API #603
base: master
Are you sure you want to change the base?
Conversation
I support deprecating the full list and calling this standard in clients. |
b89b684
to
2e02650
Compare
Yes, I was proposing something similar like that before as well. There is no reason to scan entire blockchain if you know that your wallet is 3 days old. You could also perhaps just return always at minim last 10 translations or so, to protect against reorgs? |
@moneroexamples this is orthogonal to scanning, it only relates to the client's retrieval of tx history. |
check this monero-project/monero#7896 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is sensible, and should be possible in monero-lws
without much hassle. The implementation will probably do a full re-sync on a reorg, as tracking fork points might be more trouble than its worth.
Adding: I think this is a good idea! Spec looks good to me. EDIT: nevermind below, sorry. It seems it would come at the cost of an additional DB read, so not worth it. Small thing, unless I'm misunderstanding, it seems a little confusing that in the reorg case, the updated |
Changed the wording to explicitly allow simply omitting this field altogether; the client needs to handle that case anyway, for backward compatibility. |
Currently, the light wallet REST API only supports retrieving the entire transaction history. This proposed extension to the protocol allows clients to request only those transactions newer than the ones they already know.
Two optional fields are added to the
get_address_txs
request object:since_tx_id
, the highest transactionid
known to the client, andsince_tx_block_hash
, theblock_hash
of the same transaction. If these fields are absent, the entire transaction history is returned, as before.A
since_tx_id
field is also added to the response object; its value may differ from the value in the request, and clients must be sure to honor the former, by forgetting any txs with a higherid
before processing the response.This logic, along with the new block hash fields, allow detection and correct handling of blockchain reorgs. Upon receiving the request, the server compares the provided tx id and block_hash with the current blockchain state. If they match, then the server can simply return the newer txs, exactly as requested, and the
since_tx_id
of the response should be the same as the request. If they don't match, then the specified transaction must have been part of a blockchain reorg, in which case some or all of the previous history must be returned, and thesince_tx_id
of the response will differ from the request.If the server keeps track of reorged blocks, and where they previously were in the blockchain, then it can return only those txs that are newer than the split. (In this case the returned
since_tx_id
should be the highestid
in the last block common to both chains.) However, it is not obligated to do so: it can simply return the entire transaction history anytime a reorg is detected (in which case the returnedsince_tx_id
should be zero.)Requesting feedback from @vtnerd and @moneroexamples