Fix giving and receiving amounts

Fixes #1127, and a few other bugs (including the 4th item of #2630).
So this is checking that `update_cached_amounts` doesn't modify anything it's not supposed to? I would expect this test to check whether `update_cached_amounts` updates cached amounts. :-)