Skip to content
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

Save routing fees in database #949

Merged
merged 1 commit into from
Jul 17, 2023
Merged

Save routing fees in database #949

merged 1 commit into from
Jul 17, 2023

Conversation

da-kami
Copy link
Contributor

@da-kami da-kami commented Jul 14, 2023

fixes https://github.com/get10101/meta/issues/177

Notes:

  • I have not added the prometheus counter yet because I am waiting for the result of discussion here: Feat/matching fee tracking #946 (comment)
  • Opted for a separate table in the databse instead of adding a table that abstracts over multiple "fees". I think it's better to created views / reports on top

Copy link
Contributor

@holzeis holzeis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

I left minor remarks, but nothing critical to action.


#[derive(Insertable, Debug, PartialEq)]
#[diesel(table_name = routing_fees)]
struct NewRoutingFee {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 is it really necessary to have a separate insertable model for this simple data?

Personally I would prefer one model as I guess it will also reduce complexity.

coordinator/src/node/event_post_processing.rs Outdated Show resolved Hide resolved
coordinator/src/node/event_post_processing.rs Outdated Show resolved Hide resolved
coordinator/src/node/event_post_processing.rs Outdated Show resolved Hide resolved
};

if let Err(e) = db::routing_fees::insert(
NewRoutingFee {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the struct NewRoutingFee is only used here, I think you can remove it and pass in the fields directly into this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My timebox for addressing this expired :)
Diesel kept annoying me when I tried to safe the values directly using a tuple. I don't think it's worth investing more time into fighting with Diesel.

I generally think it's OK to use the same pattern for the tables and accept this bit of boilerplate. If you think it's important I'm happy to address it in a follow up.

Copy link
Contributor

@bonomat bonomat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@da-kami da-kami force-pushed the feat/matching-fee-tracking branch 3 times, most recently from 404dfa1 to 044e726 Compare July 17, 2023 07:41
Base automatically changed from feat/matching-fee-tracking to main July 17, 2023 08:10
@da-kami
Copy link
Contributor Author

da-kami commented Jul 17, 2023

bors r+

@bors
Copy link
Contributor

bors bot commented Jul 17, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit a506a73 into main Jul 17, 2023
@bors bors bot deleted the feat/track-routing-fees branch July 17, 2023 10:50
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.

3 participants