Skip to content

Commit

Permalink
Fix protobuf generation for PR #1885 (#1915)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsutton authored Dec 29, 2021
1 parent 428449b commit 8282fb4
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 58 deletions.
2 changes: 1 addition & 1 deletion cmd/kaspactl/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var commandTypes = []reflect.Type{
reflect.TypeOf(protowire.KaspadMessage_SubmitTransactionRequest{}),

reflect.TypeOf(protowire.KaspadMessage_GetUtxosByAddressesRequest{}),
reflect.TypeOf(protowire.KaspadMessage_GetBalanceByAddressRequestMessage{}),
reflect.TypeOf(protowire.KaspadMessage_GetBalanceByAddressRequest{}),

reflect.TypeOf(protowire.KaspadMessage_BanRequest{}),
reflect.TypeOf(protowire.KaspadMessage_UnbanRequest{}),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import (
"github.com/pkg/errors"
)

func (x *KaspadMessage_GetBalanceByAddressRequestMessage) toAppMessage() (appmessage.Message, error) {
func (x *KaspadMessage_GetBalanceByAddressRequest) toAppMessage() (appmessage.Message, error) {
if x == nil {
return nil, errors.Wrapf(errorNil, "KaspadMessage_GetBalanceByAddressRequest is nil")
}
return x.GetBalanceByAddressRequestMessage.toAppMessage()
return x.GetBalanceByAddressRequest.toAppMessage()
}

func (x *KaspadMessage_GetBalanceByAddressRequestMessage) fromAppMessage(message *appmessage.GetBalanceByAddressRequestMessage) error {
x.GetBalanceByAddressRequestMessage = &GetBalanceByAddressRequestMessage{
func (x *KaspadMessage_GetBalanceByAddressRequest) fromAppMessage(message *appmessage.GetBalanceByAddressRequestMessage) error {
x.GetBalanceByAddressRequest = &GetBalanceByAddressRequestMessage{
Address: message.Address,
}
return nil
Expand All @@ -28,19 +28,19 @@ func (x *GetBalanceByAddressRequestMessage) toAppMessage() (appmessage.Message,
}, nil
}

func (x *KaspadMessage_GetBalanceByAddressResponseMessage) toAppMessage() (appmessage.Message, error) {
func (x *KaspadMessage_GetBalanceByAddressResponse) toAppMessage() (appmessage.Message, error) {
if x == nil {
return nil, errors.Wrapf(errorNil, "GetBalanceByAddressResponse is nil")
}
return x.GetBalanceByAddressResponseMessage.toAppMessage()
return x.GetBalanceByAddressResponse.toAppMessage()
}

func (x *KaspadMessage_GetBalanceByAddressResponseMessage) fromAppMessage(message *appmessage.GetBalanceByAddressResponseMessage) error {
func (x *KaspadMessage_GetBalanceByAddressResponse) fromAppMessage(message *appmessage.GetBalanceByAddressResponseMessage) error {
var err *RPCError
if message.Error != nil {
err = &RPCError{Message: message.Error.Message}
}
x.GetBalanceByAddressResponseMessage = &GetBalanceByAddressResponseMessage{
x.GetBalanceByAddressResponse = &GetBalanceByAddressResponseMessage{
Balance: message.Balance,

Error: err,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,14 +703,14 @@ func toRPCPayload(message appmessage.Message) (isKaspadMessage_Payload, error) {
}
return payload, nil
case *appmessage.GetBalanceByAddressRequestMessage:
payload := new(KaspadMessage_GetBalanceByAddressRequestMessage)
payload := new(KaspadMessage_GetBalanceByAddressRequest)
err := payload.fromAppMessage(message)
if err != nil {
return nil, err
}
return payload, nil
case *appmessage.GetBalanceByAddressResponseMessage:
payload := new(KaspadMessage_GetBalanceByAddressResponseMessage)
payload := new(KaspadMessage_GetBalanceByAddressResponse)
err := payload.fromAppMessage(message)
if err != nil {
return nil, err
Expand Down

0 comments on commit 8282fb4

Please sign in to comment.