Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signrawtransactionwithkey gives confusing error when missing redeemScript #16249

Closed
ajtowns opened this issue Jun 20, 2019 · 0 comments · Fixed by #16250
Closed

signrawtransactionwithkey gives confusing error when missing redeemScript #16249

ajtowns opened this issue Jun 20, 2019 · 0 comments · Fixed by #16250

Comments

@ajtowns
Copy link
Contributor

ajtowns commented Jun 20, 2019

Forgetting to include the redeemscript when invoking signrawtransactionwithkey used to give a useful error:

$ bitcoin-cli -regtest signrawtransactionwithkey "02000000018a24833c36be23272080d6be8a53e36586b81e0ac447e1298ee58e18cc96bdee0100000000ffffffff0118246bee0000000017a914e139e3904e9e69ecbce87b0fcfb73b1b0e3b9e818700000000" '["cUJ7bUweEgENv4ixezsSyZa2uBJxR37iFLtCt18gSvkjpkj7CmMr"]'  '[{"txid":"eebd96cc188ee58e29e147c40a1eb88665e3538abed680202723be363c83248a","vout":1,"scriptPubKey":"0020f89f2138a58a2042310f297259ca8050bcaecd3a0f3c936edffb7e38e31d775a","amount":"40.00000000"}]'

With 0.17:

error code: -3
error message:
Missing redeemScript

With master/0.18:

{
  "hex": "02000000018a24833c36be23272080d6be8a53e36586b81e0ac447e1298ee58e18cc96bdee0100000000ffffffff0118246bee0000000017a914e139e3904e9e69ecbce87b0fcfb73b1b0e3b9e818700000000",
  "complete": false,
  "errors": [
    {
      "txid": "eebd96cc188ee58e29e147c40a1eb88665e3538abed680202723be363c83248a",
      "vout": 1,
      "witness": [
      ],
      "scriptSig": "",
      "sequence": 4294967295,
      "error": "Witness program was passed an empty witness"
    }
  ]
}
maflcko pushed a commit to maflcko/bitcoin-core that referenced this issue Jul 2, 2019
…sing redeemScript/witnessScript

0117459 signrawtransactionwithkey: report error when missing redeemScript/witnessScript param (Anthony Towns)

Pull request description:

  Adding support for "witnessScript" as an alternative to "redeemScript" when using "signrawtransactionwithkey" meant that the `RPCTypeCheckObj()` call in `SignTransaction` can't error out just because either parameter is missing -- it's only a problem if both are missing, which isn't a state `RPCTypeCheckObj()` tests for. This results in the regression described in bitcoin#16249. This patch adds some code to test for this case and give a similar error, namely:

      error code: -8
      error message:
      Missing redeemScript/witnessScript

  Fixes: bitcoin#16249

ACKs for top commit:
  meshcollider:
    utACK bitcoin@0117459
  promag:
    ACK 0117459. Could also write test without `dict`/`del`:

Tree-SHA512: cf51346b7dea551b7f18f2a93c2a336a293b2535c62c03a5263cd2be8c58cf0cc302891da659c167e88ad1a68a756472c3c07e99f71627c61d32886fc5a3a353
sidhujag pushed a commit to syscoin/syscoin that referenced this issue Jul 3, 2019
…sing redeemScript/witnessScript

0117459 signrawtransactionwithkey: report error when missing redeemScript/witnessScript param (Anthony Towns)

Pull request description:

  Adding support for "witnessScript" as an alternative to "redeemScript" when using "signrawtransactionwithkey" meant that the `RPCTypeCheckObj()` call in `SignTransaction` can't error out just because either parameter is missing -- it's only a problem if both are missing, which isn't a state `RPCTypeCheckObj()` tests for. This results in the regression described in bitcoin#16249. This patch adds some code to test for this case and give a similar error, namely:

      error code: -8
      error message:
      Missing redeemScript/witnessScript

  Fixes: bitcoin#16249

ACKs for top commit:
  meshcollider:
    utACK bitcoin@0117459
  promag:
    ACK 0117459. Could also write test without `dict`/`del`:

