Skip to content

Commit

Permalink
Add clear astriaordered, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
joroshiba committed Mar 30, 2023
1 parent dda2605 commit 7fd75bd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
20 changes: 17 additions & 3 deletions core/txpool/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ type TxPool struct {
pendingNonces *noncer // Pending state tracking virtual nonces
currentMaxGas uint64 // Current gas limit for transaction caps

astria *astriaOrdered
astria *astriaOrdered
locals *accountSet // Set of local transaction to exempt from eviction rules
journal *journal // Journal of local transaction to back up to disk

Expand Down Expand Up @@ -931,7 +931,7 @@ func (pool *TxPool) SetAstriaOrdered(rawTxs [][]byte) {
txs := *&types.Transactions{}
for idx, rawTx := range rawTxs {
tx := new(types.Transaction)
err := tx.UnmarshalBinary(rawTx);
err := tx.UnmarshalBinary(rawTx)
if err != nil {
log.Info("Failed to unmarshall raw astria tx bytes", rawTx, "at index", idx)
continue
Expand All @@ -946,7 +946,11 @@ func (pool *TxPool) SetAstriaOrdered(rawTxs [][]byte) {
txs = append(txs, tx)
}

pool.astria.txs = txs
pool.astria = newAstriaOrdered(&txs)
}

func (pool *TxPool) ClearAstriaOrdered() {
pool.astria.clear()
}

func (pool *TxPool) AstriaOrdered() *types.Transactions {
Expand Down Expand Up @@ -1743,6 +1747,16 @@ type astriaOrdered struct {
txs types.Transactions
}

func newAstriaOrdered(txs *types.Transactions) *astriaOrdered {
return &astriaOrdered{
txs: *txs,
}
}

func (ao *astriaOrdered) clear() {
ao.txs = *&types.Transactions{}
}

// accountSet is simply a set of addresses to check for existence, and a signer
// capable of deriving addresses from transactions.
type accountSet struct {
Expand Down
1 change: 1 addition & 0 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,7 @@ func (w *worker) fillTransactions(interrupt *int32, env *environment) error {
return err
}
}
w.eth.TxPool().ClearAstriaOrdered()

// Original Geth Code
if false {
Expand Down

0 comments on commit 7fd75bd

Please sign in to comment.