Fixes https://github.com/ElementsProject/elements/issues/1263
When not running in Elements mode, GetValidFedpegScripts returns an
empty vector. Subsequently `calculate_contract` is called with
`fedpegscripts.front().second` which is a null reference. This reference
is passed into `MatchLiquidWatchman` which tries to dereference the null
reference and causes a segfault.
This fix throws an exception in `getpeginaddress` if fedpegscripts is
empty, returning an error to the RPC caller. It also adds a functional
regression test.
This merge from upstream split the rpcwallet file out into separate
files. Leftover Elements specific funtions were moved into
wallet/rpc/elements.cpp
Co-authored-by: James Dorfman <dorfmanjames@gmail.com>