Page MenuHomePhabricator

[Chronik] Add `/broadcast-tx(s)` endpoints
ClosedPublic

Authored by tobias_ruck on Feb 2 2024, 00:42.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCf676d3619edb: [Chronik] Add `/broadcast-tx(s)` endpoints
Summary

These endpoints are similar to the sendrawtransaction RPC, with some differences:

  1. They take a serialized BroadcastTx(s)Request (similar to most Chronik endpoints)
  2. They perform an SLP/ALP check and reject all txs atomically if any tokens are unintentionally burned

Currently /broadcast-txs, after the token check, simply broadcasts txs one by one and not as a package. This matches the current NNG Chronik behavior, but in the future we could use the AcceptMultipleTransactions function from the node to make that atomic, too.

Depends on D15369.

Test Plan

ninja check-functional

Diff Detail

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

Event Timeline

The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
Fabien requested changes to this revision.Feb 2 2024, 12:58

The tests are failing when you are sending invalid txs. This is the expected behavior but the ChronikClient.send() method always expects success

This revision now requires changes to proceed.Feb 2 2024, 12:58

add test for /broadcast-txs

Fabien requested changes to this revision.Feb 6 2024, 14:50
Fabien added inline comments.
chronik/chronik-indexer/src/query/broadcast.rs
66 ↗(On Diff #44931)

Can we make the max fee a constant, or use the value from the node if possible ?

94 ↗(On Diff #44931)

slp is also a bad name here => token

chronik/chronik-indexer/src/query/tx_token_data.rs
181 ↗(On Diff #44931)
This revision now requires changes to proceed.Feb 6 2024, 14:50

fix colored in from_unbroadcast_tx when color_tx returns None

This revision is now accepted and ready to land.Feb 11 2024, 10:08