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

pset: PartiallySignedTransaction::GetUnsignedTx does not work correctly when issuance assets have null values #1126

Open
sanket1729 opened this issue Aug 1, 2022 · 1 comment

Comments

@sanket1729
Copy link
Member

sanket1729 commented Aug 1, 2022

According to the consensus validation rules, we must supple Null values for issunace/reissuance instead of explicit zero. However, the current code for tries does something else:

elements/src/psbt.cpp

Lines 126 to 132 in c80e926

if (input.m_issuance_value != std::nullopt && input.m_issuance_inflation_keys_amount != std::nullopt && force_unblinded) {
txin.assetIssuance.nAmount.SetToAmount(*input.m_issuance_value);
txin.assetIssuance.nInflationKeys.SetToAmount(*input.m_issuance_inflation_keys_amount);
} else {
txin.assetIssuance.nAmount = input.m_issuance_value_commitment;
txin.assetIssuance.nInflationKeys = input.m_issuance_inflation_keys_commitment;
}

Fix would be to have

  1. two separate if else statements for issunace/re-issuance.
  2. force_unblinded is always used. There is no way to do explicit issuances in the current pset workflow.

This calculation causes walletprocesspsbt to create signatures that do not validate because the sighash is calculated incorrectly.

@sanket1729 sanket1729 changed the title pset: PartiallySignedTransaction::GetUnsignedTx does work correctly when issuance assets have null values pset: PartiallySignedTransaction::GetUnsignedTx does not work correctly when issuance assets have null values Aug 23, 2022
@sanket1729
Copy link
Member Author

Part of this issue is addressed in #1150. Converting this issue to a Pset issue to support blinded issuances.

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

No branches or pull requests

1 participant