move pending accounts logic into wallet.py