Tree-SHA512: cf51346b7dea551b7f18f2a93c2a336a293b2535c62c03a5263cd2be8c58cf0cc302891da659c167e88ad1a68a756472c3c07e99f71627c61d32886fc5a3a353
fanquake added a commit that referenced this issue Jul 7, 2019
…itnessScript

1dc357d signrawtransactionwithkey: report error when missing redeemScript/witnessScript param (Anthony Towns)

Pull request description:

  Backport of #16250 which fixes regression introduced in 0.18 in relation to signrawtransactionwithkey error handling (see #16249).

Tree-SHA512: 0d75fa2aa578b886ace3bda92a02e25993f9f51d41db8c0eb3013bd77d266c45ad8b67dd0ed11c66533724f892be4e254edeb59fa70585ff762f522791fcca36
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
knst pushed a commit to knst/dash that referenced this issue Feb 2, 2023
…sing redeemScript/witnessScript

0117459 signrawtransactionwithkey: report error when missing redeemScript/witnessScript param (Anthony Towns)

Pull request description:

  Adding support for "witnessScript" as an alternative to "redeemScript" when using "signrawtransactionwithkey" meant that the `RPCTypeCheckObj()` call in `SignTransaction` can't error out just because either parameter is missing -- it's only a problem if both are missing, which isn't a state `RPCTypeCheckObj()` tests for. This results in the regression described in bitcoin#16249. This patch adds some code to test for this case and give a similar error, namely:

      error code: -8
      error message:
      Missing redeemScript/witnessScript

  Fixes: bitcoin#16249

ACKs for top commit:
  meshcollider:
    utACK bitcoin@0117459
  promag:
    ACK 0117459. Could also write test without `dict`/`del`:

Tree-SHA512: cf51346b7dea551b7f18f2a93c2a336a293b2535c62c03a5263cd2be8c58cf0cc302891da659c167e88ad1a68a756472c3c07e99f71627c61d32886fc5a3a353
knst pushed a commit to knst/dash that referenced this issue Feb 13, 2023
…sing redeemScript/witnessScript

0117459 signrawtransactionwithkey: report error when missing redeemScript/witnessScript param (Anthony Towns)

Pull request description:

  Adding support for "witnessScript" as an alternative to "redeemScript" when using "signrawtransactionwithkey" meant that the `RPCTypeCheckObj()` call in `SignTransaction` can't error out just because either parameter is missing -- it's only a problem if both are missing, which isn't a state `RPCTypeCheckObj()` tests for. This results in the regression described in bitcoin#16249. This patch adds some code to test for this case and give a similar error, namely:

      error code: -8
      error message:
      Missing redeemScript/witnessScript

  Fixes: bitcoin#16249

ACKs for top commit:
  meshcollider:
    utACK bitcoin@0117459
  promag:
    ACK 0117459. Could also write test without `dict`/`del`:

Tree-SHA512: cf51346b7dea551b7f18f2a93c2a336a293b2535c62c03a5263cd2be8c58cf0cc302891da659c167e88ad1a68a756472c3c07e99f71627c61d32886fc5a3a353
knst pushed a commit to knst/dash that referenced this issue Feb 28, 2023
…sing redeemScript/witnessScript

0117459 signrawtransactionwithkey: report error when missing redeemScript/witnessScript param (Anthony Towns)

Pull request description:

  Adding support for "witnessScript" as an alternative to "redeemScript" when using "signrawtransactionwithkey" meant that the `RPCTypeCheckObj()` call in `SignTransaction` can't error out just because either parameter is missing -- it's only a problem if both are missing, which isn't a state `RPCTypeCheckObj()` tests for. This results in the regression described in bitcoin#16249. This patch adds some code to test for this case and give a similar error, namely:

      error code: -8
      error message:
      Missing redeemScript/witnessScript

  Fixes: bitcoin#16249

ACKs for top commit:
  meshcollider:
    utACK bitcoin@0117459
  promag:
    ACK 0117459. Could also write test without `dict`/`del`:

