2
1
The signrawtransaction rpc method calls for the following use:
signrawtransaction "hexstring" ( [{"txid":"id","vout":n,"scriptPubKey":"hex","redeemScript":"hex"},...] ["privatekey1",...] sighashtype )
Why is scriptPubKey included in here? It seems from the code that it just looks it up anyway and compared to the value given:
if (coins.IsAvailable(nOut) && coins.vout[nOut].scriptPubKey != scriptPubKey) {
string err("Previous output scriptPubKey mismatch:\n");
err = err + coins.vout[nOut].scriptPubKey.ToString() + "\nvs:\n"+
scriptPubKey.ToString();
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, err);
}
My best guesses:
- Maybe there are some cases where it won't be able to look up the scriptPubKey?
- Maybe so this will work offline?
- Maybe it's not actually needed, but kept for backwards compatibility?