Skip to content

Commit f1586d0

Browse files
committed
dont consider orphans
1 parent c95ba63 commit f1586d0

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

ex/lib/consensus/fabric.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,12 @@ defmodule Fabric do
108108
end
109109

110110
def entries_by_height(height) do
111+
softfork_deny_hash = :persistent_term.get(SoftforkDenyHash, [])
112+
111113
%{db: db, cf: cf} = :persistent_term.get({:rocksdb, Fabric})
112114
RocksDB.get_prefix("#{height}:", %{db: db, cf: cf.entry_by_height})
113115
|> Enum.map(& Entry.unpack(entry_by_hash(elem(&1,0))))
116+
|> Enum.reject(& &1.hash in softfork_deny_hash)
114117
end
115118

116119
def entries_last_x(cnt) do
@@ -136,7 +139,10 @@ defmodule Fabric do
136139
end
137140

138141
def consensuses_by_height(height) do
142+
softfork_deny_hash = :persistent_term.get(SoftforkDenyHash, [])
143+
139144
entries = Fabric.entries_by_height(height)
145+
|> Enum.reject(& &1.hash in softfork_deny_hash)
140146
Enum.map(entries, fn(entry)->
141147
map = consensuses_by_entryhash(entry.hash) || %{}
142148
Enum.map(map, fn {mutations_hash, %{mask: mask, aggsig: aggsig}} ->

ex/lib/consensus/fabric_gen.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,11 @@ defmodule FabricGen do
244244

245245
#prevent double-entries due to severe system lag (you shouldnt be validator in the first place)
246246
lastSlot = :persistent_term.get(:last_made_entry_slot, nil)
247-
emptyHeight = Fabric.entries_by_height(next_height) == []
247+
248+
rooted_tip = Fabric.rooted_tip()
249+
emptyHeight = Fabric.entries_by_height(next_height)
250+
|> Enum.filter(& &1.header_unpacked.prev_hash == rooted_tip)
251+
emptyHeight = emptyHeight == []
248252

249253
cond do
250254
!FabricSyncAttestGen.isQuorumSynced() -> nil

0 commit comments

Comments
 (0)