Fix UI state bug that could occur when a cloned wallet spends an output pledged by a different wallet, and add a unit test.