rpcserver: avoid nested decodescript p2sh addrs

This commit is contained in:
David Hill 2016-10-19 13:15:21 -04:00 committed by Dave Collins
parent e7caccc866
commit 403aaf5cf3
3 changed files with 5 additions and 3 deletions

View file

@ -56,7 +56,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

@ -833,7 +833,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

@ -106,7 +106,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 bitcoin 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.",