Skip to content

Commit 35a3f6f

Browse files
committed
fix sync edgecase
1 parent e8a65f1 commit 35a3f6f

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

ex/lib/consensus/fabric_sync_gen.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ defmodule FabricSyncGen do
6161

6262
cond do
6363
behind_bft > 0 ->
64-
entries = Enum.to_list((temporal_height+1)..height_network_bft)
64+
entries = (try do Enum.to_list((temporal_height+1)..height_network_bft) catch _,_ -> [height_network_bft] end)
6565
IO.puts "Behind BFT: Syncing #{length(entries)} entries"
6666
next_heights = Enum.to_list(entries)
6767
|> Enum.take(1000)
@@ -73,7 +73,7 @@ defmodule FabricSyncGen do
7373
|> fetch_chunks(temporal_peers)
7474

7575
behind_root > 0 ->
76-
next_heights = Enum.to_list((rooted_height+1)..height_network_root)
76+
next_heights = (try do Enum.to_list((rooted_height+1)..height_network_root) catch _,_ -> [height_network_root] end)
7777
|> Enum.take(1000)
7878
|> Enum.uniq()
7979
{rooted_peers, temporal_peers} = NodeANR.peers_w_min_height(List.last(next_heights), :any)
@@ -84,7 +84,7 @@ defmodule FabricSyncGen do
8484

8585
#TODO: only fetch missing attestations
8686
behind_temp > 0 ->
87-
next_heights = Enum.to_list(temporal_height..height_network_temp)
87+
next_heights = (try do Enum.to_list(temporal_height..height_network_temp) catch _,_-> [height_network_temp] end)
8888
|> Enum.take(1000)
8989
|> Enum.uniq()
9090
{rooted_peers, temporal_peers} = NodeANR.peers_w_min_height(List.last(next_heights), :validators)

ex/lib/node/node_gen_netguard.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ defmodule NodeGenNetguard do
77
get_peer_anrs_reply: 10,
88
ping: 30,
99
ping_reply: 30,
10-
special_business: 100,
11-
special_business_reply: 100,
10+
special_business: 200,
11+
special_business_reply: 200,
1212
catchup: 20,
1313
catchup_reply: 20,
1414
event_tip: 30,

0 commit comments

Comments
 (0)