What happens if segwit node receives blocks from legacy node? Scenario: segwit node receives all blocks from legacy node without segwit support, eg using --connect parameter.

The legacy node stores/forwards max 1Mb blocks, so the extra segwit data logically could not be transferred to the segwit node.


how will the segwit node view segwit transactions?   Will it see them as anyonecanspend, like the legacy node?


Sometime later, the segwit node is allowed to connect to the main network.


What will the segwit node do?  Will it download blocks for which it is missing segwit data?   Or will it just have a "wrong" view of the blockchain?


If the latter, isn't that a problem?
SegWit nodes simply won't download blocks from non-SegWit peers. Preferential peering tries to make sure outgoing connections go to other SegWit peers, but even if not, downloading of blocks only happens from compatible peers.

If we receive a block from a peer which claims to be SegWit compatible, but it lacks witnesses, it will be treated as if the block were invalid, and the peer who gave it will be banned and/or disconnected.