diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-02-22 13:14:55 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:22 +0800 |
commit | 2354d4aa747616a8fd4fb9482ada8042fd362139 (patch) | |
tree | 46fe0953c0258591c2cd415c3760764ff613a5bb /vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go | |
parent | 81193a683d6328b627ee0e5f0f3689b3473e29ea (diff) | |
download | go-tangerine-2354d4aa747616a8fd4fb9482ada8042fd362139.tar go-tangerine-2354d4aa747616a8fd4fb9482ada8042fd362139.tar.gz go-tangerine-2354d4aa747616a8fd4fb9482ada8042fd362139.tar.bz2 go-tangerine-2354d4aa747616a8fd4fb9482ada8042fd362139.tar.lz go-tangerine-2354d4aa747616a8fd4fb9482ada8042fd362139.tar.xz go-tangerine-2354d4aa747616a8fd4fb9482ada8042fd362139.tar.zst go-tangerine-2354d4aa747616a8fd4fb9482ada8042fd362139.zip |
core: Remove K, Phi and NumChains from Governance (#198)
* change default sync_core.sh
* vendor: sync to latest core
* core: Remove K, Phi and NumChain
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go')
-rw-r--r-- | vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go index b2a8f57f8..a2b697ce0 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block.go @@ -198,7 +198,7 @@ func (b *Block) DecodeRLP(s *rlp.Stream) error { } func (b *Block) String() string { - return fmt.Sprintf("Block{Hash:%v %s}", b.Hash.String()[:6], &b.Position) + return fmt.Sprintf("Block{Hash:%v %s}", b.Hash.String()[:6], b.Position) } // Clone returns a deep copy of a block. @@ -263,62 +263,62 @@ func (b ByHash) Swap(i int, j int) { b[i], b[j] = b[j], b[i] } -// ByPosition is the helper type for sorting slice of blocks by position. -type ByPosition []*Block +// BlocksByPosition is the helper type for sorting slice of blocks by position. +type BlocksByPosition []*Block // Len implements Len method in sort.Sort interface. -func (bs ByPosition) Len() int { +func (bs BlocksByPosition) Len() int { return len(bs) } // Less implements Less method in sort.Sort interface. -func (bs ByPosition) Less(i int, j int) bool { - return bs[j].Position.Newer(&bs[i].Position) +func (bs BlocksByPosition) Less(i int, j int) bool { + return bs[j].Position.Newer(bs[i].Position) } // Swap implements Swap method in sort.Sort interface. -func (bs ByPosition) Swap(i int, j int) { +func (bs BlocksByPosition) Swap(i int, j int) { bs[i], bs[j] = bs[j], bs[i] } // Push implements Push method in heap interface. -func (bs *ByPosition) Push(x interface{}) { +func (bs *BlocksByPosition) Push(x interface{}) { *bs = append(*bs, x.(*Block)) } // Pop implements Pop method in heap interface. -func (bs *ByPosition) Pop() (ret interface{}) { +func (bs *BlocksByPosition) Pop() (ret interface{}) { n := len(*bs) *bs, ret = (*bs)[0:n-1], (*bs)[n-1] return } -// ByFinalizationHeight is the helper type for sorting slice of blocks by +// BlocksByFinalizationHeight is the helper type for sorting slice of blocks by // finalization height. -type ByFinalizationHeight []*Block +type BlocksByFinalizationHeight []*Block // Len implements Len method in sort.Sort interface. -func (bs ByFinalizationHeight) Len() int { +func (bs BlocksByFinalizationHeight) Len() int { return len(bs) } // Less implements Less method in sort.Sort interface. -func (bs ByFinalizationHeight) Less(i int, j int) bool { +func (bs BlocksByFinalizationHeight) Less(i int, j int) bool { return bs[i].Finalization.Height < bs[j].Finalization.Height } // Swap implements Swap method in sort.Sort interface. -func (bs ByFinalizationHeight) Swap(i int, j int) { +func (bs BlocksByFinalizationHeight) Swap(i int, j int) { bs[i], bs[j] = bs[j], bs[i] } // Push implements Push method in heap interface. -func (bs *ByFinalizationHeight) Push(x interface{}) { +func (bs *BlocksByFinalizationHeight) Push(x interface{}) { *bs = append(*bs, x.(*Block)) } // Pop implements Pop method in heap interface. -func (bs *ByFinalizationHeight) Pop() (ret interface{}) { +func (bs *BlocksByFinalizationHeight) Pop() (ret interface{}) { n := len(*bs) *bs, ret = (*bs)[0:n-1], (*bs)[n-1] return |