SegWit wallet support
Summary:
This introduces two command line flags (-addresstype and -changetype) which control
the type of addresses/outputs created by the GUI and RPCs. Certain RPCs allow
overriding these (getnewaddress and getrawchangeaddress). Supported types
are "legacy" (P2PKH and P2SH-multisig), "p2sh-segwit" (P2SH-P2WPKH and P2SH-P2WSH-multisig),
and "bech32" (P2WPKH and P2WSH-multisig).
A few utility functions are added to the wallet to construct different address type
and to add the necessary entries to the wallet file to be compatible with earlier
versions (see CWallet::LearnRelatedScripts, GetDestinationForKey,
GetAllDestinationsForKey, CWallet::AddAndGetDestinationForScript).
This is a partial backport of Core PR11403 : https://github.com/bitcoin/bitcoin/pull/11403/commits/940a21932ba769ba5829cba713579db84f96d2f8
Because we just have one address type to support, we don't need to add new configuration parameters like in the original code.
Depends on D3129, D3131 and D3132
Test Plan:
make check ./test/functional/test_runner.py
Reviewers: #bitcoin_abc, markblundeberg
Reviewed By: #bitcoin_abc, markblundeberg
Subscribers: markblundeberg
Differential Revision: https://reviews.bitcoinabc.org/D3133