neo-go/pkg/core/witness.go
Anthony De Meulemeester 628656483a
bug fixes (TCP + uint256) and started core part (#14)
* Fixed TCP read + Uint256 reversed array + started on some core pieces

* Disabled some debug output + muted test

* 0.5.0
2018-02-04 20:54:51 +01:00

36 lines
773 B
Go

package core
import (
"encoding/binary"
"io"
"github.com/CityOfZion/neo-go/pkg/util"
)
// Witness ...
type Witness struct {
InvocationScript []byte
VerificationScript []byte
}
// DecodeBinary implements the payload interface.
func (wit *Witness) DecodeBinary(r io.Reader) error {
lenb := util.ReadVarUint(r)
wit.InvocationScript = make([]byte, lenb)
if err := binary.Read(r, binary.LittleEndian, &wit.InvocationScript); err != nil {
panic(err)
}
lenb = util.ReadVarUint(r)
wit.VerificationScript = make([]byte, lenb)
if err := binary.Read(r, binary.LittleEndian, &wit.VerificationScript); err != nil {
panic(err)
}
return nil
}
// EncodeBinary implements the payload interface.
func (wit *Witness) EncodeBinary(w io.Writer) error {
return nil
}