HomePhabricator

[Chronik] Add `/script/:type/:payload/confirmed-txs`

Description

[Chronik] Add /script/:type/:payload/confirmed-txs

Summary:
This endpoint returns all the confirmed txs of a script, in the order they appear in the blockchain.

This is useful if a wallet simply wants to download all the txs of the wallet. It can then store the last page it queried, and when re-syncing, it only needs to read pages from including after the current page.

While the original plan was to implement /script/:type/:payload/history directly, it is actually not a trivial implementation, so for simplicity, we start with this endpoint. It doesn't exist in the NNG Chronik version, but in discussions with Joey, it was clear that this is clearly a beneficial feature.

In the future, we might also add a ?after=<txid> feature (used instead of ?page=), to return txs starting after the given txid (in 'blockchain' order). This would allow wallets to query new txs by providing the last known txid.

Test Plan:
ninja check-crates && ninja && ./test/functional/test_runner.py chronik_script_confirmed_txs

You can also verify the txs capacity calculation by changing the log -> panic in group_history.rs, running the test plan again and it should work fine.

Reviewers: Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D13567

Details

Provenance
tobias_ruckAuthored on Apr 4 2023, 16:03
tobias_ruckPushed on Apr 5 2023, 09:47
Reviewer
Restricted Project
Differential Revision
D13567: [Chronik] Add `/script/:type/:payload/confirmed-txs`
Parents
rABC3b0f8829c72b: scripts: add MACHO Canary check to security-check.py
Branches
Unknown
Tags
Unknown