Sorry for the headache you have had to deal with. To share my story, I've got a 2008 LTZ Avalanche with a 6.0L motor, 106k that was weeks away from trade-in. Slowly I started to notice a similar "hammering sound", which progressively got worse in about a week's time before I brought it in the dealer.
They also initially suggested a motor replacement, but after pulling the motor out they discovered a lifter had gone bad. I elected to have the motor rebuilt with new lifters and camshaft, in lieu of a replacement motor. Total cost was $4,200 and work was done in a week with a 12,000 mile/1 year warranty.
Be thankful you have that warranty and spend the extra cash on really frequent oil changes.