ComputePkScript computes the script of an output by looking at the spending input's signature script or witness. NOTE: Only P2PKH, P2SH, P2WSH, and P2WPKH redeem scripts are supported.
(sigScript []byte, witness wire.TxWitness)
| 180 | // |
| 181 | // NOTE: Only P2PKH, P2SH, P2WSH, and P2WPKH redeem scripts are supported. |
| 182 | func ComputePkScript(sigScript []byte, witness wire.TxWitness) (PkScript, error) { |
| 183 | switch { |
| 184 | case len(sigScript) > 0: |
| 185 | return computeNonWitnessPkScript(sigScript) |
| 186 | case len(witness) > 0: |
| 187 | return computeWitnessPkScript(witness) |
| 188 | default: |
| 189 | return PkScript{}, ErrUnsupportedScriptType |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | // computeNonWitnessPkScript computes the script of an output by looking at the |
| 194 | // spending input's signature script. |
searching dependent graphs…