core/stateless: fix parsing an empty witness (#34683)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

This is to fix a crasher in keeper.
This commit is contained in:
Sina M 2026-04-09 03:19:54 +02:00 committed by GitHub
parent 21b19362c2
commit 68c7058a80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,6 +17,7 @@
package stateless
import (
"errors"
"io"
"github.com/ethereum/go-ethereum/common/hexutil"
@ -42,6 +43,9 @@ func (w *Witness) ToExtWitness() *ExtWitness {
// FromExtWitness converts the consensus witness format into our internal one.
func (w *Witness) FromExtWitness(ext *ExtWitness) error {
if len(ext.Headers) == 0 {
return errors.New("witness must contain at least one header")
}
w.Headers = ext.Headers
w.Codes = make(map[string]struct{}, len(ext.Codes))