Skip to content

Reject recipient addresses from the wrong network - #370

Open
emma31-dev wants to merge 2 commits into
bitcoindevkit:masterfrom
emma31-dev:fix/360-create-tx-network-validation
Open

emma31-dev wants to merge 2 commits into
bitcoindevkit:masterfrom
emma31-dev:fix/360-create-tx-network-validation

Conversation

@emma31-dev

Copy link
Copy Markdown

Description

Fixes #360 .

Retain recipient addresses as unchecked addresses until the wallet network is available, then validate them before converting them to scripts. create_tx, create_sp_tx --to, and create_dns_tx --to now reject addresses from a different network. create_sp_tx --to-sp also rejects silent payment codes whose network differs from the wallet’s.

Notes to the reviewers

The mismatch errors use BDKCliError::Generic with a formatted message rather than adding payload-carrying error variants. Carrying an address or silent payment code in new variants made BDKCliError large enough for Clippy’s result_large_err lint to fail across many functions.

Some integration tests used testnet tb1... recipients with regtest wallets. Those fixtures now use regtest addresses so the tests exercise their intended behavior instead of failing at network validation.

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt
  • I ran cargo clippy successfully before committing

Bugfixes:

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

create_tx accepts recipient addresses from the wrong network

1 participant