Skip to content

BIP352: Fix recipients typing in create_outputs to List[Dict[str, str]]#1961

Closed
Snezhkko wants to merge 2 commits intobitcoin:masterfrom
Snezhkko:chore/fix-create-outputs-recipients-typing
Closed

BIP352: Fix recipients typing in create_outputs to List[Dict[str, str]]#1961
Snezhkko wants to merge 2 commits intobitcoin:masterfrom
Snezhkko:chore/fix-create-outputs-recipients-typing

Conversation

@Snezhkko
Copy link
Copy Markdown
Contributor

@Snezhkko Snezhkko commented Sep 8, 2025

Update the recipients parameter in create_outputs from List[str] to List[Dict[str, str]]. This aligns the type annotation with actual usage in the code (recipient["address"], recipient["scan_pub_key"], recipient["spend_pub_key"]) and matches the structure provided by the test vectors. The previous annotation was misleading and could cause static type checkers and IDEs to surface incorrect diagnostics.

@murchandamus murchandamus added Proposed BIP modification PR by non-owner to update BIP content Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified labels Sep 10, 2025
Copy link
Copy Markdown
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

ACK 48d704d

Comment thread bip-0352/reference.py Outdated


def create_outputs(input_priv_keys: List[Tuple[ECKey, bool]], outpoints: List[COutPoint], recipients: List[str], expected: Dict[str, any] = None, hrp="tsp") -> List[str]:
def create_outputs(input_priv_keys: List[Tuple[ECKey, bool]], outpoints: List[COutPoint], recipients: List[Dict[str, str]], expected: Dict[str, any] = None, hrp="tsp") -> List[str]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These objects are indeed List[Dict[str, str]]. An example when printing the recipients values:

[{'address': 'sp1qqgste7k9hx0qftg6qmwlkqtwuy6cycyavzmzj85c6qdfhjdpdjtdgqaxww2fnhrx05cghth75n0qcj59e3e2anscr0q9wyknjxtxycg07y3pevyj',
  'scan_pub_key': '0220bcfac5b99e04ad1a06ddfb016ee13582609d60b6291e98d01a9bc9a16c96d4',
  'spend_pub_key': '03a6739499dc667d308baefea4de0c4a85cc72aece181bc05712d3919662610ff1'},
 {'address': 'sp1qqgste7k9hx0qftg6qmwlkqtwuy6cycyavzmzj85c6qdfhjdpdjtdgqaxww2fnhrx05cghth75n0qcj59e3e2anscr0q9wyknjxtxycg07y3pevyj',
  'scan_pub_key': '0220bcfac5b99e04ad1a06ddfb016ee13582609d60b6291e98d01a9bc9a16c96d4',
  'spend_pub_key': '03a6739499dc667d308baefea4de0c4a85cc72aece181bc05712d3919662610ff1'}]

@murchandamus
Copy link
Copy Markdown
Member

Looking for sign-off from authors: @josibake, @RubenSomsen

@murchandamus
Copy link
Copy Markdown
Member

cc: @theStack

@edilmedeiros
Copy link
Copy Markdown

ACK 48d704d

I recently noticed this while preparing #2153, but not included in that PR in favor of this. Happy to rebase #2153 when/if this gets merged.

Copy link
Copy Markdown
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

re-ACK, thanks @edilmedeiros for reviewing. This is a straightforward fix; it doesn't change the code, only the hints for static type checkers, and I think it can move forward.

@jonatack jonatack added Bug fix and removed Proposed BIP modification PR by non-owner to update BIP content Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified labels May 8, 2026
@jonatack
Copy link
Copy Markdown
Member

jonatack commented May 8, 2026

Rebased and merged as c5c76f3. Thanks @Snezhkko for your patience. @edilmedeiros you can now git pull and rebase #2153 on it, if needed (edit: this doesn't appear to conflict).

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.

4 participants