6 "github.com/vapor/encoding/blockchain"
9 type BlockWitness struct {
10 // Witness is a vector of arguments for validating this block.
14 func (bw *BlockWitness) readFrom(r *blockchain.Reader) (err error) {
15 bw.Witness, err = blockchain.ReadVarstrList(r)
19 func (bw *BlockWitness) writeTo(w io.Writer) error {
20 _, err := blockchain.WriteVarstrList(w, bw.Witness)
24 func (bw *BlockWitness) Set(index uint64, data []byte) {
25 if uint64(len(bw.Witness)) <= index {
26 newWitness := make([][]byte, index+1, index+1)
27 copy(newWitness, bw.Witness)
28 bw.Witness = newWitness
30 bw.Witness[index] = data
33 func (bw *BlockWitness) Delete(index uint64) {
34 if uint64(len(bw.Witness)) > index {
35 bw.Witness[index] = nil
39 func (bw *BlockWitness) Get(index uint64) []byte {
40 if uint64(len(bw.Witness)) > index {
41 return bw.Witness[index]