Take as a premise for this question, that there does exist some process by which you can get a bank to confirm that a transfer is completely valid and irreversible. See here for any discussion of that premise.
There are countless examples of the overpayment scam on this StackExchange. Whereby the victim believes that they've been sent money and is asked to send some of it elsewhere, and then the original payment is cancelled, or reversed, or found to be fraudulent.
So, suppose that a scammer contacted you, sent you money (spontaneously - you didn't ask them to, nor agree to send it on anywhere), and you did the above process so that you now definitely have that money and it's safe and isn't going away anywhere.
Are there any reasons not to keep and use that money for yourself?
As far as you are concerned, you haven't been involved in fraud. "Some random person sending me money" isn't fraud; it's foolishness or ridiculous generosity.
If the sender "earnt" that money fraudulently, then that's none of your concern. A shopkeeper can still keep his profits from selling a newspaper to a mobster, even if that mobster's money is made illegally.