-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*: use generic hashes implementation for DBFT
A part of #2. Use generics instead of util.Uint160 and util.Uint256 types for DBFT and related components. Keep util.Uint160 and util.Uint256 only for specific DBFT implementation in testing code. The following regressions/behaviour changes were made to properly apply generics: 1. `dbft.Option` alias is removed since type parameters can't be defined on aliases (generic type aliases are prohibited). Ref. golang/go#46477. 2. Default dBFT configuration is reduced: all payload-specific defaults are removed, as described in #91. It is done because default dBFT configuration should not depend on any implementation-specific hash type. 3. DBFT configuration validation check is extended wrt point 2. 4. The check if generic `dbft.DBFT` type implements generic `dbft.Service` interface is removed since such check should be performed on particular (non-generic) DBFT implementation. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
- Loading branch information
1 parent
92d9aec
commit 830c068
Showing
20 changed files
with
519 additions
and
390 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package block | ||
|
||
import ( | ||
"github.com/nspcc-dev/neo-go/pkg/util" | ||
"github.com/nspcc-dev/dbft/crypto" | ||
) | ||
|
||
// Transaction is a generic transaction interface. | ||
type Transaction interface { | ||
type Transaction[H crypto.Hash] interface { | ||
// Hash must return cryptographic hash of the transaction. | ||
// Transactions which have equal hashes are considered equal. | ||
Hash() util.Uint256 | ||
Hash() H | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.