Skip to content

Commit

Permalink
Fix postponed transaction attesation which
Browse files Browse the repository at this point in the history
produce a slot with multiple attestation for the same transaction
  • Loading branch information
Neylix committed Feb 28, 2023
1 parent 453bc18 commit d9cb14e
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions lib/archethic/beacon_chain/subset.ex
Original file line number Diff line number Diff line change
Expand Up @@ -316,16 +316,24 @@ defmodule Archethic.BeaconChain.Subset do
) do
next_time = SlotTimer.next_slot(time)

# Reduce transaction attestations to have one entry for a tx summary
new_slot =
Enum.reduce(
transaction_attestations,
%Slot{
subset: subset,
slot_time: next_time,
transaction_attestations: [],
end_of_node_synchronizations: end_of_sync
},
fn attestation, slot ->
{_, slot} = Slot.add_transaction_attestation(slot, attestation)
slot
end
)

state
|> Map.put(
:current_slot,
%Slot{
subset: subset,
slot_time: next_time,
transaction_attestations: transaction_attestations,
end_of_node_synchronizations: end_of_sync
}
)
|> Map.put(:current_slot, new_slot)
|> Map.put(:postponed, %{transaction_attestations: [], end_of_sync: []})
|> Map.put(
:subscribed_nodes,
Expand Down

0 comments on commit d9cb14e

Please sign in to comment.