Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for scripts.witness*.input and fixes #911

Merged
merged 2 commits into from
Sep 27, 2017
Merged

Conversation

dcousens
Copy link
Contributor

@dcousens dcousens commented Sep 26, 2017

Resolves #862

witnessScriptHash was a bit of a cluster... returned redeemScriptSig, a script, not witness data.
Could be a breaking change, but I'd consider it a bug tbh.

@dcousens
Copy link
Contributor Author

dcousens commented Sep 26, 2017

We don't even use witnessScriptHash.input in TransactionBuilder...
We build it manually:

        witness = buildStack(input.witnessScriptType, input.signatures, input.pubKeys, allowIncomplete)
        witness.push(input.witnessScript)

We do the same for scriptHash.input...

  // append redeemScript if necessary
  if (p2sh) {
    sig.push(input.redeemScript)
  }

  ...

  script: bscript.compile(sig),

if (f.type !== 'pubkeyhash' && f.type !== 'witnesspubkeyhash') return
if (!f.inputStack) return

var pubKey = Buffer.from(f.pubKey, 'hex')
Copy link
Member

Choose a reason for hiding this comment

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

use fromHex here?

Copy link
Contributor Author

@dcousens dcousens Sep 27, 2017

Choose a reason for hiding this comment

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

@junderw I was only using fromHex in the .map(function (x) { return Buffer.from(x, 'hex') }) case, if we had ES6 lambdas, I wouldn't have bothered.

Copy link
Contributor

@afk11 afk11 left a comment

Choose a reason for hiding this comment

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

utACK

@dcousens dcousens merged commit 1157856 into master Sep 27, 2017
@dcousens dcousens deleted the segwittests branch September 27, 2017 14:03
@dcousens
Copy link
Contributor Author

Published v3.2.1

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.

3 participants