2018-01-31 08:27:08 +00:00
|
|
|
package core
|
|
|
|
|
2018-01-31 10:47:54 +00:00
|
|
|
import (
|
|
|
|
"encoding/binary"
|
|
|
|
"io"
|
|
|
|
)
|
2018-01-31 08:27:08 +00:00
|
|
|
|
|
|
|
// Witness ...
|
|
|
|
type Witness struct {
|
|
|
|
InvocationScript []byte
|
|
|
|
VerificationScript []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
// DecodeBinary implements the payload interface.
|
|
|
|
func (wit *Witness) DecodeBinary(r io.Reader) error {
|
2018-01-31 10:47:54 +00:00
|
|
|
var lenb uint8
|
|
|
|
|
|
|
|
err := binary.Read(r, binary.LittleEndian, &lenb)
|
|
|
|
wit.InvocationScript = make([]byte, lenb)
|
|
|
|
binary.Read(r, binary.LittleEndian, &wit.InvocationScript)
|
|
|
|
err = binary.Read(r, binary.LittleEndian, &lenb)
|
|
|
|
wit.VerificationScript = make([]byte, lenb)
|
|
|
|
binary.Read(r, binary.LittleEndian, &wit.VerificationScript)
|
|
|
|
|
|
|
|
return err
|
2018-01-31 08:27:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// EncodeBinary implements the payload interface.
|
|
|
|
func (wit *Witness) EncodeBinary(w io.Writer) error {
|
|
|
|
return nil
|
|
|
|
}
|