test_block_sync is flaky
If I run this test multiple times, result may be either pass or fail: https://near.zulipchat.com/#narrow/stream/295558-pagoda.2Fcore/topic/test_block_sync.20flaky.3F/near/292419577
Buildkite example https://buildkite.com/nearprotocol/nearcore/builds/18839#0182832c-ef40-4dca-a31c-040429f68b05
cc @mzhangmzz
I'll look into this
Seems like a legit perf bug in check_known function:
https://github.com/near/nearcore/blob/73fb438331cfcde897e42272d6da3ab22596ee05/chain/chain/src/chain.rs#L389-L410
With async block processing, there's one more place where a known block could be -- in blocks in processing pool.
So, what happens here is that sync can request a block which we are already processing.
Ah that makes a lot of sense!