s/scriptPubKey/outputScript

This commit is contained in:
Daniel Cousens 2016-12-23 08:08:44 +11:00
parent 14f9218389
commit 3635a9f078

View file

@ -25,13 +25,13 @@ function toBase58Check (hash, version) {
return bs58check.encode(payload)
}
function fromOutputScript (scriptPubKey, network) {
function fromOutputScript (outputScript, network) {
network = network || networks.bitcoin
if (bscript.pubKeyHash.output.check(scriptPubKey)) return toBase58Check(bscript.compile(scriptPubKey).slice(3, 23), network.pubKeyHash)
if (bscript.scriptHash.output.check(scriptPubKey)) return toBase58Check(bscript.compile(scriptPubKey).slice(2, 22), network.scriptHash)
if (bscript.pubKeyHash.output.check(outputScript)) return toBase58Check(bscript.compile(outputScript).slice(3, 23), network.pubKeyHash)
if (bscript.scriptHash.output.check(outputScript)) return toBase58Check(bscript.compile(outputScript).slice(2, 22), network.scriptHash)
throw new Error(bscript.toASM(scriptPubKey) + ' has no matching Address')
throw new Error(bscript.toASM(outputScript) + ' has no matching Address')
}
function toOutputScript (address, network) {