When I was reading the code, I noticed that
The brackets are redundant in __txn_fixup_prepared_update
else {
WT_ERR(hs_cursor->remove(hs_cursor));
}
and it should be remove instead of insert in curhs_remove function:
CURSOR_API_CALL_PREPARE_ALLOWED(cursor, session, insert, CUR2BT(file_cursor));