MCPcopy Create free account
hub / github.com/btcsuite/btcd / ComputePkScript

Function ComputePkScript

txscript/pkscript.go:182–191  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

180//
181// NOTE: Only P2PKH, P2SH, P2WSH, and P2WPKH redeem scripts are supported.
182func 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.

Callers 1

TestComputePkScriptFunction · 0.85

Calls 2

computeWitnessPkScriptFunction · 0.85

Tested by 1

TestComputePkScriptFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…