solution: esplora upstream connection for bitcoin
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package io.emeraldpay.dshackle.upstream.bitcoin
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper
|
||||
import io.emeraldpay.dshackle.cache.Caches
|
||||
import io.emeraldpay.dshackle.config.UpstreamsConfig
|
||||
import io.emeraldpay.dshackle.reader.EmptyReader
|
||||
@@ -38,8 +37,9 @@ open class BitcoinMultistream(
|
||||
private val log = LoggerFactory.getLogger(BitcoinMultistream::class.java)
|
||||
}
|
||||
|
||||
private var head: Head? = null
|
||||
private var reader = BitcoinReader(this, EmptyHead())
|
||||
private var head: Head = EmptyHead()
|
||||
private var esplora = upstreams.find { it.esploraClient != null }?.esploraClient
|
||||
private var reader = BitcoinReader(this, head, esplora)
|
||||
|
||||
override fun init() {
|
||||
if (upstreams.size > 0) {
|
||||
@@ -49,7 +49,7 @@ open class BitcoinMultistream(
|
||||
}
|
||||
|
||||
override fun updateHead(): Head {
|
||||
head?.let {
|
||||
head.let {
|
||||
if (it is Lifecycle) {
|
||||
it.stop()
|
||||
}
|
||||
@@ -81,13 +81,19 @@ open class BitcoinMultistream(
|
||||
return reader
|
||||
}
|
||||
|
||||
override fun onUpstreamsUpdated() {
|
||||
super.onUpstreamsUpdated()
|
||||
esplora = upstreams.find { it.esploraClient != null }?.esploraClient
|
||||
reader = BitcoinReader(this, this.head, esplora)
|
||||
}
|
||||
|
||||
override fun setHead(head: Head) {
|
||||
this.head = head
|
||||
reader = BitcoinReader(this, head)
|
||||
reader = BitcoinReader(this, head, esplora)
|
||||
}
|
||||
|
||||
override fun getHead(): Head {
|
||||
return head!!
|
||||
return head
|
||||
}
|
||||
|
||||
override fun getLabels(): Collection<UpstreamsConfig.Labels> {
|
||||
|
||||
Reference in New Issue
Block a user