Skip to content

Conversation

rubensayshi
Copy link
Contributor

This is preperation for the segwit support which will have P2SH[ P2WSH[ P2PKH / multsig ] ] scripts.
It's only refactoring code, shouldn't contain any function changes and should make the #520 PR easier to diff once merged.

Considering the following possible scripts we want to support: https://gist.github.com/rubensayshi/fbe39657e90ef416d411


// Ignore empty scripts
if (txIn.script.length === 0) return {}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved this into extractInput so in the future it can first check if it's segwit


// ready to sign?
var signatureScript = input.redeemScript || input.prevOutScript
signatureScript = signatureScript || input.redeemScript || input.prevOutScript
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preperation for segwit, where the signatureScript could be different from the redeemScript

if (allowIncomplete) {
for (var i = 0; i < msSignatures.length; ++i) {
msSignatures[i] = msSignatures[i] || ops.OP_0
var processScript = function (scriptType, parentType, redeemScript) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved into a function so that we can call it again for nested scripts (P2SH[ P2WSH[ P2PKH / multsig ] ])

@rubensayshi rubensayshi mentioned this pull request Feb 8, 2016
20 tasks
@rubensayshi rubensayshi changed the title Refactoring extractInputs and __build to enable nested scripts Refactoring extractInput and __build to enable nested scripts Feb 8, 2016
@dcousens
Copy link
Contributor

dcousens commented Feb 8, 2016

Will hopefully review today

@dcousens
Copy link
Contributor

Needs rebase.

@dcousens dcousens self-assigned this Feb 14, 2016
@dcousens dcousens added this to the 2.3.0 milestone Feb 14, 2016
…2SH[ P2PKH / multsig ]`).

This is preperation for the segwit support which will have `P2SH[ P2WSH[ P2PKH / multsig ] ]` scripts
dcousens added a commit that referenced this pull request Feb 25, 2016
Refactoring `extractInput` and `__build` to enable nested scripts
@dcousens dcousens merged commit 285bbd6 into bitcoinjs:master Feb 25, 2016
@dcousens
Copy link
Contributor

@rubensayshi can you work from within this repository if possible? It makes collaboration easier :)

dcousens added a commit that referenced this pull request Apr 8, 2016
* Txbuilder: early exit as soon as possible

* Txbuilder: prefer function declaration over variable

* TxBuilder: extract extractFromOutputScript

* TxBuilder: extract buildFromInputData
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants