@@ -163,15 +163,23 @@ impl Decodable for TendermintMessage {
163
163
let id = rlp. val_at ( 0 ) ?;
164
164
Ok ( match id {
165
165
MESSAGE_ID_CONSENSUS_MESSAGE => {
166
- if rlp. item_count ( ) ? != 2 {
167
- return Err ( DecoderError :: RlpIncorrectListLen )
166
+ let item_count = rlp. item_count ( ) ?;
167
+ if item_count != 2 {
168
+ return Err ( DecoderError :: RlpIncorrectListLen {
169
+ got : item_count,
170
+ expected : 2 ,
171
+ } )
168
172
}
169
173
let bytes = rlp. at ( 1 ) ?;
170
174
TendermintMessage :: ConsensusMessage ( bytes. as_val ( ) ?)
171
175
}
172
176
MESSAGE_ID_PROPOSAL_BLOCK => {
173
- if rlp. item_count ( ) ? != 3 {
174
- return Err ( DecoderError :: RlpIncorrectListLen )
177
+ let item_count = rlp. item_count ( ) ?;
178
+ if item_count != 3 {
179
+ return Err ( DecoderError :: RlpIncorrectListLen {
180
+ got : item_count,
181
+ expected : 3 ,
182
+ } )
175
183
}
176
184
let signature = rlp. at ( 1 ) ?;
177
185
let message = rlp. at ( 2 ) ?;
@@ -181,8 +189,12 @@ impl Decodable for TendermintMessage {
181
189
}
182
190
}
183
191
MESSAGE_ID_STEP_STATE => {
184
- if rlp. item_count ( ) ? != 5 {
185
- return Err ( DecoderError :: RlpIncorrectListLen )
192
+ let item_count = rlp. item_count ( ) ?;
193
+ if item_count != 5 {
194
+ return Err ( DecoderError :: RlpIncorrectListLen {
195
+ got : item_count,
196
+ expected : 5 ,
197
+ } )
186
198
}
187
199
let vote_step = rlp. at ( 1 ) ?. as_val ( ) ?;
188
200
let proposal = rlp. at ( 2 ) ?. as_val ( ) ?;
@@ -196,8 +208,12 @@ impl Decodable for TendermintMessage {
196
208
}
197
209
}
198
210
MESSAGE_ID_REQUEST_MESSAGE => {
199
- if rlp. item_count ( ) ? != 3 {
200
- return Err ( DecoderError :: RlpIncorrectListLen )
211
+ let item_count = rlp. item_count ( ) ?;
212
+ if item_count != 3 {
213
+ return Err ( DecoderError :: RlpIncorrectListLen {
214
+ got : item_count,
215
+ expected : 3 ,
216
+ } )
201
217
}
202
218
let vote_step = rlp. at ( 1 ) ?. as_val ( ) ?;
203
219
let requested_votes = rlp. at ( 2 ) ?. as_val ( ) ?;
@@ -207,8 +223,12 @@ impl Decodable for TendermintMessage {
207
223
}
208
224
}
209
225
MESSAGE_ID_REQUEST_PROPOSAL => {
210
- if rlp. item_count ( ) ? != 3 {
211
- return Err ( DecoderError :: RlpIncorrectListLen )
226
+ let item_count = rlp. item_count ( ) ?;
227
+ if item_count != 3 {
228
+ return Err ( DecoderError :: RlpIncorrectListLen {
229
+ got : item_count,
230
+ expected : 3 ,
231
+ } )
212
232
}
213
233
let height = rlp. at ( 1 ) ?. as_val ( ) ?;
214
234
let view = rlp. at ( 2 ) ?. as_val ( ) ?;
0 commit comments