What is the function of LOCK(cs_main)?
LOCK(cs_main) causes the thread to stop execution until a lock can be obtained on cs_main. cs_main is an object representing a type/class/scope of lock. Once the lock is obtained, it lasts until the end of the LOCK statement's scope. (The LOCK macro creates an object on the stack, the destruction of which releases the lock.)

cs_main is already locked in that place, and LOCK uses recursive locks, so your LOCK doesn't do anything.