It wouldn't get cancelled, it would get frozen for the duration of hostilities. Being able to transfer US treasuries is only really possible with the consent of various pieces of US banking machinery, and that consent is revokable.
For what it's worth, this is the fate of whatever treasury debt the sanctioned Iranian regime owns. Really hasn't been all that much of a problem in terms of causing dollar flight.
You're getting over-excited. The US has a vested economic interest in China that despite rhetoric, it cannot extract itself from immediately, maybe not even in ten years. It doesn't have that entanglement in Iran. Trying to crash China's economy is in shooting-own-foot territory, and trying to do it by reneging on Treasury securities that are a part of complex financial transactions (they might be lent out, have you thought of that?) must be the dumbest way of all.
For what it's worth, this is the fate of whatever treasury debt the sanctioned Iranian regime owns. Really hasn't been all that much of a problem in terms of causing dollar flight.