Modify utxo_by_outpoint to utxo_by_out_loc in the finalized state #3952
Labels
A-state
Area: State / database changes
C-enhancement
Category: This is an improvement
lightwalletd
any work associated with lightwalletd
Motivation
We want to answer transparent address RPCs quickly. So we need to make existing indexes in the finalized state smaller and more efficient.
We also need to return some RPCs in chain order.
Designs
UTXOs are stored in
utxo_by_out_loc
byOutputLocation
, rather thanOutPoint
. (This makes keys 28 bytes smaller.)OutPoint
s can be looked up usingtx_loc_by_hash
, and reconstructed usinghash_by_tx_loc
.The
Utxo
type can be constructed from theOutputLocation
andOutput
data:height: OutputLocation.height
, andis_coinbase: OutputLocation.transaction_index == 0
(coinbase transactions are always the first transaction in a block).Types
OutputIndex
: 24 bits, big-endian, unsigned (max ~223,000 transfers in the 2 MB block limit)See
Height
serialization for an example implementation.OutputLocation
:TransactionLocation \|\| OutputIndex
AddressLocation
: the firstOutputLocation
used by atransparent::Address
. Always has the same value for each address, even if the first output is spent.https://github.com/ZcashFoundation/zebra/blob/main/book/src/dev/rfcs/0005-state-updates.md#rocksdb-data-structures
Tasks
Implementation:
OutputLocation
to useOutputIndex
rather thanOutPoint
Output
values rather thanUtxo
values (and deleteUtxo
serialization)Utxo
from theOutput
value andOutputLocation
keyAddressLocation
value after theOutput
valueTesting:
CI:
The text was updated successfully, but these errors were encountered: