aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore21
-rw-r--r--GNUmakefile2
-rw-r--r--Gopkg.lock8
-rw-r--r--blockdb/interfaces.go6
-rw-r--r--common/types.go2
-rw-r--r--core/blockchain.go2
-rw-r--r--core/blocklattice.go4
-rw-r--r--core/network.go2
-rw-r--r--core/types/block.go2
9 files changed, 32 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..67fb01a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,21 @@
+# Binaries for programs and plugins
+*.exe
+*.dll
+*.so
+*.dylib
+
+# Test binary, build with `go test -c`
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
+
+.DS_Store
+
+# vim swap files
+*.swp
+*.swo
+
+# Project specific
+vendor
+
diff --git a/GNUmakefile b/GNUmakefile
index 09d680a..eb0d93b 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,4 +1,4 @@
-# Makefile for Cobinhood Backend
+# Makefile for DEXON consensus core
DEXON_CONSENSUS_CORE=github.com/dexon-foundation/dexon-consensus-core
diff --git a/Gopkg.lock b/Gopkg.lock
index 57b1fdd..31eab77 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -8,12 +8,6 @@
version = "v1.1.0"
[[projects]]
- name = "github.com/getlantern/deepcopy"
- packages = ["."]
- revision = "b923171e8640f94369e21e324b1b0465cb82ec9f"
- version = "v1"
-
-[[projects]]
branch = "master"
name = "github.com/golang/snappy"
packages = ["."]
@@ -72,6 +66,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
- inputs-digest = "15c32472a1fe08e302ec948065c4bd908fd8e81b4fda7cbb210f9431e63b3714"
+ inputs-digest = "fdad0896fd0b14f0f84c7b77ee9d6335968e200efa7d48562ed6e4a80b923d79"
solver-name = "gps-cdcl"
solver-version = 1
diff --git a/blockdb/interfaces.go b/blockdb/interfaces.go
index 4d35e2e..9822dfc 100644
--- a/blockdb/interfaces.go
+++ b/blockdb/interfaces.go
@@ -27,13 +27,13 @@ import (
var (
// ErrBlockExists is the error when block eixsts.
ErrBlockExists = errors.New("block exists")
- // ErrBlockDoesNotExist is the error when block does not eixsts.
+ // ErrBlockDoesNotExist is the error when block does not eixst.
ErrBlockDoesNotExist = errors.New("block does not exist")
- // ErrValidatorDoesNotExist is the error when validator does not eixsts.
+ // ErrValidatorDoesNotExist is the error when validator does not eixst.
ErrValidatorDoesNotExist = errors.New("validator does not exist")
)
-// BlockDatabase is the interface for a BlockDatabse.
+// BlockDatabase is the interface for a BlockDatabase.
type BlockDatabase interface {
Reader
Writer
diff --git a/common/types.go b/common/types.go
index a52aabf..35d8036 100644
--- a/common/types.go
+++ b/common/types.go
@@ -34,7 +34,7 @@ func (h Hash) String() string {
return hex.EncodeToString([]byte(h[:]))
}
-// Equal compares if two hash are the same.
+// Equal compares if two hashes are the same.
func (h Hash) Equal(hp Hash) bool {
return bytes.Compare([]byte(h[:]), []byte(hp[:])) == 0
}
diff --git a/core/blockchain.go b/core/blockchain.go
index 6da74af..1222516 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -19,7 +19,7 @@ package core
import "github.com/dexon-foundation/dexon-consensus-core/core/types"
-// BlockChain is the basic datastucture used for storing blocks in each
+// BlockChain is the basic datastructure used for storing blocks in each
// validator.
type BlockChain struct {
validatorID types.ValidatorID
diff --git a/core/blocklattice.go b/core/blocklattice.go
index 2f95733..10f4b51 100644
--- a/core/blocklattice.go
+++ b/core/blocklattice.go
@@ -38,7 +38,7 @@ const (
infinity uint64 = math.MaxUint64
)
-// BlockLattice represent the local view of a single validator.
+// BlockLattice represents the local view of a single validator.
//
// blockDB stores blocks that are final. blocks stores blocks that are in ToTo
// State.
@@ -97,7 +97,7 @@ func (l *BlockLattice) AddValidator(
id types.ValidatorID, genesis *types.Block) {
l.validatorSet[id] = struct{}{}
- l.fmax = len(l.validatorSet) / 3
+ l.fmax = (len(l.validatorSet) - 1) / 3
l.phi = 2*l.fmax + 1
genesis.State = types.BlockStatusFinal
diff --git a/core/network.go b/core/network.go
index 1bd714d..8de73d2 100644
--- a/core/network.go
+++ b/core/network.go
@@ -21,7 +21,7 @@ import (
"github.com/dexon-foundation/dexon-consensus-core/core/types"
)
-// Endpoint is the interface for a client network endoint.
+// Endpoint is the interface for a client network endpoint.
type Endpoint interface {
GetID() types.ValidatorID
}
diff --git a/core/types/block.go b/core/types/block.go
index 265d32f..8808312 100644
--- a/core/types/block.go
+++ b/core/types/block.go
@@ -25,7 +25,7 @@ import (
"github.com/dexon-foundation/dexon-consensus-core/common"
)
-// State represent the block process state.
+// State represents the block process state.
type State int
// Block Status.