mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
validate blob hashes
This commit is contained in:
parent
123a3e589f
commit
adc10d23a5
1 changed files with 21 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ package catalyst
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -202,6 +203,14 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
|
||||||
|
|
||||||
// Mark the payload as canon
|
// Mark the payload as canon
|
||||||
if isCancun {
|
if isCancun {
|
||||||
|
txes, err := decodeTransactions(payload.Transactions)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
blobHashes := make([]common.Hash, 0)
|
||||||
|
for _, tx := range txes {
|
||||||
|
blobHashes = append(blobHashes, tx.BlobHashes()...)
|
||||||
|
}
|
||||||
if _, err = c.engineAPI.NewPayloadV3(*payload, []common.Hash{}, &common.Hash{}); err != nil {
|
if _, err = c.engineAPI.NewPayloadV3(*payload, []common.Hash{}, &common.Hash{}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -321,3 +330,15 @@ func RegisterSimulatedBeaconAPIs(stack *node.Node, sim *SimulatedBeacon) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func decodeTransactions(enc [][]byte) ([]*types.Transaction, error) {
|
||||||
|
var txs = make([]*types.Transaction, len(enc))
|
||||||
|
for i, encTx := range enc {
|
||||||
|
var tx types.Transaction
|
||||||
|
if err := tx.UnmarshalBinary(encTx); err != nil {
|
||||||
|
return nil, fmt.Errorf("invalid transaction %d: %v", i, err)
|
||||||
|
}
|
||||||
|
txs[i] = &tx
|
||||||
|
}
|
||||||
|
return txs, nil
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue