If it was me, if I had enough work I would walk away
If I needed the work, I wouldn't want my pay tied up in a bond for however long as I am struggling a bit anyway and I would do exactly what you are doing, some pay now, some pay at the completion of the project based on quantifiable tests...