golemfactory/yagna

Allocation available amount should decrease when accepting DebitNotes

johny-b opened this issue · 2 comments

Now: Allocation for X GLM can be used for accepting as many debit notes as we want, as long as every single DebitNote has total_amount_due below X.

Expected behavior: Allocation for X GLM can be used only for accepting debit notes with sum below X.

E.g. Let's say I have allocation for 1 GLM, 3 separate agreements and receive 3 debit notes for 0.4 GLM each. Now I can accept them all, and I should be able to accept only two of them.

Caveats:

  1. Accepting invoices works correctly (i.e. decreases the available allocation amount)
  2. Simple solution "just sum all debit note amounts" is not correct - debit notes with the same activity_id should not be added. E.g. I should be able to accept two debit notes for 0.4 and 0.8 with single allocation for 1 GLM, as long as debit notes are for the same activity.

@johny-b can you please make it more clear if only a single debit note is accepted above the limit (like in the example) OR any number of debit notes are accepted if the note is below the allocation (unlimited overspend)?

@johny-b can you please make it more clear if only a single debit note is accepted above the limit (like in the example) OR any number of debit notes are accepted if the note is below the allocation (unlimited overspend)?

I'm almost certain that any number of debit notes is accepted.