I am playing with P2SH on regtest and try to understand the logic of creating and signing tx with bitcoin daemon. I am on version 0.15.1, and try to create a tx.
The used scriptPubKey results from a simple if/else/endif statement, not from a standard multisig approach. So I manually created the redeem script, and turned it into an address (beginning with "2"). I then created a transaction, that funds this address. Now I want to spend these funds. While creating the transaction, I discovered that the usage of "scriptPubKey" does not change anything in my output.
Example without "scriptPubKey":
bitcoin-cli -regtest createrawtransaction '''[{"txid":"'b5b67997f36627a461cd5ee1951aa775a68faa0c11c50b8f068ea1c7f4a9b087'","vout":'0'}]''' '''{"'mgpe9b44YYYbhDE1dbWosCSQDPYFkkoHjt'":'9.99995000'}'''
020000000187b0a9f4c7a18e068f0bc5110caa8fa675a71a95e15ecd61a42766f39779b6b50000000000ffffffff0178b69a3b000000001976a9140e507731ec9a94d454424f3ca65917a2abb45f4988ac00000000
Example with "scriptPubKey":
bitcoin-cli -regtest createrawtransaction '''[{"txid":"'b5b67997f36627a461cd5ee1951aa775a68faa0c11c50b8f068ea1c7f4a9b087'","vout":'0',"scriptPubKey":"'a914d53c738d730d8623eb2a070833599157beb3f6f687'"}]''' '''{"'mgpe9b44YYYbhDE1dbWosCSQDPYFkkoHjt'":'9.99995000'}'''
020000000187b0a9f4c7a18e068f0bc5110caa8fa675a71a95e15ecd61a42766f39779b6b50000000000ffffffff0178b69a3b000000001976a9140e507731ec9a94d454424f3ca65917a2abb45f4988ac00000000
The result is exactly the same. When the result is the same, what is the purpose of using this field as a parameter to "createrawtransaction"?