Repository navigation
fix(chequebook): handle nil cumulative payout in cheque processing - #5656
Conversation
14e4538 to
5e1a669
Compare
| } | ||
|
|
||
| // LastCheque returns the last cheque we issued for the beneficiary. | ||
| func (s *service) LastCheque(beneficiary common.Address) (*SignedCheque, error) { |
There was a problem hiding this comment.
i find it dangerously confusing that this method is named the same like the chequestore one that you changed, since they are semantically different and use different keys
There was a problem hiding this comment.
Agreed, they are two different stores behind the same name.
Since the naming already exists on master I'll open a follow-up that do the update, wdyt ?
|
btw @akrem-chabchoub, i still think that the better way to handle this would be to actually implement the marshal/unmarshal JSON interface on the cheque types and while you would just call the normal json marshal/unmarshal methods, you could just do the validation inside the marshaling code, which i find to be much more in place rather than scattering checks everywhere. this should already be rejected on unmarshal from my perspective, and seals the deal with any future change - you solve things at the root this way. |
Checklist
Description
A stored cheque with a blank cumulative payout is now rejected as a broken cheque, so the settlements list does not crash on it and the next issued cheque does not start again from zero. The same check applies to cheques we sent and cheques we received.
Open API Spec Version Changes (if applicable)
Motivation and Context (Optional)
Related Issue (Optional)
Screenshots (if appropriate):
AI Disclosure