### Describe the issue

### Can you reliably reproduce the issue?
#### If so, please list the steps to reproduce below:
1. Follow the steps in https://gist.github.com/gavinandresen/3966071

### Expected behaviour
The first `signrawtransaction` command should be successful and return a partially signed transaction that can be sent to the other cosigners for signing.

### Actual behaviour
Instead `signrawtransaction` fails and does not return a partially signed transaction.

### What version of bitcoin-core are you using?
This was reported for 0.14.0. However we have determined that it affects 0.11.1 and later, and likely 0.11.0. It does not affect 0.10.3.

It appears that the bug is caused by [this `VerifyScript` call](https://github.com/bitcoin/bitcoin/blob/master/src/rpc/rawtransaction.cpp#L849) which was introduced in 8ac2a4e1788426329b842eea7121b8eac7875c76 which has been a part of all versions since 0.11.0rc1.

See also: https://bitcointalk.org/index.php?topic=1823847.msg18164848#msg18164848
"       ,...\n"
            "     ]\n"
            "2. \"outputs\"               (object, required) a json object with outputs\n"
            "    {\n"
            "      \"address\": x.xxx,    (numeric or string, required) The key is the bitcoin address, the numeric value (can be string) is the " + CURRENCY_UNIT + " amount\n"
            "      \"data\": \"hex\"      (string, required) The key is \"data\", the value is hex encoded data\n"
            "      ,...\n"
            "    }\n"
            "3. locktime                  (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs\n"
            "4. replaceable               (boolean, optional, default=false) Marks this transaction as BIP125 replaceable.\n"
            "                             Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible.\n"
            "\nResult:\n"
            "\"transaction\"              (string) hex string of the transaction\n"
            "\nExamples:\n"
            + HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"address\\\":0.01}\"")
            + HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"data\\\":\\\"00010203\\\"}\"")
            + HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\"")
            + HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"data\\\":\\\"00010203\\\"}\"")
        );
    RPCTypeCheck(request.params, {UniValue::VARR, UniValue::VOBJ, UniValue::VNUM}, true);
    if (request.params[0].isNull() || request.params[1].isNull())
        throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, arguments 1 and 2 must be non-null");
    UniValue inputs = request.params[0].get_array();
    UniValue sendTo = request.params[1].get_obj();
    CMutableTransaction rawTx;
    if (!request.params[2].isNull()) {
        int64_t nLockTime = request.params[2].get_int64();
        if (nLockTime < 0 || nLockTime > std::numeric_limits<uint32_t>::max())
            throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, locktime out of range");
        rawTx.nLockTime = nLockTime;