mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core/headerchain: add BigIntSlice sort functions
This commit is contained in:
parent
7319087fb6
commit
112cdc5853
1 changed files with 7 additions and 0 deletions
|
|
@ -528,3 +528,10 @@ func (hc *HeaderChain) Engine() consensus.Engine { return hc.engine }
|
||||||
func (hc *HeaderChain) GetBlock(hash common.Hash, number uint64) *types.Block {
|
func (hc *HeaderChain) GetBlock(hash common.Hash, number uint64) *types.Block {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BigIntSlice attaches the methods of sort.Interface to []*big.Int, sorting in increasing order. (used by CalcPastMedianTime)
|
||||||
|
type BigIntSlice []*big.Int
|
||||||
|
|
||||||
|
func (s BigIntSlice) Len() int { return len(s) }
|
||||||
|
func (s BigIntSlice) Less(i, j int) bool { return s[i].Cmp(s[j]) < 0 }
|
||||||
|
func (s BigIntSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue