[Chronik] Add UtxoData and UtxoProtobuf to allow storing UTXOs' scripts in the DB
Summary:
Currently GroupUtxoWriter is really only usable for groups where that group by script, as it doesn't store the script of the UTXO in the DB.
For ScriptGroup this is great, as storing the script in the UTXO would be redundant, but for other groups, e.g. those grouping by token ID, it really is important to have easy access to the script so we can return it.
We solve this by making UtxoEntry take a generic parameter for the UTXO data, which will be stored in the DB. This comes from the UtxoData trait. It doesn't change the existing data in the DB, so no schema version upgrade is neessary.
Note: It would be possible to instead of storing the script in the UTXO, to not store anything about the UTXO in the DB and to rely on lookup_spent_coins instead to re-use the node's data.
However:
- This would require a similar change anyway except with a UtxoData impl for () that doesn't store anything.
- It would then require us to lookup the coins in QueryGroupUtxos, but due to the validation interface queue they aren't guaranteed to be there if they are in the Chronik DB.
- Non-script groups right now would only index a small percentage of txs (e.g. token tx, plugins), so the redundancy of storing the UTXO in the group should be fine for now.
Depends on D15382.
Test Plan: ninja check-functional
Reviewers: Fabien, #bitcoin_abc
Reviewed By: Fabien, #bitcoin_abc
Differential Revision: https://reviews.bitcoinabc.org/D15383