AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 18 Bitcoin

Improve data stored in `AuditDb` (#3245)

Public commit record

What the developer wrote

Authored by Bastien Teinturier

76/100 · Adequate
Improve data stored in `AuditDb` (#3245)

* Improve `channel_events` in the `AuditDb`

We improve the `channel_events` table in the `AuditDb` by:

- adding the `funding_txid` from each event
- adding the `channel_type` from each event
- using hex instead of blobs in sqlite
- providing APIs to list these events
- adding indexes on `channel_id` and `remote_node_id`

The added data isn't available in past events. We decide to simply
rename the older tables and start fresh: previous data will not be
available from the API, but can still be queried directly in SQL if
necessary.

* Improve transaction events in the `AuditDb`

We improve the `transactions_published` and `transactions_confirmed`
tables in the `AuditDb` by:

- adding more details about mining fees and feerates
- adding input and output counts
- using hex instead of blobs in sqlite
- providing APIs to list transactions by `remote_node_id`
- adding indexes for listing APIs

The added data isn't available in past events. We decide to simply
rename the older tables and start fresh: previous data will not be
available from the API, but can still be queried directly in SQL if
necessary.

* Improve payment sent and received events in the `AuditDb`

We improve the `sent` and `received` payment tables in the `AuditDb` by:

- adding `start_at` / `settled_at` timestamps to measure duration
- adding `remote_node_id` for every channel used
- using hex instead of blobs in sqlite
- reordering columns and renaming them wherever useful

The added data isn't available in past events. We decide to simply
rename the older tables and start fresh: previous data will not be
available from the API, but can still be queried directly in SQL if
necessary.

* Improve payment relayed events in the `AuditDb`

We improve the `relayed` and `relayed_trampoline` payment tables in the
`AuditDb` by:

- unifying the way we handle multi-part payments, by having one row per
payment, whether incoming or outgoing, and reconciling based on type
and direction when listing events
- adding `remote_node_id` for every channel used
- using hex instead of blobs in sqlite
- renaming columns for better clarify

The added data isn't available in past events. We decide to simply
rename the older tables and start fresh: previous data will not be
available from the API, but can still be queried directly in SQL if
necessary.

* Improve relay statistics computation

We change the relay statistics we compute, to more accurately reflect
nodes that are good or bad peers and inform liquidity allocation
decisions.

* Add liquidity purchase fees in transaction events

We now track liquidity purchases as well in transaction events, as their
fees must be taken into account when evaluating the overall fees earned
from a node.

We also add the number of on-chain transactions made with a given peer
to its relay stats.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit is a planned database schema upgrade for Eclair's audit logging. It renames old audit tables, creates new ones with extra columns (such as remote node IDs, transaction details, and timestamps), and replaces two old API endpoints with a new 'relaystats' endpoint. There is no obvious security vulnerability in the diff itself; it is a backwards-incompatible but intentional data-model change.

Recommended action

Treat this as a normal but breaking database upgrade. Operators should back up their audit database before upgrading, because old audit tables are renamed and new tables start empty. API consumers must migrate from `networkfees`/`channelstats` to `relaystats`. No immediate security patch is required.

Security signals we found

01

Large schema migration renames old tables instead of migrating data

02

New columns track remote node IDs and liquidity purchase fees

03

API endpoints `networkfees` and `channelstats` removed and replaced by `relaystats`

04

Adds null-safe comparison of JDBC URLs in Databases.scala

05

No input validation, cryptographic, or authorization changes observed

Risk score

Why this scored 18/100

Our methodology →
Potential impact 2/30
Exploitability 1/25
Stealth signal 1/15
Affected reach 2/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.