mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-16 11:51:35 +00:00
core/stateless: fix parsing an empty witness
This commit is contained in:
parent
a8ea6319f1
commit
44bfc0d4d3
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