Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

fix(proposer): fix a proposer nonce order issue #157

Merged
merged 4 commits into from
Feb 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion pkg/rpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"math/big"
"sort"
"time"

ethereum "github.com/ethereum/go-ethereum"
Expand Down Expand Up @@ -183,13 +184,26 @@ func (pc PoolContent) ToTxsByPriceAndNonce(
remotes *types.TransactionsByPriceAndNonce,
) {
var (
allTxs = map[common.Address]types.Transactions{}
localTxs = map[common.Address]types.Transactions{}
remoteTxs = map[common.Address]types.Transactions{}
)

for address, txsWithNonce := range pc {
out:
idx := 0
for _, tx := range txsWithNonce {
allTxs[address] = append(allTxs[address], tx)
idx += 1

if idx == len(txsWithNonce) {
sort.Sort(types.TxByNonce(allTxs[address]))
}
}
}

for address, txs := range allTxs {
out:
for _, tx := range txs {
for _, localAddress := range localAddresses {
if address == localAddress {
localTxs[address] = append(localTxs[address], tx)
Expand Down