mirror of
https://github.com/logos-storage/nim-mysticeti.git
synced 2026-01-02 13:43:09 +00:00
refuse a proposal that was already received
This commit is contained in:
parent
09f7257bd3
commit
2a13ddffd4
@ -114,6 +114,8 @@ func check*(validator: Validator, signed: SignedBlock): auto =
|
||||
missing.add(parent)
|
||||
if missing.len > 0:
|
||||
return BlockCheck.incomplete(missing)
|
||||
if validator.rounds.latest.find(signed.blck.id).isSome:
|
||||
return BlockCheck.invalid("block already received")
|
||||
BlockCheck.correct(signed)
|
||||
|
||||
func receive*(validator: Validator, correct: CorrectBlock) =
|
||||
|
||||
@ -176,6 +176,12 @@ suite "Multiple Validators":
|
||||
check checked.verdict == BlockVerdict.invalid
|
||||
check checked.reason == "block has a round number that is too high"
|
||||
|
||||
test "refuses a proposal that was already received":
|
||||
let proposals = exchangeProposals()
|
||||
let checked = validators[1].check(proposals[0])
|
||||
check checked.verdict == BlockVerdict.invalid
|
||||
check checked.reason == "block already received"
|
||||
|
||||
test "skips blocks that are ignored by >2f validators":
|
||||
# first round: other validators do not receive proposal from first validator
|
||||
let proposals = exchangeProposals {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user