Commit 6bee208
authored
rpc fix streaming trace methods returning result:null in case of error (#21922)
Remove stream.WriteNil() from early error paths in traceBlock,
TraceTransaction, and traceCallMany. With the resultFieldStream wrapper
introduced in #19267, writing nil to the stream before returning an
error marks rs.written=true and forces "result":null into the response
alongside the error — violating JSON-RPC 2.0 section 5 (result MUST NOT
exist when error is present).
Add TestTraceErrorPathsWriteNoStream to verify the stream buffer stays
empty on early error returns.
To fix hive rpc-compact:
* debug_traceBlockByHash/trace-genesis
* debug_traceBlockByNumber/trace-genesis1 parent 66197f5 commit 6bee208
3 files changed
Lines changed: 43 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
213 | 255 | | |
214 | 256 | | |
215 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
74 | 73 | | |
75 | | - | |
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
| |||
88 | 86 | | |
89 | 87 | | |
90 | 88 | | |
91 | | - | |
92 | 89 | | |
93 | 90 | | |
94 | 91 | | |
| |||
290 | 287 | | |
291 | 288 | | |
292 | 289 | | |
293 | | - | |
294 | 290 | | |
295 | 291 | | |
296 | 292 | | |
| |||
319 | 315 | | |
320 | 316 | | |
321 | 317 | | |
322 | | - | |
323 | 318 | | |
324 | 319 | | |
325 | 320 | | |
326 | 321 | | |
327 | | - | |
328 | 322 | | |
329 | 323 | | |
330 | 324 | | |
| |||
511 | 505 | | |
512 | 506 | | |
513 | 507 | | |
514 | | - | |
515 | 508 | | |
516 | 509 | | |
517 | 510 | | |
| |||
522 | 515 | | |
523 | 516 | | |
524 | 517 | | |
525 | | - | |
526 | 518 | | |
527 | 519 | | |
528 | 520 | | |
| |||
544 | 536 | | |
545 | 537 | | |
546 | 538 | | |
547 | | - | |
548 | 539 | | |
549 | 540 | | |
550 | 541 | | |
| |||
0 commit comments