rust-teos icon indicating copy to clipboard operation
rust-teos copied to clipboard

Add optional boundaries to `getregistrationreceipt`

Open sr-gi opened this issue 2 years ago • 8 comments

#83 added, amongst other commands, getregistrationreceipt which pulls the latest registration receipt from the wathctower-plugin database.

It'll be nice to add some optional parameters that will allow the user to pick the receipt they are interested in, in case it is not the lattest. The parameters should specify a start and end time, and the receipt (or receipts) that englobe such period should be returned.

sr-gi avatar Aug 22 '22 09:08 sr-gi

@1010adigupta this may be a good issue to start with

sr-gi avatar Feb 06 '23 22:02 sr-gi

Okay, will start looking into it immediately.

1010adigupta avatar Feb 06 '23 22:02 1010adigupta

@sr-gi can you clarify whether we need to change the schema to add a timestamp column or get a registration receipt on the basis of subscription_start and end?

amitpanwar789 avatar Mar 02 '23 06:03 amitpanwar789

The schema has to remain the same, the query needs to add a boundary (start /end) so every receipt within that boundary is returned.

sr-gi avatar Mar 02 '23 07:03 sr-gi

@sr-gi I will like to work on it, so what should be the format of our optional parameters, I guess we need to filter out it from DB on the basis of subscription_expiry, which is I guess the blocks count till which tower must cover the client. optional parameter can be blocks count. am i thinking in right direction?

amitpanwar789 avatar Mar 02 '23 11:03 amitpanwar789

The boundary should be a start and end block, given subscription times are accounted for in blocks.

https://github.com/talaia-labs/rust-teos/blob/master/watchtower-plugin/src/dbm.rs#L53-L54

This should be as straight-forward as adding two additional params to the RPC command, if those are present (both of them) then the DB query must be bounded by them, otherwise we pull the most recent receipt.

sr-gi avatar Mar 02 '23 13:03 sr-gi

I think I forked worng repo. @sr-gi anyway to fix this now ?

ShubhamBhut avatar Mar 03 '23 17:03 ShubhamBhut

You have to create a PR against this repo and most likely rebase your base commit

sr-gi avatar Mar 03 '23 17:03 sr-gi