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

Show JIT channel fee in wallet history #1103

Merged
merged 1 commit into from
Aug 23, 2023
Merged

Conversation

Restioson
Copy link
Contributor

image

Fixes #982

@holzeis
Copy link
Contributor

holzeis commented Aug 16, 2023

@Restioson That was not the intention of that ticket 🙈. I suggested a similar display as for the matching fees 😅

Screenshot 2023-08-16 at 13 40 49

This change goes more into the direction of showing transaction details. #872 Did you maybe linked the wrong ticket?

@Restioson
Copy link
Contributor Author

Restioson commented Aug 16, 2023

I didn't link the wrong ticket - check main since #1054 has been merged 🙂 This PR extends #1054 by separating JIT opening fee from regular payments

Copy link
Contributor

@luckysori luckysori 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 a couple of remarks that are worth considering.

@@ -21,7 +21,11 @@ pub use crate::price::Price;
pub use crate::price::Prices;

/// The prefix used in the description field of an order-matching fee invoice to be paid by a taker.
pub const FEE_INVOICE_DESCRIPTION_PREFIX_TAKER: &str = "taker-fee-";
pub const FEE_INVOICE_DESCRIPTION_PREFIX_TAKER: &str = "taker-fee";
Copy link
Contributor

Choose a reason for hiding this comment

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

📣 I appreciate that it's probably nicer to remove this dash, but I think this is a breaking change. Probably worth avoiding that headache.

As a side note, I am pretty sure the prefix idea that I introduced is not very good and there were better alternatives 🙈

Copy link
Contributor Author

@Restioson Restioson Aug 18, 2023

Choose a reason for hiding this comment

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

📣 I appreciate that it's probably nicer to remove this dash, but I think this is a breaking change. Probably worth avoiding that headache.

Yea, most definitely 😅

Maybe for now I should add a legacy match to fallback to the old prefix with the hyphens.

The reason I added this was because there isn't really a way to match on multiple prefixes cleanly, whereas if you define the syntax for a structured payment invoice description as

{tag} {additional_data}

then you can just split_once by space and match on the tag to get what kind of invoice it is.

However, it's worth noting that both this implementation and the previous implementation could lead to some strange results.

For instance, what would happen if an invoice were paid by a mischievous (or even malicious) user with the description taker-fee-NotAnOrderId?!/.sidfj? At best this would display wrong, worse it could crash the app, and at worst it could introduce a security vulnerability.

It's probably worth workshopping how this should work 😅

crates/orderbook-commons/src/lib.rs Outdated Show resolved Hide resolved
@Restioson
Copy link
Contributor Author

I've pushed a commit to revert, and happy to squash up once we've resolved the discussion. Please don't merge until then

@holzeis
Copy link
Contributor

holzeis commented Aug 21, 2023

I didn't link the wrong ticket - check main since #1054 has been merged 🙂 This PR extends #1054 by separating JIT opening fee from regular payments

Hmm.. on main it's now simply shown as an outgoing payment instead of showing directly in the title that it is a JIT channel open fee payment. It seems inconsistent that we show a matching fee in the title but not for the JIT channel opening fee.

@Restioson
Copy link
Contributor Author

I might not be understanding you correctly here so bear with me as I repeat what I understand from what you said 😅

Hmm.. on main it's now simply shown as an outgoing payment instead of showing directly in the title that it is a JIT channel open fee payment

Agree, that's what this PR is changing.

It seems inconsistent that we show a matching fee in the title but not for the JIT channel opening fee

On this branch, it does show as channel open fee. Let me show another screenshot in case it wasn't clear:

image

@holzeis
Copy link
Contributor

holzeis commented Aug 22, 2023

I might not be understanding you correctly here so bear with me as I repeat what I understand from what you said 😅

Hmm.. on main it's now simply shown as an outgoing payment instead of showing directly in the title that it is a JIT channel open fee payment

Agree, that's what this PR is changing.

It seems inconsistent that we show a matching fee in the title but not for the JIT channel opening fee

On this branch, it does show as channel open fee. Let me show another screenshot in case it wasn't clear:

image

Oh that's great! I just saw the other screenshot and thought this was the only change 😅

Well done 👍 looks nice. Sorry for the confusion 😅

@Restioson
Copy link
Contributor Author

No problem!

So I guess it's just the query about prefixes vs splitting to resolve? Maybe that should go in a follow-up and just stick to prefixes for now, though. In that case I can rebase this and squash it up before merge

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 👍

@Restioson Restioson added this pull request to the merge queue Aug 23, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 23, 2023
@Restioson Restioson added this pull request to the merge queue Aug 23, 2023
Merged via the queue into main with commit 2395577 Aug 23, 2023
7 checks passed
@Restioson Restioson deleted the show-jit-fee-in-history branch August 23, 2023 16:42
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.

Show JIT Channel fee as fee in the wallet history
3 participants