Aloha and welcome aboard!
Before replacing the engine I'd have a reputable diesel mechanic
analyze the engine. There are oil
analysis tests that can be done and lots of minor things could be wrong that will cause the engine to be noisy and smokey.
You may just need to make a few needed repairs