Record cleartext p2sh redeem scripts in address manager #1688
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pay-to-script-hash (P2SH) addresses managed by the wallet must record
the nested script as well. These scripts are required to redeem a
P2SH output as it must appear in the signature script.
Since the redeem script itself might be the secret to redeem an output
(as in the case for some transaction script puzzles), rather than
needing a private key to produce a signature, btcwallet treated all
redeem scripts as secrets and required they be encrypted using the
private data symmetric encryption key. However, since mainnet launch,
dcrwallet has also recorded redeem scripts unencrypted in the
transaction store buckets (this was added to support the hacked-on
multisignature support). A database upgrade is performed to move
these unencrypted scripts into the address manager's data so that the
redeem script for a managed P2SH address is always known. The
udb.ScriptAddress interface has been extended to provide this redeem
script and the script version it is to be interpreted as.
The listscripts JSON-RPC method has been removed. This method
returned redeem scripts read from the now-removed transaction store
buckets. In the future, it is expected that the wallet may have
account kinds which generate P2SH addresses from derived BIP0044 keys,
complicating what should and should not be returned by a method such
as listscripts. As an alternative to this method, use validateaddress
on one of wallet's P2SH addresses to view the redeem scripts.