Add redeemScript to raw transactions API #1818

pull gavinandresen wants to merge 4 commits into bitcoin:master from gavinandresen:rawtx_p2sh changing 5 files +232 −75
  1. gavinandresen commented at 1:54 PM on September 10, 2012: contributor

    If signrawtransaction is signing a P2SH scriptPubKey, it needs to know the Script that hashes to the P2SH address.

    That isn't a problem for transactions that are in the wallet, but if you're giving the private keys to signrawtransaction then it doesn't look in the wallet, and there needed to be some way to provide the redemption Script.

    This pull request makes three functional changes:

    • Adds "redeemScript" to listunspent output, when listing a p2sh/multisig output
    • Adds "redeemScript" to signrawtransaction's second argument (list of previous transaction outputs)
    • Adds a new RPC command, "createmultisig" that is just like "addmultisigaddress" but instead of adding the multisig address/redeemScript to the wallet, returns them in a JSON object.

    It also includes new unit tests for the raw transaction API argument checking code (and refactors some argument checking to remove some code duplication).

  2. BitcoinPullTester commented at 6:34 PM on September 11, 2012: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/b8ae01437d2e40a2851c17566203bf35dda0cd1c for binaries and test log.

  3. sipa commented at 10:32 AM on October 29, 2012: member

    Code changes look good to me, but needs rebasing, and I understand there is some problems still reported in https://bitcointalk.org/index.php?topic=105505.0

  4. No need for test fixture now that multisig is enabled on main network. c4d884e20e
  5. Tests for raw transactions argument checking 2d43f88e1f
  6. Add redeemScript to listunspent output and signrawtransaction input
    signrawtransaction was unable to sign pay-to-script-hash inputs
    when given the list of private keys to use. With this commit
    you can provide the p2sh redemption script in the list of
    inputs.
    03346a61b1
  7. New createmultisig rpc command
    This is to support the signrawtransaction API call; given the public
    keys involved in a multisig transaction, this gives back the redeemScript
    needed to sign it.
    34226be7a8
  8. gavinandresen commented at 5:38 PM on October 29, 2012: contributor

    Rebased, and fixed a crashing bug in signrawtransaction that I think was introduced with ultraprune (assigning coins.vout[nOut].scriptPubKey = scriptPubKey could crash if coins wasnot already in mempool/wallet).

    Testing TODO:

    • Make sure the right thing happens when signing a transaction with two inputs that are both from the same previous transaction which is NOT in the mempool/wallet.
  9. kjj2 commented at 6:06 PM on October 29, 2012: none

    The problem I had reported in that thread was totally on my end, the result of a failed (manual) merge left a line missing in my local repo, and it was the line that adds stuff to the tempkeystore, so it was kinda important.

    I'll pull the rebased version and do more testing, but I won't have time today, and possibly not tomorrow either.

  10. gavinandresen commented at 7:46 PM on October 29, 2012: contributor

    Testing successful, I'm going to pull.

  11. gavinandresen merged this on Oct 29, 2012
  12. gavinandresen closed this on Oct 29, 2012

  13. KolbyML referenced this in commit 242356d012 on Dec 5, 2020
  14. DrahtBot locked this on Sep 8, 2021

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: 2026-05-02 15:16 UTC

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