rpcserver: avoid nested decodescript p2sh addrs

This commit is contained in:
Donald Adu-Poku 2017-11-28 12:20:57 +00:00
commit 06468ffcfa
3 changed files with 5 additions and 3 deletions

View File

@ -79,7 +79,7 @@ type DecodeScriptResult struct {
ReqSigs int32 `json:"reqSigs,omitempty"`
Type string `json:"type"`
Addresses []string `json:"addresses,omitempty"`
P2sh string `json:"p2sh"`
P2sh string `json:"p2sh,omitempty"`
}
// GetAddedNodeInfoResultAddr models the data of the addresses portion of the

View File

@ -1465,7 +1465,9 @@ func handleDecodeScript(s *rpcServer, cmd interface{}, closeChan <-chan struct{}
ReqSigs: int32(reqSigs),
Type: scriptClass.String(),
Addresses: addresses,
P2sh: p2sh.EncodeAddress(),
}
if scriptClass != txscript.ScriptHashTy {
reply.P2sh = p2sh.EncodeAddress()
}
return reply, nil
}

View File

@ -157,7 +157,7 @@ var helpDescsEnUS = map[string]string{
"decodescriptresult-reqSigs": "The number of required signatures",
"decodescriptresult-type": "The type of the script (e.g. 'pubkeyhash')",
"decodescriptresult-addresses": "The decred addresses associated with this script",
"decodescriptresult-p2sh": "The script hash for use in pay-to-script-hash transactions",
"decodescriptresult-p2sh": "The script hash for use in pay-to-script-hash transactions (only present if the provided redeem script is not already a pay-to-script-hash script)",
// DecodeScriptCmd help.
"decodescript--synopsis": "Returns a JSON object with information about the provided hex-encoded script.",