Updated ListAssetRequest to include additional filter options
Resolves #876
This PR adds new filter options to the ListAssets RPC call.
- The
ListAssetRequestproto definition was updated to include the new filter options. - The
fetchRpcAssetsfunction was refactored to accept aAssetQueryFiltersargument so that separate arguments don't need to be added for each filter option. - The assets store
constraintsToDbFilterfunction was updated to use the new filter options. - And the
assets.sqlfile was updated to include a newmaxAmountoption.
Pull Request Test Coverage Report for Build 14571628881
Details
- 21 of 98 (21.43%) changed or added relevant lines in 4 files are covered.
- 7 unchanged lines in 3 files lost coverage.
- Overall coverage increased (+0.009%) to 28.572%
| Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
|---|---|---|---|
| tapdb/assets_store.go | 20 | 27 | 74.07% |
| taprpc/taprootassets.pb.go | 0 | 25 | 0.0% |
| rpcserver.go | 0 | 45 | 0.0% |
| <!-- | Total: | 21 | 98 |
| Files with Coverage Reduction | New Missed Lines | % |
|---|---|---|
| address/address.go | 2 | 69.55% |
| tapchannel/aux_invoice_manager.go | 2 | 85.37% |
| tapchannel/aux_leaf_signer.go | 3 | 43.43% |
| <!-- | Total: | 7 |
| Totals | |
|---|---|
| Change from base Build 14520380113: | 0.009% |
| Covered Lines: | 26263 |
| Relevant Lines: | 91918 |
💛 - Coveralls
I think this function can help resolve the issue w.r.t getting the internal ID, you can just specify all the normal bytes (script key, anchor point, etc): https://github.com/lightninglabs/taproot-assets/blob/ec84760f1f665d16cf730c7e6ee8b30261023d9c/tapdb/assets_store.go#L904-L935
@GeorgeTsagk @guggero I updated the code to filter assets based on the tweaked script key instead of the internal script key ID. I ran into some weird issues with the automated tests, for some reason I was unable to filter the 10th asset:
assetGen: assetGen.assetGens[9],
anchorPoint: assetGen.anchorPoints[4],
amt: 777,
scriptKey: scriptKeyWithScript,
Oli said this might have something to do with an underlying issue with the specific anchor point or asset generation, but I'm not sure why this particular asset is "cursed" :sweat_smile:
I worked around the issue by adding a script key to the 3rd asset and was able to filter it as expected.
@georgetsagk: review reminder @itsrachelfish, remember to re-request review from reviewers when ready