problem: broken head subsription for bitcoin
This commit is contained in:
@@ -46,19 +46,12 @@ class StreamHead(
|
||||
.getFlux()
|
||||
.map { asProto(chain, it!!) }
|
||||
.onErrorContinue { t, _ ->
|
||||
log.warn("Head error: ${t.message}")
|
||||
log.warn("Head subscription error: ${t.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun asProto(chain: Chain, block: BlockContainer): BlockchainOuterClass.ChainHead {
|
||||
if (BlockchainType.fromBlockchain(chain) == BlockchainType.ETHEREUM) {
|
||||
return asEthereumProto(chain, block)
|
||||
}
|
||||
throw IllegalArgumentException("Unsupported blockchain ${chain}")
|
||||
}
|
||||
|
||||
fun asEthereumProto(chain: Chain, block: BlockContainer): BlockchainOuterClass.ChainHead {
|
||||
return BlockchainOuterClass.ChainHead.newBuilder()
|
||||
.setChainValue(chain.id)
|
||||
.setHeight(block.height)
|
||||
|
||||
@@ -78,7 +78,7 @@ abstract class AbstractHead : Head {
|
||||
}
|
||||
|
||||
override fun getFlux(): Flux<BlockContainer> {
|
||||
return Flux.merge(
|
||||
return Flux.concat(
|
||||
Mono.justOrEmpty(head.get()),
|
||||
Flux.from(stream)
|
||||
).onBackpressureLatest()
|
||||
|
||||
Reference in New Issue
Block a user