Total money limit test

Added bounds check by @il--ya.

Updated-by: Wladimir van der Laan <laanwj@gmail.com>
Rebased-From: 1156167