diff --git a/CHANGELOG.md b/CHANGELOG.md index 899faf14..dd6e685a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Behaviour changes: * transactions management refactoring implied library API changes (#164) * add a separate `DBFT` generic parameter for transaction slice type specificatoin (#165) + * transaction duplicates in the proposal are not supported any more (#164, #167) Improvements: * minimum required Go version is 1.26 (#144, #156, #162) diff --git a/config.go b/config.go index 3947786b..545498f4 100644 --- a/config.go +++ b/config.go @@ -52,8 +52,9 @@ type Config[H Hash, Tx Transaction[H]] struct { // StopTxFlow is a callback which is called when the process no longer needs // any transactions. StopTxFlow func() - // GetVerified returns a slice of verified transactions - // to be proposed in a new block. + // GetVerified returns a slice of verified transactions to be proposed in a + // new block. It's a caller's responsibility to check for the duplicates in + // the proposed set of transactions. GetVerified func() []Tx // VerifyPreBlock verifies if preBlock is valid. VerifyPreBlock func(b PreBlock[H, Tx]) bool diff --git a/context.go b/context.go index 56ccdc9f..c1c6e064 100644 --- a/context.go +++ b/context.go @@ -56,6 +56,7 @@ type Context[H Hash, Tx Transaction[H]] struct { Timestamp uint64 Nonce uint64 // Transactions is a slice containing actual transactions for the current block. + // Duplicates are no-op and will lead to improper block construction. Transactions []Tx // MissingTransactions is a map of a missing transaction hash to its index in // the slice of proposed transactions for the current block. This map is diff --git a/prepare_request.go b/prepare_request.go index 8870df4a..d6aa28c4 100644 --- a/prepare_request.go +++ b/prepare_request.go @@ -9,5 +9,7 @@ type PrepareRequest[H Hash, Tx Transaction[H]] interface { // Transactions returns the list of all transactions in a proposed block // with possible gaps in place of missing transactions and the map of // missing transaction hashes to their indexes in the proposal list. + // Transaction duplicates are no-op and will lead to improper block + // construction. Transactions() ([]Tx, map[H]int) }