aboutsummaryrefslogtreecommitdiffstats
path: root/core/types/position.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/types/position.go')
-rw-r--r--core/types/position.go17
1 files changed, 4 insertions, 13 deletions
diff --git a/core/types/position.go b/core/types/position.go
index 8822f6e..902a55f 100644
--- a/core/types/position.go
+++ b/core/types/position.go
@@ -28,14 +28,14 @@ type Position struct {
Height uint64 `json:"height"`
}
-func (pos *Position) String() string {
+func (pos Position) String() string {
return fmt.Sprintf("Position{Round:%d Chain:%d Height:%d}",
pos.Round, pos.ChainID, pos.Height)
}
// Equal checks if two positions are equal, it panics when their chainIDs
// are different.
-func (pos *Position) Equal(other *Position) bool {
+func (pos Position) Equal(other Position) bool {
if pos.ChainID != other.ChainID {
panic(fmt.Errorf("unexpected chainID %d, should be %d",
other.ChainID, pos.ChainID))
@@ -45,7 +45,7 @@ func (pos *Position) Equal(other *Position) bool {
// Newer checks if one block is newer than another one on the same chain.
// If two blocks on different chain compared by this function, it would panic.
-func (pos *Position) Newer(other *Position) bool {
+func (pos Position) Newer(other Position) bool {
if pos.ChainID != other.ChainID {
panic(fmt.Errorf("unexpected chainID %d, should be %d",
other.ChainID, pos.ChainID))
@@ -56,7 +56,7 @@ func (pos *Position) Newer(other *Position) bool {
// Older checks if one block is older than another one on the same chain.
// If two blocks on different chain compared by this function, it would panic.
-func (pos *Position) Older(other *Position) bool {
+func (pos Position) Older(other Position) bool {
if pos.ChainID != other.ChainID {
panic(fmt.Errorf("unexpected chainID %d, should be %d",
other.ChainID, pos.ChainID))
@@ -64,12 +64,3 @@ func (pos *Position) Older(other *Position) bool {
return pos.Round < other.Round ||
(pos.Round == other.Round && pos.Height < other.Height)
}
-
-// Clone a position instance.
-func (pos *Position) Clone() *Position {
- return &Position{
- ChainID: pos.ChainID,
- Round: pos.Round,
- Height: pos.Height,
- }
-}