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