Skip to content

Fix build for cfg(async_payments) #3544

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

Merged

Conversation

valentinewallace
Copy link
Contributor

Static invoices don't have an amount_msats field.

Comment on lines 385 to 386
$self: ident, $self_type: ty, $invoice_fields: expr, $return_type: ty, $return_value: expr
$(, $self_mut: tt)?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm still checking that these inscrutable arguments make sense for the new macro, but it seemed good enough for a test-changes-only PR...

@@ -408,7 +424,8 @@ impl<'a> InvoiceWithExplicitSigningPubkeyBuilder<'a> {
invoice_explicit_signing_pubkey_builder_methods!(self, &mut Self);
invoice_builder_methods!(self, &mut Self, &mut Self, self, ExplicitSigningPubkey);
invoice_builder_methods_common!(self, &mut Self, self.invoice.fields_mut(), &mut Self, self, Bolt12Invoice);
invoice_builder_methods_test!(self, &mut Self, self.invoice.fields_mut(), &mut Self, self);
invoice_builder_methods_test!(self, Self, Self, self, mut);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this actually makes sense in bindings cause it requires move semantics, which most other languages don't have. Still, the allow(dead_code) screams at us..maybe we just drop the macro for this method and write it explicitly in the impl if its not used in c_bindings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I think that might've been a copy and paste error, in the latest push I removed the move semantics. But I wasn't able to repro the allow(dead_code) warning, what command were you using to hit that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, I was going off the #[cfg_attr(c_bindings, allow(dead_code))] on the method (which apparently should be removed).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like you're right and it can be removed, here and possibly elsewhere (although I'm not 100% sure my local testing is matching all of CI's checks). I'll go ahead and remove it if there's any further feedback, otherwise seems nicer to not delay CI further.

Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC, allow(dead_code) comes from the fact that with c_bindings there are two different builders (InvoiceWithExplicitSigningPubkeyBuilder and InvoiceWithDerivedSigningPubkeyBuilder). Some methods are only called on one of the two, though it's possible the surpression might be unnecessary in some cases.

Static invoices don't have an amount_msats field.
@jkczyz jkczyz self-requested a review January 15, 2025 20:00
@TheBlueMatt TheBlueMatt added this to the 0.1 milestone Jan 15, 2025
@TheBlueMatt
Copy link
Collaborator

CI passes for me locally.

@TheBlueMatt TheBlueMatt merged commit 2c5a1f6 into lightningdevkit:main Jan 15, 2025
21 of 25 checks passed
@TheBlueMatt
Copy link
Collaborator

Backported in #3536.

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.

4 participants