Looking at the source code, I am confused about the serialization of CTxWitness. Specifically, at https://github.com/bitcoin/bitcoin/blob/master/src/primitives/transaction.h#L258 the following lines:
for (size_t n = 0; n < vtxinwit.size(); n++) {
READWRITE(vtxinwit[n]);
}
This works fine for serialization but I see nowhere vtxinwit.resize() calls which would be necessary for deserialization. Is deserialization even possible with this implementation? How does a deserializer determine vtxinwit.size()?