txscript: Remove unused PayToSSRtx.

This removes PayToSSRtx since it is no longer used by anything in the
repository and is now available via the PayRevokeCommitmentScript method
of the relevant stdaddr addresses.
This commit is contained in:
Dave Collins 2021-03-16 12:36:45 -05:00
parent ff99da2fac
commit 9727f128fa
No known key found for this signature in database
GPG Key ID: B8904D9D9C93D1F2

View File

@ -810,49 +810,6 @@ func payToSchnorrPubKeyScript(serializedPubKey []byte) ([]byte, error) {
AddOp(OP_CHECKSIGALT).Script()
}
// PayToSSRtx creates a new script to pay a transaction output to a
// public key hash, but tags the output with OP_SSRTX. For use in constructing
// valid SSRtx.
func PayToSSRtx(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_SSRTX).AddOp(OP_DUP).
AddOp(OP_HASH160).AddData(hash).AddOp(OP_EQUALVERIFY).
AddOp(OP_CHECKSIG).Script()
}
return NewScriptBuilder().AddOp(OP_SSRTX).AddOp(OP_HASH160).
AddData(hash).AddOp(OP_EQUAL).Script()
}
// PayToSSRtxPKHDirect creates a new script to pay a transaction output to a
// public key hash, but tags the output with OP_SSRTX. For use in constructing
// valid SSRtx. Unlike PayToSSRtx, this function directly uses the HASH160