Skip to content

pset: mask pegin/issuance flags out of the input outpoint - #293

Open
delta1 wants to merge 1 commit into
ElementsProject:masterfrom
delta1:issues/292
Open

pset: mask pegin/issuance flags out of the input outpoint#293
delta1 wants to merge 1 commit into
ElementsProject:masterfrom
delta1:issues/292

Conversation

@delta1

@delta1 delta1 commented Jul 31, 2026

Copy link
Copy Markdown
Member

The pegin and issuance flags are stored in the high bits of the PSET previous_output_index, but they are not part of the outpoint itself: Elements Core keeps them separate in memory and only re-adds them when serializing. Input::issuance_ids was computing the asset entropy over the flagged index, so any new issuance round-tripped through a PSET derived different asset and token IDs than Elements does.

extract_tx already masked the flags, but did so inline. Add Input::previous_outpoint, which strips them (leaving the all-1's coinbase index alone, as it carries no flags), and use it from both places so the two cannot drift apart again. Also replace the bare 1 << 30 / 1 << 31 literals with named constants.

Fixes #292

The pegin and issuance flags are stored in the high bits of the PSET
`previous_output_index`, but they are not part of the outpoint itself:
Elements Core keeps them separate in memory and only re-adds them when
serializing. `Input::issuance_ids` was computing the asset entropy over
the flagged index, so any new issuance round-tripped through a PSET
derived different asset and token IDs than `TxIn::issuance_ids` and than
Elements Core does. Those IDs also feed the blinding code.

`extract_tx` already masked the flags, but did so inline. Add
`Input::previous_outpoint`, which strips them (leaving the all-1's
coinbase index alone, as it carries no flags), and use it from both
places so the two cannot drift apart again. Also replace the bare
`1 << 30` / `1 << 31` literals with named constants.

Fixes ElementsProject#292
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.

PSET extraction leaves pegin flag in TxIn.previous_output.vout

1 participant