ledger icon indicating copy to clipboard operation
ledger copied to clipboard

Fix interaction with max and unbounded overdraft

Open Azorlogh opened this issue 2 years ago • 3 comments

Fixes https://github.com/formancehq/ledger/issues/473

Bug explanation: Each source is associated with an optional fallback account that is used to fund any missing amount from that source. When using the max source, it will use the OP_TAKE_MAX instruction to cap the subsource's funding. OP_TAKE_MAX returns the amount missing to max out (or 0), and the amount remaining if it was already maxed out. When the subsource has no fallback, the amount missing is simply discarded When the subsource has a fallback, the amount missing should be taken from it unconditionally to max out the funding, which should be done with the OP_TAKE_ALWAYS instruction.

Azorlogh avatar Dec 20 '23 21:12 Azorlogh

@flemzord hope this bugfix can be merged soon :)

edwardmp avatar Jan 10 '24 17:01 edwardmp

@edwardmp Yes, this PR will be merged into the v2 ledger. However, we need another fix for the v1 ledger.

flemzord avatar Jan 15 '24 15:01 flemzord

@flemzord will this still get backported to v1? Thanks

edwardmp avatar Jul 30 '24 21:07 edwardmp