Skip to content

types: Clean up the ScriptPubkey type #174

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
merged 1 commit into from
May 15, 2025

Conversation

tcharding
Copy link
Member

@tcharding tcharding commented May 15, 2025

The ScriptPubkey type is a type that is returned by Core in various places. It seems like the Core devs put a fair bit of effort into it (probably because of this) and when the type changed in v22 it was changed in a way that was completely backwards compatible.

I failed to fully understand this when first adding the type.

With this patch applied there is now only one ScriptPubkey type (in libr.s) and also we add a model type.

The ScriptPubkey type is unusual in that its fields can be used to create TxOut if tx value is known - which for example in GetTxOut it is.

So here we also remove the v22 GetTxOut type since it only existed because of the perceived difference in ScriptPubkey which no longer exists.

Fix: #166

@tcharding tcharding changed the title types: Clean up the ScriptPubkey type types: Clean up the ScriptPubkey type May 15, 2025
@tcharding tcharding force-pushed the 05-15-fix-script-pubkey branch from 63fc880 to f255db4 Compare May 15, 2025 01:20
The `ScriptPubkey` type is a type that is returned by Core in various
places. It seems like the Core devs put a fair bit of effort into
it (probably because of this) and when the type changed in v22 it was
changed in a way that was completely backwards compatible.

I failed to fully understand this when first adding the type.

With this patch applied there is now only one `ScriptPubkey` type (in
`libr.s`) and also we add a model type.

The `ScriptPubkey` type is unusual in that its fields can be used to
create `TxOut` if tx value is known - which for example in `GetTxOut` it
is.

So here we also remove the v22 `GetTxOut` type since it only existed
because of the perceived difference in `ScriptPubkey` which no longer
exists.

Fix: rust-bitcoin#166
@tcharding tcharding force-pushed the 05-15-fix-script-pubkey branch from f255db4 to 730ed23 Compare May 15, 2025 01:20
@tcharding tcharding merged commit c51b9f7 into rust-bitcoin:master May 15, 2025
28 checks passed
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.

ScriptPubkey is strange
1 participant