-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: block_filter: refresh_snapshot() in build_filter_data may race with ChainService #3759
Fix: block_filter: refresh_snapshot() in build_filter_data may race with ChainService #3759
Conversation
The CI job was failed after I removed When a new tip block comes, In ckb/block-filter/src/filter.rs Lines 144 to 149 in 2ad82e6
but in Lines 1646 to 1653 in cd1e2f8
|
dda31c7
to
521c80e
Compare
1. `refresh_snapshot` in block_filter may cause race with `ChainService` 2. get block filter data from ChainDB instead of Snapshot Signed-off-by: Eval EXEC <execvy@gmail.com> Signed-off-by: Eval EXEC <execvy@gmail.com>
521c80e
to
946b470
Compare
bors r=quake,driftluo |
Build succeeded: |
What problem does this PR solve?
Problem Summary:
block-filter::build_filter_data
callrefresh_snapshot
on everynew_block_watcher.changed()
here:ckb/block-filter/src/filter.rs
Line 94 in d3fc58f
and
ChainService
may updatesnapshot
simultaneously in here:ckb/chain/src/chain.rs
Lines 480 to 486 in d3fc58f
For example:
fn build_filter_data
,refresh_snapshot
load aSnapshot
with tip_header(100)ChainService
received a new_tip_header(101), and store it into snapshotfn build_filter_data
,refresh_snapshot
store theSnapshot
with tip_header(100), this causetip_header
goes backwards.What's Changed:
remove
refresh_snapshot()
inblock-filter::build_filter_data
Check List
Tests
Release note