MCPcopy Create free account
hub / github.com/CPChain/chain / Less

Method Less

core/tx_list.go:429–439  ·  view source on GitHub ↗
(i, j int)

Source from the content-addressed store, hash-verified

427func (h priceHeap) Swap(i, j int) { h[i], h[j] = h[j], h[i] }
428
429func (h priceHeap) Less(i, j int) bool {
430 // Sort primarily by price, returning the cheaper one
431 switch h[i].GasPrice().Cmp(h[j].GasPrice()) {
432 case -1:
433 return true
434 case 1:
435 return false
436 }
437 // If the prices match, stabilize via nonces (high nonce is worse)
438 return h[i].Nonce() > h[j].Nonce()
439}
440
441func (h *priceHeap) Push(x interface{}) {
442 *h = append(*h, x.(*types.Transaction))

Callers

nothing calls this directly

Calls 3

CmpMethod · 0.80
GasPriceMethod · 0.65
NonceMethod · 0.65

Tested by

no test coverage detected