Address: no need to check other script types
This commit is contained in:
parent
254974d999
commit
4fe0b34f27
2 changed files with 6 additions and 8 deletions
src
|
@ -35,12 +35,10 @@ Address.fromBase58Check = function(string) {
|
|||
Address.fromOutputScript = function(script, network) {
|
||||
network = network || networks.bitcoin
|
||||
|
||||
var type = scripts.classifyOutput(script)
|
||||
if (scripts.isPubKeyHashOutput(script)) return new Address(script.chunks[2], network.pubKeyHash)
|
||||
if (scripts.isScriptHashOutput(script)) return new Address(script.chunks[1], network.scriptHash)
|
||||
|
||||
if (type === 'pubkeyhash') return new Address(script.chunks[2], network.pubKeyHash)
|
||||
if (type === 'scripthash') return new Address(script.chunks[1], network.scriptHash)
|
||||
|
||||
assert(false, type + ' has no matching Address')
|
||||
assert(false, script.toASM() + ' has no matching Address')
|
||||
}
|
||||
|
||||
// Export functions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue