@@ -35,7 +35,7 @@ func toVirtualChannelFundingProposalMsg(protoEnvMsg *Envelope_VirtualChannelFund
3535 protoMsg := protoEnvMsg .VirtualChannelFundingProposalMsg
3636
3737 msg = & client.VirtualChannelFundingProposalMsg {}
38- msg .Initial , err = toSignedState (protoMsg .Initial )
38+ msg .Initial , err = ToSignedState (protoMsg .Initial )
3939 if err != nil {
4040 return nil , errors .WithMessage (err , "initial state" )
4141 }
@@ -54,7 +54,7 @@ func toVirtualChannelSettlementProposalMsg(protoEnvMsg *Envelope_VirtualChannelS
5454 protoMsg := protoEnvMsg .VirtualChannelSettlementProposalMsg
5555
5656 msg = & client.VirtualChannelSettlementProposalMsg {}
57- msg .Final , err = toSignedState (protoMsg .Final )
57+ msg .Final , err = ToSignedState (protoMsg .Final )
5858 if err != nil {
5959 return nil , errors .WithMessage (err , "final state" )
6060 }
@@ -90,12 +90,13 @@ func toChannelUpdate(protoUpdate *ChannelUpdateMsg) (update client.ChannelUpdate
9090 update .ActorIdx = channel .Index (protoUpdate .ChannelUpdate .ActorIdx )
9191 update .Sig = make ([]byte , len (protoUpdate .Sig ))
9292 copy (update .Sig , protoUpdate .Sig )
93- update .State , err = toState (protoUpdate .ChannelUpdate .State )
93+ update .State , err = ToState (protoUpdate .ChannelUpdate .State )
9494 return update , err
9595}
9696
97- func toSignedState (protoSignedState * SignedState ) (signedState channel.SignedState , err error ) {
98- signedState .Params , err = toParams (protoSignedState .Params )
97+ // ToSignedState parses protobuf signed states.
98+ func ToSignedState (protoSignedState * SignedState ) (signedState channel.SignedState , err error ) {
99+ signedState .Params , err = ToParams (protoSignedState .Params )
99100 if err != nil {
100101 return signedState , err
101102 }
@@ -104,11 +105,12 @@ func toSignedState(protoSignedState *SignedState) (signedState channel.SignedSta
104105 signedState .Sigs [i ] = make ([]byte , len (protoSignedState .Sigs [i ]))
105106 copy (signedState .Sigs [i ], protoSignedState .Sigs [i ])
106107 }
107- signedState .State , err = toState (protoSignedState .State )
108+ signedState .State , err = ToState (protoSignedState .State )
108109 return signedState , err
109110}
110111
111- func toParams (protoParams * Params ) (* channel.Params , error ) {
112+ // ToParams parses protobuf params.
113+ func ToParams (protoParams * Params ) (* channel.Params , error ) {
112114 app , err := toApp (protoParams .App )
113115 if err != nil {
114116 return nil , err
@@ -128,7 +130,8 @@ func toParams(protoParams *Params) (*channel.Params, error) {
128130 return params , nil
129131}
130132
131- func toState (protoState * State ) (state * channel.State , err error ) {
133+ // ToState parses protobuf states.
134+ func ToState (protoState * State ) (state * channel.State , err error ) {
132135 state = & channel.State {}
133136 copy (state .ID [:], protoState .Id )
134137 state .Version = protoState .Version
0 commit comments