This code looks duplicated, it's in wire_verison.c too.