wallet: improve ownInput and ownOutput.