Skip to content

Conversation

sipa
Copy link
Member

@sipa sipa commented Mar 14, 2016

Before this, if someone imported a scriptPubKey directly (in hex form) using importaddress, outputs sending to it would be treated as change, as the corresponding CTxDestination was not added to the address book.

Fix this by trying to detect scriptPubKeys that are in fact convertible to a CTxDestination and add them anyway. Add a warning to the RPC help to warn against importing raw non-standard scripts.

Open question: should the RPC fail/warn in some way when this conversion is not possible? Things like listunspent work fine with such outputs, but listtransactions won't.

@sipa
Copy link
Member Author

sipa commented Mar 14, 2016

In retrospect, I think it would have been better to have a separate importscript RPC, that only takes a hex script as input, for the p2sh=false case input to importaddress, as its behaviour is very different and does not correspond to what would be considered "importing an address".

@laanwj
Copy link
Member

laanwj commented Mar 18, 2016

utACK 2b3947c

Before this, if someone imported a scriptPubKey directly (in hex form) using
importaddress, outputs sending to it would be treated as change, as the
corresponding CTxDestination was not added to the address book.

Fix this by trying to detect scriptPubKeys that are in fact convertible to a
CTxDestination and add them anyway. Add a warning to the RPC help to warn
against importing raw non-standard scripts.
@sipa sipa force-pushed the fixscriptimport branch from 2b3947c to 595b22e Compare June 2, 2016 13:53
@sipa
Copy link
Member Author

sipa commented Jun 2, 2016

Rebased.

@jonasschnelli
Copy link
Contributor

utACK 595b22e

@laanwj laanwj merged commit 595b22e into bitcoin:master Jun 20, 2016
laanwj added a commit that referenced this pull request Jun 20, 2016
595b22e Stop treating importaddress'ed scripts as change (Pieter Wuille)
codablock pushed a commit to codablock/dash that referenced this pull request Dec 28, 2017
595b22e Stop treating importaddress'ed scripts as change (Pieter Wuille)
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
595b22e Stop treating importaddress'ed scripts as change (Pieter Wuille)
zkbot added a commit to zcash/zcash that referenced this pull request Dec 19, 2019
Bitcoin wallet PRs 3

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#7687
- bitcoin/bitcoin#11116
  - Excludes SegWit tests
  - Excludes `isInvalid` code (which is part of the SegWit support structure)
- bitcoin/bitcoin#13002
  - Excludes changes to `importwallet` (missing bitcoin/bitcoin#11667)
  - Excludes changes to `ProcessImport` (missing bitcoin/bitcoin#7551)
  - Third commit was rewritten to add an internal SigVersion argument (which we didn't have because it was added to support SegWit logic).
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants