No action shall be brought nor shall any action lie against the treasurer or custodian of any public funds which have been, or hereafter may be, lawfully deposited in any bank which has closed or failed, or hereafter may close or fail, for the failure to pay over such funds, or any part thereof within a period of two years after such bank has failed or closed nor shall such treasurer or custodian be liable to pay over such funds, to the proper authorities during such period unless he has received payment of all, or a part of such funds, from the officials of such closed or failed bank or from the receiver therefor or from the sale or disposition of any securities pledged for the repayment of such funds, nor shall such treasurer or custodian be liable during such period for any greater sum than the amount or amounts he has received as such treasurer or custodian in the liquidation of such bank or the sale or disposition of such securities; provided that the provisions of this Act shall not apply to any such treasurer or custodian of public funds unless each of the sureties upon the bond of such treasurer or custodian shall consent thereto in writing. Such consent shall be and shall be construed and held to be the agreement of such surety that the provisions of this Act shall not operate as a release from or affect the condition of such bond but that such bond shall continue in full force and effect.
30 ILCS 240/1