Use generic function to get sources

Currently, there is two different functions to determine pubkey’s amount for tx commands.

Edited by Moul