add network derivation from redeem.network

This commit is contained in:
Daniel Cousens 2018-09-26 16:02:52 +10:00
parent 1b4dc48d75
commit a976fba27b
2 changed files with 10 additions and 2 deletions

View file

@ -45,7 +45,11 @@ function p2sh (a, opts) {
witness: typef.maybe(typef.arrayOf(typef.Buffer))
}, a)
const network = a.network || BITCOIN_NETWORK
let network = a.network
if (!network) {
network = (a.redeem && a.redeem.network) || BITCOIN_NETWORK
}
const o = { network }
const _address = lazy.value(function () {

View file

@ -59,7 +59,11 @@ function p2wsh (a, opts) {
})
const _rchunks = lazy.value(function () { return bscript.decompile(a.redeem.input) })
const network = a.network || BITCOIN_NETWORK
let network = a.network
if (!network) {
network = (a.redeem && a.redeem.network) || BITCOIN_NETWORK
}
const o = { network }
lazy.prop(o, 'address', function () {