Enable P2SH addresses to be used with the ElectrumX endpoints

This commit is contained in:
Rosco Kalis
2020-08-14 12:15:26 +02:00
parent 553d6fd4b0
commit 1e5dae56af
2 changed files with 15 additions and 2 deletions
+12 -1
View File
@@ -94,7 +94,7 @@ describe('#ElectrumX Router', () => {
})
describe('#addressToScripthash', () => {
it('should accurately return a scripthash', () => {
it('should accurately return a scripthash for a P2PKH address', () => {
const addr = 'bitcoincash:qpr270a5sxphltdmggtj07v4nskn9gmg9yx4m5h7s4'
const scripthash = electrumxRoute.addressToScripthash(addr)
@@ -104,6 +104,17 @@ describe('#ElectrumX Router', () => {
assert.equal(scripthash, expectedOutput)
})
it('should accurately return a scripthash for a P2SH address', () => {
const addr = 'bitcoincash:pz0z7u9p96h2p6hfychxdrmwgdlzpk5luc5yks2wxq'
const scripthash = electrumxRoute.addressToScripthash(addr)
const expectedOutput =
'8bc2235c8e7d5634d9ec429fc0171f2c58e728d4f1e2fb7e440e313133cfa4f0'
assert.equal(scripthash, expectedOutput)
})
})
describe('#_utxosFromElectrumx', () => {