File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -2254,11 +2254,18 @@ impl ChainStoreTrait for ChainStore {
22542254 } ;
22552255 let lookup_herd = self . lookup_herd . cheap_clone ( ) ;
22562256 let logger = self . logger . cheap_clone ( ) ;
2257- //TODO(krishna): Add comments explaining the return value of cached_query
2257+ // This match can only return ByHash because lookup_fut explicitly constructs
2258+ // BlocksLookupResult::ByHash. The cache preserves the exact future result,
2259+ // so ByNumber variant is structurally impossible here.
22582260 let res = match lookup_herd. cached_query ( hash, lookup_fut, & logger) . await {
22592261 ( BlocksLookupResult :: ByHash ( res) , _) => res,
2260- _ => unreachable ! ( ) ,
2262+ ( BlocksLookupResult :: ByNumber ( _) , _) => {
2263+ Arc :: new ( Err ( StoreError :: Unknown ( anyhow:: anyhow!(
2264+ "Unexpected BlocksLookupResult::ByNumber returned from cached block lookup by hash"
2265+ ) ) ) )
2266+ }
22612267 } ;
2268+
22622269 // Try to avoid cloning a non-concurrent lookup; it's not
22632270 // entirely clear whether that will actually avoid a clone
22642271 // since it depends on a lot of the details of how the
You can’t perform that action at this time.
0 commit comments