drpc_pendingTransactions subscribe support (#673)
This commit is contained in:
@@ -56,7 +56,7 @@ open class EthereumEgressSubscription(
|
|||||||
const val METHOD_NEW_HEADS = "newHeads"
|
const val METHOD_NEW_HEADS = "newHeads"
|
||||||
const val METHOD_LOGS = "logs"
|
const val METHOD_LOGS = "logs"
|
||||||
const val METHOD_PENDING_TXES = "newPendingTransactions"
|
const val METHOD_PENDING_TXES = "newPendingTransactions"
|
||||||
const val METHOD_PENDING_TXES_WITH_BODY = "newPendingTransactionsWithBody"
|
const val METHOD_DRPC_PENDING_TXES = "drpc_pendingTransactions"
|
||||||
}
|
}
|
||||||
|
|
||||||
private val newHeads = ConnectNewHeads(upstream, scheduler)
|
private val newHeads = ConnectNewHeads(upstream, scheduler)
|
||||||
@@ -73,7 +73,7 @@ open class EthereumEgressSubscription(
|
|||||||
listOf()
|
listOf()
|
||||||
}
|
}
|
||||||
return if (pendingTxesSource != null) {
|
return if (pendingTxesSource != null) {
|
||||||
subs.plus(listOf(METHOD_PENDING_TXES, METHOD_PENDING_TXES_WITH_BODY))
|
subs.plus(listOf(METHOD_PENDING_TXES, METHOD_DRPC_PENDING_TXES))
|
||||||
} else {
|
} else {
|
||||||
subs
|
subs
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ open class EthereumEgressSubscription(
|
|||||||
}
|
}
|
||||||
if (topic == METHOD_PENDING_TXES) {
|
if (topic == METHOD_PENDING_TXES) {
|
||||||
return pendingTxesSource?.connect(matcher) ?: Flux.empty()
|
return pendingTxesSource?.connect(matcher) ?: Flux.empty()
|
||||||
} else if (topic == METHOD_PENDING_TXES_WITH_BODY) {
|
} else if (topic == METHOD_DRPC_PENDING_TXES) {
|
||||||
return pendingTxesSource?.connect(matcher)?.flatMap { txHash ->
|
return pendingTxesSource?.connect(matcher)?.flatMap { txHash ->
|
||||||
// Create request to get full transaction
|
// Create request to get full transaction
|
||||||
val request = ChainRequest(
|
val request = ChainRequest(
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ class EthereumEgressSubscriptionSpec extends Specification {
|
|||||||
up3.start()
|
up3.start()
|
||||||
def ethereumSubscribe3 = new EthereumEgressSubscription(TestingCommons.multistream(up3) as GenericMultistream, Schedulers.boundedElastic(), Stub(PendingTxesSource))
|
def ethereumSubscribe3 = new EthereumEgressSubscription(TestingCommons.multistream(up3) as GenericMultistream, Schedulers.boundedElastic(), Stub(PendingTxesSource))
|
||||||
then:
|
then:
|
||||||
ethereumSubscribe3.getAvailableTopics().toSet() == [EthereumEgressSubscription.METHOD_LOGS, EthereumEgressSubscription.METHOD_NEW_HEADS, EthereumEgressSubscription.METHOD_PENDING_TXES, EthereumEgressSubscription.METHOD_PENDING_TXES_WITH_BODY].toSet()
|
ethereumSubscribe3.getAvailableTopics().toSet() == [EthereumEgressSubscription.METHOD_LOGS, EthereumEgressSubscription.METHOD_NEW_HEADS, EthereumEgressSubscription.METHOD_PENDING_TXES, EthereumEgressSubscription.METHOD_DRPC_PENDING_TXES].toSet()
|
||||||
when:
|
when:
|
||||||
def up4 = TestingCommons.upstream(TestingCommons.api(), "eth_getBlockByNumber")
|
def up4 = TestingCommons.upstream(TestingCommons.api(), "eth_getBlockByNumber")
|
||||||
up4.getConnectorMock().setLiveness(Flux.just(HeadLivenessState.OK))
|
up4.getConnectorMock().setLiveness(Flux.just(HeadLivenessState.OK))
|
||||||
|
|||||||
Reference in New Issue
Block a user