mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-23 23:36:56 +00:00
19 lines
625 B
Go
19 lines
625 B
Go
package testutils
|
|
|
|
import (
|
|
"github.com/kaspanet/kaspad/domain/consensus/utils/txscript"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
// OpTrueScript returns a P2SH script paying to an anyone-can-spend address,
|
|
// The second return value is a redeemScript to be used with txscript.PayToScriptHashSignatureScript
|
|
func OpTrueScript() (scriptPublicKey, redeemScript []byte) {
|
|
var err error
|
|
redeemScript = []byte{txscript.OpTrue}
|
|
scriptPublicKey, err = txscript.PayToScriptHashScript(redeemScript)
|
|
if err != nil {
|
|
panic(errors.Wrapf(err, "Couldn't parse opTrueScript. This should never happen"))
|
|
}
|
|
return scriptPublicKey, redeemScript
|
|
}
|