[GNC-dev] Account > Auto-Clear

Christopher Lam christopher.lck at gmail.com
Sun Oct 11 09:32:04 EDT 2020

Dear Devel,

After using GnuCash for years, I've recently discovered the interesting
Account Auto-clear facility. Consider a well-used bank account, with
numerous Reconciled "r" splits, and some recent Unreconciled "n" splits
whose amounts are as follows:

Reconciled Balance = 1000.00
Unreconciled amounts -10.00, 2500.00, -33.30, -45.00

The user checks the online bank statement, finds the current balance
currently $3456.70, corresponding to the first 3 splits being processed by
the bank, and the last transaction pending. Auto-clear will accept 3456.70
and will set relevant splits to "c" cleared. But It cannot handle the
following scenarios:
1) number of uncleared splits too high -- due to NP-hard problem, I find
the limit around 20 uncleared splits
2) more than 1 possible solution eg.
Reconciled balance 1000.00
Unreconciled amounts -10.00, 2500.00, -33.30, -10.00, -45.00

If auto-clear balance is 3456.70, there are now TWO possibilities
corresponding to the two distinct -10.00 splits. It'll abort. If auto-clear
balance is 3500.00 then it will succeed because there's only one solution
(the 2500.00 split).

I have a pending PR to optimize this functions, as well as plug some memory
leaks at https://github.com/Gnucash/gnucash/pull/797; I'll push to my beta
branch and hopefully some beta-testers will confirm that the function still
works well.

Beta testers may use my PR or the flatpak build from today onwards:


More information about the gnucash-devel mailing list