Skip to content

Conversation

@gavinandresen
Copy link
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).

@BitcoinPullTester
Copy link

@sipa
Copy link
Member

sipa commented Oct 29, 2012

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

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.
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.
@gavinandresen
Copy link
Contributor Author

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.

@kjj2
Copy link

kjj2 commented Oct 29, 2012

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.

@gavinandresen
Copy link
Contributor Author

Testing successful, I'm going to pull.

@gavinandresen gavinandresen merged commit 34226be into bitcoin:master Oct 29, 2012
KolbyML pushed a commit to KolbyML/bitcoin that referenced this pull request Dec 5, 2020
…y once.

261bd22 Staking process: calculate the stakeable utxo only once. (furszy)

Pull request description:

  Work on top of bitcoin#1816 and part of bitcoin#1817 coinstake transaction creation speedup goal. Starting on 01814d5

  Improving the following situation: we are calculating the stakeable utxo twice for the same PoS block creation process (looping over the entire wallet's transactions map twice), one before calling `CreateNewBlock` in `CheckForCoins` and the second one inside the `CreateNewBlock` method when we call `CWallet::CreateCoinStake`.
  This PR fixes it adding an unique available coins vector calculated before the block creation, only once per try, in the `CheckForCoins` function and feeding `CreateNewBlock` with it.

ACKs for top commit:
  random-zebra:
    utACK 261bd22

Tree-SHA512: f553667fd48d0d7eb78e2ce87b438c915dc216b32e0426e0214caa52f16a2627143319233c6dd93e4b5d45dcfbb825787c1b39cd209c8e6516bf2391f0516e00
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants