github.com/aswedchain/aswed@v1.0.1/eth/gasprice/types.go (about)

     1  package gasprice
     2  
     3  import "github.com/aswedchain/aswed/core/types"
     4  
     5  // TxByPrice sorts the txs descending by price
     6  type TxByPrice types.Transactions
     7  
     8  func (s TxByPrice) Len() int { return len(s) }
     9  func (s TxByPrice) Less(i, j int) bool {
    10  	return s[i].GasPriceCmp(s[j]) > 0 // descending
    11  }
    12  func (s TxByPrice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }