File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,10 @@ function fromBase58Check (address) {
1818function fromOutputScript ( scriptPubKey , network ) {
1919 network = network || networks . bitcoin
2020
21- var chunks = bscript . decompile ( scriptPubKey )
22- if ( bscript . isPubKeyHashOutput ( chunks ) ) return toBase58Check ( chunks [ 2 ] , network . pubKeyHash )
23- if ( bscript . isScriptHashOutput ( chunks ) ) return toBase58Check ( chunks [ 1 ] , network . scriptHash )
21+ if ( bscript . isPubKeyHashOutput ( scriptPubKey ) ) return toBase58Check ( scriptPubKey . slice ( 3 , 23 ) , network . pubKeyHash )
22+ if ( bscript . isScriptHashOutput ( scriptPubKey ) ) return toBase58Check ( scriptPubKey . slice ( 2 , 22 ) , network . scriptHash )
2423
25- throw new Error ( bscript . toASM ( chunks ) + ' has no matching Address' )
24+ throw new Error ( bscript . toASM ( scriptPubKey ) + ' has no matching Address' )
2625}
2726
2827function toBase58Check ( hash , version ) {
You can’t perform that action at this time.
0 commit comments