Skip to content

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

@sanket1729

Description

@sanket1729

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions