@@ -222,46 +222,6 @@ func TestP2PHandler_ProposerMismatch_Rejected(t *testing.T) {
222222 require .Len (t , events , 0 )
223223}
224224
225- func TestP2PHandler_CreateEmptyDataForHeader_UsesPreviousDataHash (t * testing.T ) {
226- p2pData := setupP2P (t )
227- ctx := context .Background ()
228-
229- // Prepare a header at height 10
230- signedHeader := p2pMakeSignedHeader (t , p2pData .Genesis .ChainID , 10 , p2pData .ProposerAddr , p2pData .ProposerPub , p2pData .Signer )
231- signedHeader .DataHash = common .DataHashForEmptyTxs
232-
233- // Mock previous data at height 9 so handler can propagate its hash
234- previousData := makeData (p2pData .Genesis .ChainID , 9 , 1 )
235- p2pData .DataStore .EXPECT ().GetByHeight (mock .Anything , uint64 (9 )).Return (previousData , nil ).Once ()
236-
237- emptyData := p2pData .Handler .createEmptyDataForHeader (ctx , signedHeader )
238- require .NotNil (t , emptyData , "handler should synthesize empty data when header declares empty data hash" )
239- require .Equal (t , p2pData .Genesis .ChainID , emptyData .ChainID (), "synthesized data should carry header chain ID" )
240- require .Equal (t , uint64 (10 ), emptyData .Height (), "synthesized data should carry header height" )
241- require .Equal (t , signedHeader .BaseHeader .Time , emptyData .Metadata .Time , "synthesized data should carry header time" )
242- require .Equal (t , previousData .Hash (), emptyData .LastDataHash , "synthesized data should propagate previous data hash" )
243- }
244-
245- func TestP2PHandler_CreateEmptyDataForHeader_NoPreviousData (t * testing.T ) {
246- p2pData := setupP2P (t )
247- ctx := context .Background ()
248-
249- // Prepare a header at height 2 (previous height exists but will return error)
250- signedHeader := p2pMakeSignedHeader (t , p2pData .Genesis .ChainID , 2 , p2pData .ProposerAddr , p2pData .ProposerPub , p2pData .Signer )
251- signedHeader .DataHash = common .DataHashForEmptyTxs
252-
253- // Mock previous data fetch failure
254- p2pData .DataStore .EXPECT ().GetByHeight (mock .Anything , uint64 (1 )).Return (nil , errors .New ("not available" )).Once ()
255-
256- emptyData := p2pData .Handler .createEmptyDataForHeader (ctx , signedHeader )
257- require .NotNil (t , emptyData , "handler should synthesize empty data even when previous data is unavailable" )
258- require .Equal (t , p2pData .Genesis .ChainID , emptyData .ChainID (), "synthesized data should carry header chain ID" )
259- require .Equal (t , uint64 (2 ), emptyData .Height (), "synthesized data should carry header height" )
260- require .Equal (t , signedHeader .BaseHeader .Time , emptyData .Metadata .Time , "synthesized data should carry header time" )
261- // When no previous data is available, LastDataHash should be zero value
262- require .Equal (t , (types .Hash )(nil ), emptyData .LastDataHash , "last data hash should be empty when previous data is not available" )
263- }
264-
265225func TestP2PHandler_ProcessHeaderRange_MultipleHeightsHappyPath (t * testing.T ) {
266226 p2pData := setupP2P (t )
267227 ctx := context .Background ()
0 commit comments