ToProto converts Commit to protobuf
()
| 937 | |
| 938 | // ToProto converts Commit to protobuf |
| 939 | func (commit *Commit) ToProto() *tmproto.Commit { |
| 940 | if commit == nil { |
| 941 | return nil |
| 942 | } |
| 943 | |
| 944 | c := new(tmproto.Commit) |
| 945 | sigs := make([]tmproto.CommitSig, len(commit.Signatures)) |
| 946 | for i := range commit.Signatures { |
| 947 | sigs[i] = *commit.Signatures[i].ToProto() |
| 948 | } |
| 949 | c.Signatures = sigs |
| 950 | |
| 951 | c.Height = commit.Height |
| 952 | c.Round = commit.Round |
| 953 | c.BlockID = commit.BlockID.ToProto() |
| 954 | |
| 955 | return c |
| 956 | } |
| 957 | |
| 958 | // FromProto sets a protobuf Commit to the given pointer. |
| 959 | // It returns an error if the commit is invalid. |