les, light: improve txstatus retrieval (#22349)
Transaction unindexing will be enabled by default as of 1.10, which causes tx status retrieval will be broken without this PR. This PR introduces a retry mechanism in TxStatus retrieval.
This commit is contained in:
@ -28,19 +28,26 @@ import (
|
||||
)
|
||||
|
||||
func TestLightPruner(t *testing.T) {
|
||||
config := light.TestClientIndexerConfig
|
||||
|
||||
waitIndexers := func(cIndexer, bIndexer, btIndexer *core.ChainIndexer) {
|
||||
for {
|
||||
cs, _, _ := cIndexer.Sections()
|
||||
bts, _, _ := btIndexer.Sections()
|
||||
if cs >= 3 && bts >= 3 {
|
||||
break
|
||||
var (
|
||||
waitIndexers = func(cIndexer, bIndexer, btIndexer *core.ChainIndexer) {
|
||||
for {
|
||||
cs, _, _ := cIndexer.Sections()
|
||||
bts, _, _ := btIndexer.Sections()
|
||||
if cs >= 3 && bts >= 3 {
|
||||
break
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
server, client, tearDown := newClientServerEnv(t, int(3*config.ChtSize+config.ChtConfirms), 2, waitIndexers, nil, 0, false, true, false)
|
||||
config = light.TestClientIndexerConfig
|
||||
netconfig = testnetConfig{
|
||||
blocks: int(3*config.ChtSize + config.ChtConfirms),
|
||||
protocol: 3,
|
||||
indexFn: waitIndexers,
|
||||
connect: true,
|
||||
}
|
||||
)
|
||||
server, client, tearDown := newClientServerEnv(t, netconfig)
|
||||
defer tearDown()
|
||||
|
||||
// checkDB iterates the chain with given prefix, resolves the block number
|
||||
|
Reference in New Issue
Block a user