Merge pull request #26 from p2p-org/fix_grpc_head_subscription_recovery
fixed head subscription recovery
This commit is contained in:
@@ -67,4 +67,14 @@ class EthereumHeadMock implements Head {
|
||||
Long getCurrentHeight() {
|
||||
return latest?.height
|
||||
}
|
||||
|
||||
@Override
|
||||
void start() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
void stop() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ class AbstractHeadSpec extends Specification {
|
||||
.expectNext(blocks[1])
|
||||
.then {
|
||||
assert called
|
||||
head.stop()
|
||||
source.tryEmitComplete()
|
||||
}
|
||||
.expectComplete()
|
||||
@@ -83,7 +84,10 @@ class AbstractHeadSpec extends Specification {
|
||||
.expectNext(blocks[2])
|
||||
.then { source.tryEmitNext(blocks[3]) }
|
||||
.expectNext(blocks[3])
|
||||
.then { source.tryEmitComplete() }
|
||||
.then {
|
||||
head.stop()
|
||||
source.tryEmitComplete()
|
||||
}
|
||||
.expectComplete()
|
||||
.verify(Duration.ofSeconds(1))
|
||||
}
|
||||
@@ -110,7 +114,10 @@ class AbstractHeadSpec extends Specification {
|
||||
.then { source.tryEmitNext(wrongblock) }
|
||||
.then { source.tryEmitNext(blocks[3]) }
|
||||
.expectNext(blocks[3])
|
||||
.then { source.tryEmitComplete() }
|
||||
.then {
|
||||
head.stop()
|
||||
source.tryEmitComplete()
|
||||
}
|
||||
.expectComplete()
|
||||
.verify(Duration.ofSeconds(1))
|
||||
}
|
||||
@@ -132,7 +139,7 @@ class AbstractHeadSpec extends Specification {
|
||||
BlockContainer getHead() {
|
||||
return null
|
||||
}
|
||||
}, new BlockValidator.AlwaysValid())
|
||||
}, new BlockValidator.AlwaysValid(), 100_000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,14 +46,14 @@ class MergedHeadSpec extends Specification {
|
||||
|
||||
class TestHead1 extends AbstractHead {
|
||||
TestHead1() {
|
||||
super(new MostWorkForkChoice())
|
||||
super(new MostWorkForkChoice(), new BlockValidator.AlwaysValid(), 100_000)
|
||||
}
|
||||
}
|
||||
|
||||
class TestHead2 extends AbstractHead implements Lifecycle {
|
||||
|
||||
TestHead2() {
|
||||
super(new MostWorkForkChoice())
|
||||
super(new MostWorkForkChoice(), new BlockValidator.AlwaysValid(), 100_000)
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user