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

Store proofs used for paying a lightning invoice #311

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sihamon
Copy link
Collaborator

@sihamon sihamon commented Sep 7, 2023

Closes #66.

@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Patch coverage: 55.55% and project coverage change: -0.33% ⚠️

Comparison is base (87c0adc) 57.15% compared to head (3c334d2) 56.83%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #311      +/-   ##
==========================================
- Coverage   57.15%   56.83%   -0.33%     
==========================================
  Files          43       43              
  Lines        4010     4110     +100     
==========================================
+ Hits         2292     2336      +44     
- Misses       1718     1774      +56     
Files Changed Coverage Δ
cashu/mint/ledger.py 28.11% <0.00%> (-0.13%) ⬇️
cashu/mint/crud.py 69.33% <60.00%> (-0.67%) ⬇️
cashu/mint/migrations.py 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@AngusP AngusP left a comment

Choose a reason for hiding this comment

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

Sorry not a very useful review 😅 -- the msat vs sat 'issue' is more general than this PR but seemed worth pointing out anyway

VALUES (?, ?, ?, ?, ?, ?, ?)
""",
(
invoice.amount_msat / 1000,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps worth the explicit 'cast' to an int to indicate that's what's going to happen DB-side anyway?

Suggested change
invoice.amount_msat / 1000,
int(invoice.amount_msat / 1000),

"""
await db.execute(f"""
CREATE TABLE IF NOT EXISTS {table_with_schema(db, 'payments')} (
invoice_amount {db.big_int} NOT NULL,
Copy link
Collaborator

@AngusP AngusP Sep 11, 2023

Choose a reason for hiding this comment

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

Storing an amount as a big_int, but it is converted from msats to sats above with / 1000, so any sub-sat amount is going to be truncated off... Probably OK, but a potential source of problems?

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.

[Mint] Store proofs used for paying a Lightning invoice
2 participants