Tree-SHA512: cf51346b7dea551b7f18f2a93c2a336a293b2535c62c03a5263cd2be8c58cf0cc302891da659c167e88ad1a68a756472c3c07e99f71627c61d32886fc5a3a353
knst pushed a commit to knst/dash that referenced this issue Mar 14, 2023
…sing redeemScript/witnessScript

0117459 signrawtransactionwithkey: report error when missing redeemScript/witnessScript param (Anthony Towns)

Pull request description:

  Adding support for "witnessScript" as an alternative to "redeemScript" when using "signrawtransactionwithkey" meant that the `RPCTypeCheckObj()` call in `SignTransaction` can't error out just because either parameter is missing -- it's only a problem if both are missing, which isn't a state `RPCTypeCheckObj()` tests for. This results in the regression described in bitcoin#16249. This patch adds some code to test for this case and give a similar error, namely:

      error code: -8
      error message:
      Missing redeemScript/witnessScript

  Fixes: bitcoin#16249

ACKs for top commit:
  meshcollider:
    utACK bitcoin@0117459
  promag:
    ACK 0117459. Could also write test without `dict`/`del`:

Tree-SHA512: cf51346b7dea551b7f18f2a93c2a336a293b2535c62c03a5263cd2be8c58cf0cc302891da659c167e88ad1a68a756472c3c07e99f71627c61d32886fc5a3a353
knst pushed a commit to knst/dash that referenced this issue Mar 15, 2023
…sing redeemScript/witnessScript

0117459 signrawtransactionwithkey: report error when missing redeemScript/witnessScript param (Anthony Towns)

Pull request description:

  Adding support for "witnessScript" as an alternative to "redeemScript" when using "signrawtransactionwithkey" meant that the `RPCTypeCheckObj()` call in `SignTransaction` can't error out just because either parameter is missing -- it's only a problem if both are missing, which isn't a state `RPCTypeCheckObj()` tests for. This results in the regression described in bitcoin#16249. This patch adds some code to test for this case and give a similar error, namely:

      error code: -8
      error message:
      Missing redeemScript/witnessScript

  Fixes: bitcoin#16249

ACKs for top commit:
  meshcollider:
    utACK bitcoin@0117459
  promag:
    ACK 0117459. Could also write test without `dict`/`del`:

Tree-SHA512: cf51346b7dea551b7f18f2a93c2a336a293b2535c62c03a5263cd2be8c58cf0cc302891da659c167e88ad1a68a756472c3c07e99f71627c61d32886fc5a3a353
knst pushed a commit to knst/dash that referenced this issue Mar 19, 2023
…sing redeemScript/witnessScript

0117459 signrawtransactionwithkey: report error when missing redeemScript/witnessScript param (Anthony Towns)

Pull request description:

  Adding support for "witnessScript" as an alternative to "redeemScript" when using "signrawtransactionwithkey" meant that the `RPCTypeCheckObj()` call in `SignTransaction` can't error out just because either parameter is missing -- it's only a problem if both are missing, which isn't a state `RPCTypeCheckObj()` tests for. This results in the regression described in bitcoin#16249. This patch adds some code to test for this case and give a similar error, namely:

      error code: -8
      error message:
      Missing redeemScript/witnessScript

  Fixes: bitcoin#16249

ACKs for top commit:
  meshcollider:
    utACK bitcoin@0117459
  promag:
    ACK 0117459. Could also write test without `dict`/`del`:

Tree-SHA512: cf51346b7dea551b7f18f2a93c2a336a293b2535c62c03a5263cd2be8c58cf0cc302891da659c167e88ad1a68a756472c3c07e99f71627c61d32886fc5a3a353
knst pushed a commit to knst/dash that referenced this issue Mar 24, 2023
…sing redeemScript/witnessScript

0117459 signrawtransactionwithkey: report error when missing redeemScript/witnessScript param (Anthony Towns)

Pull request description:

  Adding support for "witnessScript" as an alternative to "redeemScript" when using "signrawtransactionwithkey" meant that the `RPCTypeCheckObj()` call in `SignTransaction` can't error out just because either parameter is missing -- it's only a problem if both are missing, which isn't a state `RPCTypeCheckObj()` tests for. This results in the regression described in bitcoin#16249. This patch adds some code to test for this case and give a similar error, namely:

      error code: -8
      error message:
      Missing redeemScript/witnessScript

  Fixes: bitcoin#16249

