mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-04-09 03:17:31 +00:00
core/stateless: fix parsing an empty witness (#34683)
This is to fix a crasher in keeper.
This commit is contained in:
parent
21b19362c2
commit
68c7058a80
1 changed files with 4 additions and 0 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue