I'll first give some thoughts on the design of the wallet in general, before explaining current and future SegWit wallet support.
Conceptually, a wallet currently contains mapKeys
, mapScripts
, and setWatchOnly
, which together determine which outputs
are considered "ours" (IsMine), and how to solve and sign for them. Then the wallet further contains key metadata, key chains, and key pool at the wallet level that feed into this.
We determine whether outputs are ours using ad-hoc logic that mostly answers the question "Could we sign this?", but with some notable exceptions: