Locking fix for AlreadyHave()

Access to mapTransactions[] must be guarded by cs_mapTransactions lock.

Also, reformat long lines to make the switch statement more readable.