@@ -56,12 +56,8 @@ public Task Export(string destinationPath, long from, long to, CancellationToken
5656 if ( from > to )
5757 throw new ArgumentException ( $ "Start block ({ from } ) must not be after end block ({ to } ).") ;
5858
59- Block ? lastBlock = blockTree . FindBlock ( to , BlockTreeLookupOptions . DoNotCreateLevelIfMissing ) ;
60- if ( lastBlock is null )
61- throw new InvalidOperationException (
62- $ "Block { to } is not available. " +
63- "EraE export requires all block bodies to be present. " +
64- "Ensure the node is fully synced before exporting." ) ;
59+ _ = blockTree . FindBlock ( to , BlockTreeLookupOptions . DoNotCreateLevelIfMissing )
60+ ?? throw new InvalidOperationException ( $ "Block { to } is not available. EraE export requires all block bodies to be present. Ensure the node is fully synced before exporting.") ;
6561
6662 return DoExport ( destinationPath , from , to , cancellation ) ;
6763 }
@@ -139,9 +135,8 @@ async Task WriteEpoch(long epochIdx, CancellationToken cancel)
139135 {
140136 for ( long blockNumber = writeFrom ; blockNumber <= writeTo ; blockNumber ++ )
141137 {
142- Block ? block = blockTree . FindBlock ( blockNumber , BlockTreeLookupOptions . DoNotCreateLevelIfMissing ) ;
143- if ( block is null )
144- throw new EraException ( $ "Could not find block { blockNumber } . The node may not have finished syncing block bodies for this range.") ;
138+ Block block = blockTree . FindBlock ( blockNumber , BlockTreeLookupOptions . DoNotCreateLevelIfMissing )
139+ ?? throw new EraException ( $ "Could not find block { blockNumber } . The node may not have finished syncing block bodies for this range.") ;
145140
146141 // IsPostMerge is not part of the RLP encoding and defaults to false when read from
147142 // the block store. Restore it from Difficulty (EIP-3675: post-merge Difficulty == 0).
0 commit comments