Also, can you describe the problem? It sounds interesting.
The UI had options to check some categories and exclude others, this was mapped to sql with a nested query IN (…) and not in (…). I noticed that there were less than 64 categories and always will be so I figured pack the category membership into a 64bit ints and use bitwise operations. The UI query generation would map to use bitmasks instead. They didn’t even let me implement it, just agreed that it would work and took it from there. I think they were quite embarrassed by it. It ended up being 10K faster.
If they were ready to have you on for 6 months, You'd still probably be one of the most honest contractors if you stretched that out to a week, or even month. It's a shame honestly isn't always rewarded proportionately to suggesting an entire rework of their infrastructure.
Don't waste your time and clients money on pretending to do work that you don't. Its ethically wrong (maybe even criminal) and it sounds like you would be bored to death wasting your talent.
Don't blame the company for not wasting its money either. It did pay for the whole day and gave you good recommendations.
You could do fixed price. Or split the difference (on both sides of the estimate), which provides good incentives for both parties.
The hardest part of getting into contracting was the guilt of feeling "I'm charging too much for a simple fix!". If the fix was so simple and the client didn't find it in those six months then maybe your assumption that the fix was simple and obvious was incorrect. Regardless, your fix provided value, and you should be compensated for the value that you provided, not just the number of hours worked.