Commit 173ab0c
committed
Merge bitcoin#29720: rpc: Avoid getchaintxstats invalid results
2342b46 test: Add coverage for getchaintxstats in assumeutxo context (Fabian Jahr)
faf2a67 rpc: Reorder getchaintxstats output (MarcoFalke)
fa2dada rpc: Avoid getchaintxstats invalid results (MarcoFalke)
Pull request description:
The `getchaintxstats` RPC reply during AU background download may return non-zero, but invalid, values for `window_tx_count` and `txrate`.
For example, `txcount` may be zero for a to-be-downloaded block, but may be non-zero for an ancestor block which is already downloaded. Thus, the values returned may be negative (and cause intermediate integer sanitizer violations).
Also, `txcount` may be accurate for the snapshot base block, or a descendant of it. However it may be zero for an ancestor block that still needs to be downloaded. Thus, the values returned may be positive, but wrong.
Fix all issues by skipping the returned value if either `txcount` is unset (equal to zero).
Also, skip `txcount` in the returned value, if it is unset (equal to zero).
Fixes bitcoin#29328
ACKs for top commit:
fjahr:
re-ACK 2342b46
achow101:
ACK 2342b46
mzumsande:
ACK 2342b46
Tree-SHA512: 931cecc40ee5dc0f96be728db7eb297155f8343076cd29c8b8c050c99fd1d568b80f54c9459a34ca7a9489c2474c729796d00eeb1934d6a9f7b4d6a53e3ec430File tree
3 files changed
+38
-13
lines changed- src/rpc
- test
- functional
- sanitizer_suppressions
3 files changed
+38
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1643 | 1643 | | |
1644 | 1644 | | |
1645 | 1645 | | |
1646 | | - | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
1647 | 1649 | | |
1648 | 1650 | | |
1649 | 1651 | | |
1650 | | - | |
1651 | 1652 | | |
1652 | | - | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
1653 | 1659 | | |
1654 | 1660 | | |
1655 | 1661 | | |
| |||
1690 | 1696 | | |
1691 | 1697 | | |
1692 | 1698 | | |
1693 | | - | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
1694 | 1702 | | |
1695 | 1703 | | |
1696 | 1704 | | |
1697 | | - | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
1698 | 1708 | | |
1699 | 1709 | | |
1700 | 1710 | | |
1701 | 1711 | | |
1702 | | - | |
1703 | 1712 | | |
1704 | | - | |
1705 | | - | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
1706 | 1718 | | |
1707 | 1719 | | |
1708 | 1720 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
315 | 316 | | |
316 | 317 | | |
317 | 318 | | |
318 | | - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
319 | 324 | | |
320 | 325 | | |
321 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
322 | 331 | | |
323 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
324 | 338 | | |
325 | 339 | | |
| 340 | + | |
326 | 341 | | |
327 | 342 | | |
328 | | - | |
| 343 | + | |
329 | 344 | | |
330 | 345 | | |
331 | 346 | | |
332 | | - | |
| 347 | + | |
333 | 348 | | |
334 | 349 | | |
335 | 350 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
| |||
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
66 | | - | |
67 | 65 | | |
68 | 66 | | |
69 | 67 | | |
| |||
0 commit comments