Page MenuHomePhabricator

[Chronik] Add `SpentByWriter` and `SpentByReader`
ClosedPublic

Authored by tobias_ruck on Apr 22 2023, 22:13.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC0bb69fe5aa39: [Chronik] Add `SpentByWriter` and `SpentByReader`
Summary

This is necessary if we want to add to each output of a tx which tx (and input) spent it. We need to index this, because a node by itself doesn't store which output has been stored by which input.

This is especially important for block explorers, to allow navigating to the tx that spent an output.

We do this by storing for each tx (which has any spent outputs) a list of "spent-by" entries. Each entry tells us which output of that tx has been spent, which tx_num spent it and which input of the spending tx spent the output.

Test Plan

ninja check-crates

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested changes to this revision.Apr 24 2023, 10:02
Fabien added inline comments.
chronik/chronik-db/src/io/spent_by.rs
138 ↗(On Diff #39862)

there is technically no block involved here

192 ↗(On Diff #39862)

Dito

406 ↗(On Diff #39862)

Can you try to add a, in-block chain here ? like tx3 spends an output from tx5, and tx5 spends an output of tx3

This revision now requires changes to proceed.Apr 24 2023, 10:02
This revision is now accepted and ready to land.Apr 24 2023, 13:33