[lbry] rpc: un-embedded attributes in getaddressinfo result

lbcwallet failed to re-generate RPC help message.

The help message generator doesn't handle embedded fields properly.
This commit is contained in:
Roy Lee 2022-07-05 20:11:29 -07:00
parent ca9b4e5529
commit 3a179a0eee
2 changed files with 22 additions and 5 deletions

View file

@ -53,7 +53,26 @@ type embeddedAddressInfo struct {
// 3. Information about the embedded address in case of P2SH or P2WSH.
// Same structure as (1).
type GetAddressInfoResult struct {
embeddedAddressInfo
// The following fields are identical to embeddedAddressInfo.
// However, the utility to generate RPC help message can't handle
// embedded field properly. So, spell out the attributes individually.
Address string `json:"address"`
ScriptPubKey string `json:"scriptPubKey"`
Descriptor *string `json:"desc,omitempty"`
IsScript bool `json:"isscript"`
IsChange bool `json:"ischange"`
IsWitness bool `json:"iswitness"`
WitnessVersion int `json:"witness_version,omitempty"`
WitnessProgram *string `json:"witness_program,omitempty"`
ScriptType *txscript.ScriptClass `json:"script,omitempty"`
Hex *string `json:"hex,omitempty"`
PubKeys *[]string `json:"pubkeys,omitempty"`
SignaturesRequired *int `json:"sigsrequired,omitempty"`
PubKey *string `json:"pubkey,omitempty"`
IsCompressed *bool `json:"iscompressed,omitempty"`
HDMasterFingerprint *string `json:"hdmasterfingerprint,omitempty"`
Labels []string `json:"labels"`
IsMine bool `json:"ismine"`
IsWatchOnly bool `json:"iswatchonly"`
Timestamp *int `json:"timestamp,omitempty"`

View file

@ -37,10 +37,8 @@ func TestGetAddressInfoResult(t *testing.T) {
name: "GetAddressInfoResult - ScriptType",
result: `{"script":"nonstandard","address":"1abc"}`,
want: GetAddressInfoResult{
embeddedAddressInfo: embeddedAddressInfo{
Address: "1abc",
ScriptType: nonStandard,
},
Address: "1abc",
ScriptType: nonStandard,
},
},
{