Skip to content

Conversation

tdroxler
Copy link
Member

@tdroxler tdroxler commented Sep 3, 2025

There is a rare edge case when querying transactions that have just been inserted, but whose inputs have not yet been updated by InputUpdateQueries. In this scenario, the API returns the transactions, but the inputs are missing output data such as address and amount. This makes it difficult for applications to process these transactions.

To address this, the API should only return transactions with complete data. For this edge case (which typically lasts around 300ms between insert and update), when querying transactions, we check if input data is complete—which is almost always the case. If not, we retrieve the corresponding output so users always receive complete transaction data.

If for some reason we can't find the output, we'll return then incomplete input.

There is a rare edge case when querying transactions that have just been inserted,
but whose inputs have not yet been updated by `InputUpdateQueries`.
In this scenario, the API returns the transactions, but the inputs are missing output data such as address and amount.
This makes it difficult for applications to process these transactions.

To address this, the API should only return transactions with complete data.
For this edge case (which typically lasts around 300ms between insert and update),
when querying transactions, we check if input data is complete—which is almost always the case.
If not, we retrieve the corresponding output so users always receive complete transaction data.

If for some reason we can't find the output, we'll return then
incomplete input.
@tdroxler tdroxler requested a review from h0ngcha0 September 3, 2025 13:07
outputRefAmount = Some(output.amount),
outputRefTokens = output.tokens
)
case None => input
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Is it possible that we end up in this situation where input still dose not have complete data?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's very very unlikely, I don't see yet a case, but there's always that one edge case we don't see :)

* If not, we get back outputs for the missing inputs
*/
def validateInputFromTx(
input: InputsFromTxQR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Nit] Shall we call it InputFromTxQR and InputQR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes would make more sense indeed, I think the reasoning was: Query Response of Inputs table, but as the type represent only 1 input, it would be better

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@h0ngcha0 I also renamed some other types not used here

Copy link
Member

@h0ngcha0 h0ngcha0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@tdroxler tdroxler merged commit ffcb9fd into master Sep 9, 2025
2 checks passed
@tdroxler tdroxler deleted the fully-confirmed-transactions branch September 9, 2025 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants