Fix a long-standing bug which could cause events pulled over federation to be incorrectly rejected.