File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed
packages/taiko-client/driver/preconf_blocks Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -166,11 +166,9 @@ func (s *PreconfBlockAPIServer) BuildPreconfBlock(c echo.Context) error {
166
166
167
167
header := headers [0 ]
168
168
169
- // If the block number is greater than the highest unsafe L2 payload block ID,
170
- // update the highest unsafe L2 payload block ID.
171
- if header .Number .Uint64 () > s .highestUnsafeL2PayloadBlockID {
172
- s .updateHighestUnsafeL2Payload (header .Number .Uint64 ())
173
- }
169
+ // always update the highest unsafe L2 payload block ID.
170
+ // its either higher than the existing one, or we reorged.
171
+ s .updateHighestUnsafeL2Payload (header .Number .Uint64 ())
174
172
175
173
// Propagate the preconfirmation block to the P2P network, if the current server
176
174
// connects to the P2P network.
Original file line number Diff line number Diff line change @@ -942,6 +942,7 @@ func (s *PreconfBlockAPIServer) TryImportingPayload(
942
942
if err != nil && ! errors .Is (err , ethereum .NotFound ) {
943
943
return false , fmt .Errorf ("failed to fetch header by hash: %w" , err )
944
944
}
945
+
945
946
if header != nil {
946
947
if header .Hash () == msg .ExecutionPayload .BlockHash {
947
948
log .Info (
@@ -1004,11 +1005,18 @@ func (s *PreconfBlockAPIServer) TryImportingPayload(
1004
1005
1005
1006
// updateHighestUnsafeL2Payload updates the highest unsafe L2 payload block ID.
1006
1007
func (s * PreconfBlockAPIServer ) updateHighestUnsafeL2Payload (blockID uint64 ) {
1007
- log .Info (
1008
- "Updating highest unsafe L2 payload block ID" ,
1009
- "blockID" , blockID ,
1010
- "currentHighestUnsafeL2PayloadBlockID" , s .highestUnsafeL2PayloadBlockID ,
1011
- )
1008
+ if blockID > s .highestUnsafeL2PayloadBlockID {
1009
+ log .Info (
1010
+ "Updating highest unsafe L2 payload block ID" ,
1011
+ "blockID" , blockID ,
1012
+ "currentHighestUnsafeL2PayloadBlockID" , s .highestUnsafeL2PayloadBlockID ,
1013
+ )
1014
+ } else {
1015
+ log .Info ("Reorging highest unsafe L2 payload blockID" ,
1016
+ "blockID" , blockID ,
1017
+ "currentHighestUnsafeL2PayloadBlockID" , s .highestUnsafeL2PayloadBlockID ,
1018
+ )
1019
+ }
1012
1020
s .highestUnsafeL2PayloadBlockID = blockID
1013
1021
}
1014
1022
You can’t perform that action at this time.
0 commit comments