appdb: fix row scan loop
appdb: fix row scan loop

Closes chain/chainprv#287.
Reviewers: da39a3ee5e6b4b0d3255bfef95601890afd80709@bobg

chain/chain,chain/chain,chain/chain,chain/chain,chain/chain,chain/chain