Skip to content

Conversation

@dcousens
Copy link
Contributor

Depends on #140.
Resolves #137.
Related to #90.

The following pull request adds the following script templates to Script:

  • Script.createP2SHMultisigScriptSig,
  • Script.createP2SHScriptSig, and
  • Script.createMultisigScriptSig

It only adds a single test for Script.createP2SHMultisigScriptSig, which is woeful, however it is none the less an improvement over the previous situation which had a broken implementation with no tests.

I plan on adding more tests for each of these functions as soon as possible, but this is the intermediate fix that allows for pay-to-scriptHash scriptSigs to be generated correctly.

The function Script.createMultiSigInputScript was renamed to Script.createP2SHMultisigScriptSig.

The test should create valid multi-sig address was removed because it was identical in coverage to the next test should create valid redeemScript. This is because the redeemScript is confirmed as valid if it matches the expected crypto.hash160(redeemScript).

I'd be curious to hear opinions on whether the naming convention of*ScriptSig and *ScriptPubKey is more idiomatic than the current: *InputScript and *OutputScript.
I personally find the latter misleading, but that could just be my opinion.

@dcousens dcousens changed the title Fixes Multi-sig ScriptSig Support Apr 17, 2014
@caedesvvv
Copy link
Contributor

An intermediate fix could be just: caedesvvv@9a3f52c

Will test this changes and report back to see if it actually works, also will provide more data for test cases.

@caedesvvv
Copy link
Contributor

About the notation, *InputScript and *OutputScript give you a pretty good idea of what's going on, with the new notation I would have to think a bit to know which is which.. but maybe it's because i'm used, now there are more cases and also looks all right still not very idiomatic.

Anyways for normal applications one is using the api in Transaction.

@weilu
Copy link
Contributor

weilu commented Apr 19, 2014

I guess InputScript and OutputScript might be from blockchain.info. bitcoin/bitcoin uses scriptSig and scriptPubKey. #125 moves us one step closer to bitcoin/bitcoin's naming. bitcoin/bitcoin is as standard as it gets. Aligning with bitcoin/bitcoin as much as possible means any dev familiar with bitcoind will have an easier time to get started with bitcoinjs-lib. It seems like a good idea to me.

@dcousens
Copy link
Contributor Author

Rebased.

@kyledrake
Copy link
Contributor

+1

kyledrake added a commit that referenced this pull request Apr 21, 2014
@kyledrake kyledrake merged commit 21aa517 into bitcoinjs:master Apr 21, 2014
@dcousens dcousens deleted the multisigfix branch April 21, 2014 16:39
@dcousens dcousens mentioned this pull request Jun 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants