Skip to content

Initialize peer stats with past events#3272

Merged
t-bast merged 2 commits intomasterfrom
peer-scorer-load-payment-events
Mar 31, 2026
Merged

Initialize peer stats with past events#3272
t-bast merged 2 commits intomasterfrom
peer-scorer-load-payment-events

Conversation

@t-bast
Copy link
Copy Markdown
Member

@t-bast t-bast commented Mar 20, 2026

We initialize peer statistics by reading past events from the AuditDb. We read events in chunks to avoid overloading the DB or the RAM. We only return peer statistics to callers once we've finished reading past data from the DB.

Note that on-chain statistics need to be computed whenever statistics are requested, because they require merging data from two distincts events (transaction published and transaction confirmed), which requires keeping state between those events and thus requires the DB (because the node may restart after publishing a transaction and before it confirms).

@t-bast t-bast force-pushed the peer-scorer-load-payment-events branch 3 times, most recently from 647fa30 to 47d0835 Compare March 26, 2026 15:45
@t-bast t-bast marked this pull request as ready for review March 26, 2026 15:47
@t-bast t-bast requested a review from pm47 March 26, 2026 15:47
We initialize peer statistics by reading past events from the `AuditDb`.
We read events in chunks to avoid overloading the DB or the RAM. We only
return peer statistics to callers once we've finished reading past data
from the DB.

Note that on-chain statistics need to be computed whenever statistics
are requested, because they require merging data from two distincts
events (transaction published and transaction confirmed), which requires
keeping state between those events and thus requires the DB (because the
node may restart after publishing a transaction and before it confirms).
@t-bast t-bast force-pushed the peer-scorer-load-payment-events branch from 47d0835 to 91ca4c3 Compare March 30, 2026 12:07
Comment thread eclair-core/src/main/scala/fr/acinq/eclair/profit/PeerScorer.scala Outdated
@t-bast t-bast merged commit a05f583 into master Mar 31, 2026
1 check passed
@t-bast t-bast deleted the peer-scorer-load-payment-events branch March 31, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants