Why do pruned nodes obtain (segregated) witness knowledge throughout IBD if a lot of that knowledge is marked as Assumevalid?
Good query, most likely as a result of no one carried out it. Actually, I had by no means thought of this risk.
These nodes appear to be downloading witness knowledge simply to prune it. Since we already know that such witnesses are legitimate, and we plan to discard all historic knowledge however latest blocks, why not skip downloading previous witnesses? It appears pointless to obtain witness knowledge on this case.
You are proper.
We will not simply typically drop downloading witness knowledge in full nodes, as a result of NODE_NETWORK + NODE_WITNESS promise to different nodes the supply of all historic block and witness knowledge.
However within the case of pruned nodes, the witness knowledge that’s each (a) earlier than the assumevalid level and (b) sufficiently buried to be previous the prune level, there’s certainly little to realize from having it, as the info shall be deleted quickly.
One tiny change this means is that not downloading the witness knowledge implies the witness knowledge can’t be validated in any respect, whereas assumevalid at present in Bitcoin Core solely skips script validation. However there are different guidelines that contain witness knowledge, resembling useful resource limits and the rule that no witness knowledge is allowed for non-witness inputs. If we deal with assumevalid as additionally contemplating these pre-validated, that is a effective change although.
