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

Restore any missing psbt metadata that resource constrained signers strip #6767

Conversation

ksedgwic
Copy link
Collaborator

@ksedgwic ksedgwic commented Oct 12, 2023

Fixes #6764

This is an alternate approach to #6766 . By combining the signed psbt back into the
pre-signed psbt any metadata that a resource constrained signer (VLS) strips (input.utxo) will be restored.

@ksedgwic
Copy link
Collaborator Author

@vincenzopalazzo The CI failure I'm seeing here doesn't seem related to us? Wonder if everyone is seeing it ...

if (wally_psbt_clone_alloc(psbt0, 0, &combined_psbt) != WALLY_OK)
abort();
if (wally_psbt_combine(combined_psbt, psbt1) != WALLY_OK) {
tal_wally_end_onto(ctx, combined_psbt, struct wally_psbt);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is this the right thing to do here? Should we free the memory immediately instead?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is right, because from the docs of tal_wally_end_onto I found that
this method iterates over an object allocated by libwally. So I guess it is the safe way to delete an object that wally worked on?

Copy link
Contributor

Choose a reason for hiding this comment

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

This works, but leaks the combined_psbt. You should return tal_free(combined_psbt); after this (of course, this code shouldn't happen at all, since the HSM said the PSBT was good!).

@vincenzopalazzo vincenzopalazzo self-assigned this Oct 12, 2023
@vincenzopalazzo vincenzopalazzo added this to the v23.11 milestone Oct 12, 2023
Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

ACK 0837e86

Copy link
Contributor

@rustyrussell rustyrussell left a comment

Choose a reason for hiding this comment

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

Ack 0837e86

if (wally_psbt_clone_alloc(psbt0, 0, &combined_psbt) != WALLY_OK)
abort();
if (wally_psbt_combine(combined_psbt, psbt1) != WALLY_OK) {
tal_wally_end_onto(ctx, combined_psbt, struct wally_psbt);
Copy link
Contributor

Choose a reason for hiding this comment

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

This works, but leaks the combined_psbt. You should return tal_free(combined_psbt); after this (of course, this code shouldn't happen at all, since the HSM said the PSBT was good!).

…trip

Fixes ([ElementsProject#6764])
Changelog-Fixed: Restore any missing metadata that resource constrained signers stripped
Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

ACK f86efbe

@vincenzopalazzo vincenzopalazzo enabled auto-merge (rebase) October 25, 2023 08:49
@vincenzopalazzo vincenzopalazzo merged commit 39e17ff into ElementsProject:master Oct 25, 2023
34 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

splice: remote signed PSBT is missing required fields
3 participants