This is a migration of https://github.com/bitcoin-core/gui/pull/163 @ 3707f8c (#163) to this repo. The initial version of the pull only changed gui code; however, reviewers suggested changes and refactoring that involve this repo, so I’ve ported it here. Please see the original pull for the review up to this point. Closes https://github.com/bitcoin-core/gui/issues/159.
