This commit does not change behavior except for error messages which now
include more complete information.
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/19619 | core#19619]] [6/8]
https://github.com/bitcoin/bitcoin/pull/19619/commits/a987438e9d9cad0b5530e218a447928485f3fd93
Depends on D10228
Depends on D10123 (for rpc_createmultisig.py)