Skip to content

Commit

Permalink
problem: broken head subsription for bitcoin
Browse files Browse the repository at this point in the history
  • Loading branch information
splix committed Sep 1, 2020
1 parent c346c27 commit 06930b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions src/main/kotlin/io/emeraldpay/dshackle/rpc/StreamHead.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 06930b6

Please sign in to comment.