ACKs for top commit:
  meshcollider:
    utACK bitcoin@0117459
  promag:
    ACK 0117459. Could also write test without `dict`/`del`:

Tree-SHA512: cf51346b7dea551b7f18f2a93c2a336a293b2535c62c03a5263cd2be8c58cf0cc302891da659c167e88ad1a68a756472c3c07e99f71627c61d32886fc5a3a353
knst pushed a commit to knst/dash that referenced this issue Mar 29, 2023
…sing redeemScript/witnessScript

0117459 signrawtransactionwithkey: report error when missing redeemScript/witnessScript param (Anthony Towns)

Pull request description:

  Adding support for "witnessScript" as an alternative to "redeemScript" when using "signrawtransactionwithkey" meant that the `RPCTypeCheckObj()` call in `SignTransaction` can't error out just because either parameter is missing -- it's only a problem if both are missing, which isn't a state `RPCTypeCheckObj()` tests for. This results in the regression described in bitcoin#16249. This patch adds some code to test for this case and give a similar error, namely:

      error code: -8
      error message:
      Missing redeemScript/witnessScript

  Fixes: bitcoin#16249

ACKs for top commit:
  meshcollider:
    utACK bitcoin@0117459
  promag:
    ACK 0117459. Could also write test without `dict`/`del`:

Tree-SHA512: cf51346b7dea551b7f18f2a93c2a336a293b2535c62c03a5263cd2be8c58cf0cc302891da659c167e88ad1a68a756472c3c07e99f71627c61d32886fc5a3a353
UdjinM6 pushed a commit to knst/dash that referenced this issue Mar 29, 2023
…sing redeemScript/witnessScript

0117459 signrawtransactionwithkey: report error when missing redeemScript/witnessScript param (Anthony Towns)

Pull request description:

  Adding support for "witnessScript" as an alternative to "redeemScript" when using "signrawtransactionwithkey" meant that the `RPCTypeCheckObj()` call in `SignTransaction` can't error out just because either parameter is missing -- it's only a problem if both are missing, which isn't a state `RPCTypeCheckObj()` tests for. This results in the regression described in bitcoin#16249. This patch adds some code to test for this case and give a similar error, namely:

      error code: -8
      error message:
      Missing redeemScript/witnessScript

  Fixes: bitcoin#16249

ACKs for top commit:
  meshcollider:
    utACK bitcoin@0117459
  promag:
    ACK 0117459. Could also write test without `dict`/`del`:

Tree-SHA512: cf51346b7dea551b7f18f2a93c2a336a293b2535c62c03a5263cd2be8c58cf0cc302891da659c167e88ad1a68a756472c3c07e99f71627c61d32886fc5a3a353
UdjinM6 pushed a commit to knst/dash that referenced this issue Apr 6, 2023
…sing redeemScript/witnessScript

0117459 signrawtransactionwithkey: report error when missing redeemScript/witnessScript param (Anthony Towns)

Pull request description:

  Adding support for "witnessScript" as an alternative to "redeemScript" when using "signrawtransactionwithkey" meant that the `RPCTypeCheckObj()` call in `SignTransaction` can't error out just because either parameter is missing -- it's only a problem if both are missing, which isn't a state `RPCTypeCheckObj()` tests for. This results in the regression described in bitcoin#16249. This patch adds some code to test for this case and give a similar error, namely:

      error code: -8
      error message:
      Missing redeemScript/witnessScript

  Fixes: bitcoin#16249

ACKs for top commit:
  meshcollider:
    utACK bitcoin@0117459
  promag:
    ACK 0117459. Could also write test without `dict`/`del`:

Tree-SHA512: cf51346b7dea551b7f18f2a93c2a336a293b2535c62c03a5263cd2be8c58cf0cc302891da659c167e88ad1a68a756472c3c07e99f71627c61d32886fc5a3a353
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@ajtowns @fanquake and others