-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
Description
I was trying to get an address from an outputscript using address.fromOutputScript; but when I try it with a pubkey script (OP_DATA() + OP_CHECKSIG), the library fails with the error:
02397df78c9c3fecbcbcee12025230fc4b30e6e617f5fc9c10513eebd0cf4b327d OP_CHECKSIG has no matching Address
Inspecting the library code I found the problem here:
Line 51 in 413495b
function fromOutputScript (outputScript, network) { |
My solution is this, but it seems too tricky:
let s = bitcoinjs.script.pubKey.output.decode(txout.script);
s = bitcoinjs.crypto.sha256(s);
s = bitcoinjs.crypto.ripemd160(s);
spendableby = bitcoinjs.address.toBase58Check(bitcoinjs.script.compile(s), _network.pubKeyHash);