Anti-Transaction malleability patterns
Use two tables for deposits basically.

insert deposits into one table with a unique hash. store sighash and txid with a unique hash and timestamp in the other. when the txid changes, you update the second table, preventing the duplicate deposit.