You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: use self-JOIN on tokens table for redeemed token queries
ListRedeemedTokens and RedeemedBalance previously JOINed with the
transactions table to identify tokens spent by a Redeem action. However,
the issuer node does not have entries in the transactions table for
redeem transactions initiated by other nodes, because StoreTransactionRecords
is only called by view initiators/responders and the issuer is not in the
redeem distribution list.
Instead, identify redeemed tokens by LEFT JOINing the tokens table with
itself: a redeemed token (issuer=true, is_deleted=true) has a spent_by
tx_id that has NO output tokens in the tokens table (Parse() skips redeem
outputs with empty owner), whereas a transferred token's spent_by tx_id
DOES have output tokens.
This fixes all 8 failing CI integration tests that were panicking with
'close of closed channel' due to the view assertion failure when
CheckRedeemedBalance returned 0 instead of the expected value.
Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
0 commit comments