Skip to content

Commit

Permalink
fix(proposer): fix a proposer nonce order issue (taikoxyz#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Feb 17, 2023
1 parent a9f42e9 commit 40d296b
Showing 1 changed file with 15 additions and 1 deletion.
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

0 comments on commit 40d296b

Please sign in to comment.