test: cover more errors for signrawtransactionwithkey RPC #30278

pull brunoerg wants to merge 1 commits into bitcoin:master from brunoerg:2024-06-test-signrawtransactionwithkey changing 1 files +10 −0
  1. brunoerg commented at 8:08 pm on June 12, 2024: contributor

    This PR adds test coverage for the following errors for the signrawtransactionwithkey RPC:

    • Invalid private key
    • TX decode failed

    For reference: https://maflcko.github.io/b-c-cov/total.coverage/src/rpc/rawtransaction.cpp.gcov.html

  2. test: cover more errors for `signrawtransactionwithkey` RPC
    * Invalid private key
    * TX decode failed
    e2779ce98b
  3. DrahtBot commented at 8:08 pm on June 12, 2024: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK tdb3, maflcko, BrandonOdiwuor, kevkevinpal

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. DrahtBot added the label Tests on Jun 12, 2024
  5. in test/functional/rpc_signrawtransactionwithkey.py:129 in e2779ce98b
    125@@ -126,10 +126,20 @@ def invalid_sighashtype_test(self):
    126         privkeys = [self.nodes[0].get_deterministic_priv_key().key]
    127         assert_raises_rpc_error(-8, "'all' is not a valid sighash parameter.", self.nodes[0].signrawtransactionwithkey, tx, privkeys, sighashtype="all")
    128 
    129+    def invalid_private_key_and_tx(self):
    


    tdb3 commented at 1:48 am on June 13, 2024:
    nit: An invalid private key and an invalid transaction could be tested separately rather than in the same function. Was there a rationale for combining them?

    brunoerg commented at 9:27 am on June 13, 2024:
    To avoid calling same stuff twice. e.g. createrawtransaction.
  6. tdb3 approved
  7. tdb3 commented at 1:48 am on June 13, 2024: contributor

    ACK e2779ce98b39e14cada08a654928e798436f5a46

    Ran rpc_signrawtransactionwithkey locally (passed). Intentionally caused test failure by 1) using privkey cUeKHd5orzT3mz8P9pxyREHfsWtVfgsfDjiZZBcjUBAaGk1BTj7N and independently by 2) removing the trailing 00 from the tx. Test failed as expected each time.

  8. maflcko commented at 7:05 am on June 13, 2024: member
    ACK e2779ce98b39e14cada08a654928e798436f5a46
  9. BrandonOdiwuor approved
  10. BrandonOdiwuor commented at 3:37 pm on June 13, 2024: contributor
    Code Review ACK e2779ce98b39e14cada08a654928e798436f5a46
  11. kevkevinpal commented at 0:30 am on June 14, 2024: contributor
    ACK e2779ce
  12. fanquake merged this on Jun 14, 2024
  13. fanquake closed this on Jun 14, 2024


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-06-29 07:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me