Skip to content

Commit

Permalink
mempool: fast tx size check
Browse files Browse the repository at this point in the history
  • Loading branch information
jchappelow committed Feb 24, 2025
1 parent 6a4cf2e commit 0c84efb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions node/mempool/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package mempool

import (
"context"
"io"
"slices"
"sync"

Expand Down Expand Up @@ -94,7 +93,7 @@ func (mp *Mempool) Store(txid types.Hash, tx *ktypes.Transaction) (found, reject
return true, false // already have it
}

sz, _ := tx.WriteTo(io.Discard) // TODO: make a SerializeSize method for Transaction
sz := tx.SerializeSize()

if mp.currentSize+sz > mp.maxSize {
return false, true
Expand Down

0 comments on commit 0c84efb

Please sign in to comment.