(i, j int)
| 427 | func (h priceHeap) Swap(i, j int) { h[i], h[j] = h[j], h[i] } |
| 428 | |
| 429 | func (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 | |
| 441 | func (h *priceHeap) Push(x interface{}) { |
| 442 | *h = append(*h, x.(*types.Transaction)) |