mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
core/txpool/blobpool: reject blob tx with with legacy sidecar
This commit is contained in:
parent
409cfa557c
commit
d89b92ce1d
2 changed files with 4 additions and 9 deletions
|
|
@ -1431,14 +1431,10 @@ func (p *BlobPool) convertSidecar(txs []*types.Transaction) ([]*types.Transactio
|
|||
// related to the add is finished. Only use this during tests for determinism.
|
||||
func (p *BlobPool) Add(txs []*types.Transaction, sync bool) []error {
|
||||
var (
|
||||
errs []error
|
||||
errs = make([]error, len(txs))
|
||||
adds = make([]*types.Transaction, 0, len(txs))
|
||||
)
|
||||
txs, errs = p.convertSidecar(txs)
|
||||
for i, tx := range txs {
|
||||
if errs[i] != nil {
|
||||
continue
|
||||
}
|
||||
errs[i] = p.add(tx)
|
||||
if errs[i] == nil {
|
||||
adds = append(adds, tx.WithoutBlobTxSidecar())
|
||||
|
|
|
|||
|
|
@ -1689,8 +1689,7 @@ func TestAdd(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// Tests that adding the transactions with legacy sidecar and expect them to
|
||||
// be converted to new format correctly.
|
||||
// Tests adding transactions with legacy sidecars are correctly rejected.
|
||||
func TestAddLegacyBlobTx(t *testing.T) {
|
||||
var (
|
||||
key1, _ = crypto.GenerateKey()
|
||||
|
|
@ -1724,8 +1723,8 @@ func TestAddLegacyBlobTx(t *testing.T) {
|
|||
)
|
||||
errs := pool.Add([]*types.Transaction{tx1, tx2, tx3}, true)
|
||||
for _, err := range errs {
|
||||
if err != nil {
|
||||
t.Fatalf("failed to add tx: %v", err)
|
||||
if err == nil {
|
||||
t.Fatalf("expected tx add to fail")
|
||||
}
|
||||
}
|
||||
verifyPoolInternals(t, pool)
|
||||
|
|
|
|||
Loading…
Reference in a new issue