parseWitnessStack parses a json array of witness items encoded as hex into a slice of witness elements.
(elements []interface{})
| 115 | // parseWitnessStack parses a json array of witness items encoded as hex into a |
| 116 | // slice of witness elements. |
| 117 | func parseWitnessStack(elements []interface{}) ([][]byte, error) { |
| 118 | witness := make([][]byte, len(elements)) |
| 119 | for i, e := range elements { |
| 120 | witElement, err := hex.DecodeString(e.(string)) |
| 121 | if err != nil { |
| 122 | return nil, err |
| 123 | } |
| 124 | |
| 125 | witness[i] = witElement |
| 126 | } |
| 127 | |
| 128 | return witness, nil |
| 129 | } |
| 130 | |
| 131 | // shortFormOps holds a map of opcode names to values for use in short form |
| 132 | // parsing. It is declared here so it only needs to be created once. |
no outgoing calls
no test coverage detected
searching dependent graphs…