Context
Two-phase transfers in TigerBeetle are done by first creating a "pending" transfer, then a new, subsequent void-ing or post-ing transfer. This is different than what we do in the PSQL accounting, where we just update the state of the original PENDING transfer to either POSTED or VOIDED.
While this does not cause any differences functionally, this difference is visible in our AccountingTransfers Admin API: whenever we are looking up transfers for an account (e.g. outgoing payment) with TB as the ledger, we will get two transfers (one PENDING and one POSTED or VOIDED), but if we do the same query with PSQL as the ledger, we will just see a single POSTED transfer. (We actually filter out VOIDED transfers in our PSQL query).
We should standardize the behaviour of this query, so you get back the same results no matter which accounting ledger is used.
This requires a few changes:
Todos
Context
Two-phase transfers in TigerBeetle are done by first creating a "pending" transfer, then a new, subsequent void-ing or post-ing transfer. This is different than what we do in the PSQL accounting, where we just update the state of the original PENDING transfer to either POSTED or VOIDED.
While this does not cause any differences functionally, this difference is visible in our
AccountingTransfersAdmin API: whenever we are looking up transfers for an account (e.g. outgoing payment) with TB as the ledger, we will get two transfers (one PENDING and one POSTED or VOIDED), but if we do the same query with PSQL as the ledger, we will just see a single POSTED transfer. (We actually filter out VOIDED transfers in our PSQL query).We should standardize the behaviour of this query, so you get back the same results no matter which accounting ledger is used.
This requires a few changes:
Todos
pending_idflag to find transfers which POSTED or VOIDED the initial transfer)getAccountTransfersEXPIREDenum value to theLedgerTransferStateinbackend/src/accounting/service.ts, do the correct mapping to this enum for TB & PSQL transfers (EXPIREDtransfers are pending transfers with an expiry date in the past)