-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set relay fees per node and save them to database #1890
Conversation
thomash-acinq
commented
Jul 19, 2021
- Fees are set per node instead of per channel (setting different fees for different channels to the same node is most probably an error)
- Fees are saved to a database so that we can keep a trace of historic fees and new channels with a known node use the fee that we set and not the default fee.
7b991a9
to
17a65d9
Compare
Codecov Report
@@ Coverage Diff @@
## master #1890 +/- ##
==========================================
+ Coverage 87.34% 87.35% +0.01%
==========================================
Files 159 159
Lines 12004 12110 +106
Branches 473 461 -12
==========================================
+ Hits 10485 10579 +94
- Misses 1519 1531 +12
|
6887a42
to
2ee89fc
Compare
2ee89fc
to
7fa170b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup.
This PR should be rebased on top of master and use the newly introduced RelayFees
class instead of tuples.
eclair-core/src/main/scala/fr/acinq/eclair/channel/Channel.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/db/RelayFeesDb.scala
Outdated
Show resolved
Hide resolved
|
||
import java.io.Closeable | ||
|
||
trait RelayFeesDb extends Closeable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the rationale for not adding this to the AuditDb
? It would fit right in I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AuditDb
should contain information for auditing only and should not be required for running the node, it should be write only. This new database is required for running the node as eclair reads from it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eclair reads from it
I missed that! In that case, it belongs to the PeersDb
I think. There is an ambiguity though, because we are also using that same table as an append-only, timestamped, event log. How about a very basic key-value table in PeersDb
and an event log table in AuditDb
? Yes there is duplication, but it's consistent with what we have between PaymentsDb
and AuditDb
.
We could also just put the relay fee changes in the channel_events
table, or introduce a new peer_events
table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, I've added a channel_updates
table in AuditDb
.
- Fees are set per node instead of per channel (setting different fees for different channels to the same node is most probably an error) - Fees are saved to a database so that we can keep a trace of historic fees and new channels with a known node use the fee that we set and not the default fee.
7fa170b
to
be0ef4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I'm glad we can get rid of the ugly initialRelayFees_opt
I added :)
You mention in the PR description that historical fees are kept, but that's not the case in the latest iteration, is it?
eclair-core/src/test/scala/fr/acinq/eclair/db/PeersDbSpec.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Let's wait for a final review from @pm47 before merging as he has more experience actually managing node fees than I do ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like @t-bast I'm also wondering why you have dropped the historical fees, do you feel like it's not worth it anymore? Can also be added later.
eclair-core/src/main/scala/fr/acinq/eclair/channel/Channel.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/db/pg/PgPeersDb.scala
Outdated
Show resolved
Hide resolved
I've added the historical fees back. They're now in |
eclair-core/src/main/scala/fr/acinq/eclair/channel/Channel.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/db/pg/PgAuditDb.scala
Outdated
Show resolved
Hide resolved
@@ -116,6 +118,11 @@ class DbEventHandler(nodeParams: NodeParams) extends Actor with ActorLogging { | |||
auditDb.add(ChannelEvent(e.channelId, e.commitments.remoteParams.nodeId, e.commitments.commitInput.txOut.amount, e.commitments.localParams.isFunder, !e.commitments.announceChannel, event)) | |||
channelsDb.updateChannelMeta(e.channelId, event) | |||
|
|||
case u: LocalChannelUpdate => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NB: this will trigger a lot of noise, we resend this every time a peer reconnects...but maybe it's ok since it doesn't contain that much data
Are you sure you haven't broken old way of setting fees? @t-bast
|
That's for sure, you have broke old interface. |
There has been a backward-incompatible change, yes. Need to use
I think @t-bast does that right before release. In the meantime: curl -u :<eclair_api_password> -X POST -F nodeId=<node> \
-F feeBaseMsat=<feebase> -F feeProportionalMillionths=<feeproportional> \
"http://localhost:8080/updaterelayfee" |
The documentation always reflects the latest release. I'm trying to improve that with #1951 so that release notes are written as |