Fix outpoint_state index store#194
Conversation
dr-orlovsky
left a comment
There was a problem hiding this comment.
Thank you for catching this!
While your fix is correct, rust stongly discourage use of unwraps in any production code; the unwrap_or, unwrap_or_default or expect should be used instead - or return an error.
I think we should do a expect("genesis with vout-based seal which passed schema validation"), to indicate the reason of the crash (genesis must validate absece of vout-based seals at the schema level, and if it is present, the line 167 and 181 above should guarantee that we would never reach this place).
Can you pls update your PR to use expect?
6368491 to
e737bd6
Compare
|
sure, thanks for the tip. fixed |
|
I think this is a breaking change that will invalidate the stash for existing RGB nodes. Will reflect in a release notes of the patch version... |
Found a bug calling
outpoint_state. By calling the method with an emptyVec<OutPoint>it correctly returns known allocations, but by calling it with some specific outpoints it returns no allocations.Investigating this I've found that when storing the index into the DB:
ChunkId::with_fixed_fragmentsreceives aOption<Txid>.While, when searching for specific outpoints:
ChunkId::with_fixed_fragmentsreceives aTxid.I've fixed the bug on the store-side by unwrapping the
Option, since I believe the TXID should always be present at that point, I hope that's correct.I manually tested it and can confirm that with this fix
outpoint_statefilter works as expected.