Skip to content

Conversation

@dcousens
Copy link
Contributor

All of the script.* functions allow you to provide a compiled or uncompiled script, and it will decide based on the input type whether to compile/decompile it.

This is actually a major optimization in many cases since you may be doing this many times over and the functions vary as to what state of script they prefer.

fromOutputScript actually already supports this, but if a valid script is found, then it fails with toBase58Check complaining about a non-buffer being given (confusing!).

@dcousens dcousens added the bug label Jan 28, 2016
@dcousens dcousens added this to the 2.2.0 milestone Jan 28, 2016
jprichardson added a commit that referenced this pull request Jan 28, 2016
address: fix compiled assumption for fromOutputScript
@jprichardson jprichardson merged commit 682ba7e into master Jan 28, 2016
@jprichardson
Copy link
Member

As an aside... asking out curiosity...

why:

var bscript = require('./script')

Is it named bscript and not script? Not suggesting it needs to be changed at all, just curious.

@dcousens dcousens deleted the lesscomp branch January 28, 2016 05:05
@dcousens
Copy link
Contributor Author

@jprichardson I prefixed a few modules with b internally because we already had equivalent local variables (aka, a variable named script), and typical behaviour in production environments is to use it with the namespace bitcoin anyway.

@dcousens
Copy link
Contributor Author

Internally:

var bscript = require('./script')

bscript.compile(...)

Externally:

var bitcoin = require('bitcoinjs-lib')

bitcoin.script.compile(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants