Commit 745996b
[release-v2.1] spv: Validate merkle root for all fetched blocks
Blocks are now always fetched from SPV peers through a single
blocksFromPeer helper, which checks the transaction trees against the
merkle root commitments in the header and disconnects the peer when they
do not match.
This not only removes duplication but also adds the merkle root check to
two call sites which were previously missing it (cacheMissingCommitments
in discovery.go and handleBlockInvs in sync.go).
Backport of 2c37f24.1 parent a46848a commit 745996b
2 files changed
Lines changed: 37 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
63 | 94 | | |
64 | 95 | | |
65 | 96 | | |
| |||
70 | 101 | | |
71 | 102 | | |
72 | 103 | | |
73 | | - | |
| 104 | + | |
74 | 105 | | |
75 | 106 | | |
76 | 107 | | |
| |||
556 | 587 | | |
557 | 588 | | |
558 | 589 | | |
559 | | - | |
| 590 | + | |
560 | 591 | | |
561 | 592 | | |
562 | 593 | | |
563 | 594 | | |
564 | 595 | | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | 596 | | |
586 | 597 | | |
587 | 598 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1069 | 1069 | | |
1070 | 1070 | | |
1071 | 1071 | | |
1072 | | - | |
| 1072 | + | |
1073 | 1073 | | |
1074 | 1074 | | |
1075 | 1075 | | |
1076 | 1076 | | |
| 1077 | + | |
1077 | 1078 | | |
1078 | 1079 | | |
1079 | 1080 | | |
| |||
1348 | 1349 | | |
1349 | 1350 | | |
1350 | 1351 | | |
1351 | | - | |
| 1352 | + | |
1352 | 1353 | | |
1353 | 1354 | | |
1354 | 1355 | | |
1355 | 1356 | | |
1356 | 1357 | | |
1357 | | - | |
1358 | | - | |
1359 | | - | |
1360 | | - | |
1361 | | - | |
1362 | | - | |
1363 | | - | |
1364 | | - | |
1365 | | - | |
1366 | | - | |
1367 | | - | |
1368 | | - | |
1369 | 1358 | | |
1370 | 1359 | | |
1371 | 1360 | | |
| |||
0 commit comments