Improvements to IsConfirmed

CWalletTx::IsConfirmed displays exceptionally poor performance when there are multiple unconfirmed transactions where IsFromMe() is true.

A cache of already processed transactions is sufficient to largely fix this.

This is still optimized for the common case where most dependent transactions are not IsFromMe()

As part of this change the logic has been simplified.