txscript: Remove unused PayToSStx.
This removes PayToSStx since it is no longer used by anything in the repository and is now available via the VotingRightsScript method of the relevant stdaddr addresses.
This commit is contained in:
parent
59d8db038f
commit
21b91f8b4e
@ -810,49 +810,6 @@ func payToSchnorrPubKeyScript(serializedPubKey []byte) ([]byte, error) {
|
||||
AddOp(OP_CHECKSIGALT).Script()
|
||||
}
|
||||
|
||||
// PayToSStx creates a new script to pay a transaction output to a script hash or
|
||||
// public key hash, but tags the output with OP_SSTX. For use in constructing
|
||||
// valid SStxs.
|
||||
func PayToSStx(addr dcrutil.Address) ([]byte, error) {
|
||||
// Only pay to pubkey hash and pay to script hash are
|
||||
// supported.
|
||||
scriptType := PubKeyHashTy
|
||||
switch addr := addr.(type) {
|
||||
case *dcrutil.AddressPubKeyHash:
|
||||
if addr == nil {
|
||||
return nil, scriptError(ErrUnsupportedAddress,
|
||||
nilAddrErrStr)
|
||||
}
|
||||
if addr.DSA() != dcrec.STEcdsaSecp256k1 {
|
||||
str := "unable to generate payment script for " +
|
||||
"unsupported digital signature algorithm"
|
||||
return nil, scriptError(ErrUnsupportedAddress, str)
|
||||
}
|
||||
|
||||
case *dcrutil.AddressScriptHash:
|
||||
if addr == nil {
|
||||
return nil, scriptError(ErrUnsupportedAddress,
|
||||
nilAddrErrStr)
|
||||
}
|
||||
scriptType = ScriptHashTy
|
||||
|
||||
default:
|
||||
str := fmt.Sprintf("unable to generate payment script for "+
|
||||
"unsupported address type %T", addr)
|
||||
return nil, scriptError(ErrUnsupportedAddress, str)
|
||||
}
|
||||
|
||||
hash := addr.ScriptAddress()
|
||||
|
||||
if scriptType == PubKeyHashTy {
|
||||
return NewScriptBuilder().AddOp(OP_SSTX).AddOp(OP_DUP).
|
||||
AddOp(OP_HASH160).AddData(hash).AddOp(OP_EQUALVERIFY).
|
||||
AddOp(OP_CHECKSIG).Script()
|
||||
}
|
||||
return NewScriptBuilder().AddOp(OP_SSTX).AddOp(OP_HASH160).
|
||||
AddData(hash).AddOp(OP_EQUAL).Script()
|
||||
}
|
||||
|
||||
// PayToSStxChange creates a new script to pay a transaction output to a
|
||||
// public key hash, but tags the output with OP_SSTXCHANGE. For use in constructing
|
||||
// valid SStxs.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user