mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-24 08:49:29 +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
|
package stateless
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
"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.
|
// FromExtWitness converts the consensus witness format into our internal one.
|
||||||
func (w *Witness) FromExtWitness(ext *ExtWitness) error {
|
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.Headers = ext.Headers
|
||||||
|
|
||||||
w.Codes = make(map[string]struct{}, len(ext.Codes))
|
w.Codes = make(map[string]struct{}, len(ext.Codes))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue