Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: check recent confirmed utxos to void missing pending xudt #180

Conversation

ahonn
Copy link
Collaborator

@ahonn ahonn commented Jun 19, 2024

  • send xudt to an empty account
  • When a btc transaction is pending, get_balance can obtain xudt information.
  • After the btc transaction is confirmed, get_balance obtains an array of xudt [];
  • The data can only be queried after the ckb transaction is processed.

Get the confirmed txid within the last 20 minutes to avoid missing xUDT where the BTC transaction has been confirmed but the CKB transaction is still pending

Copy link

vercel bot commented Jun 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
btc-assets-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2024 6:21am

@ahonn ahonn requested review from Flouse, ShookLyngs and Dawn-githup and removed request for Flouse June 19, 2024 06:18
@ahonn ahonn force-pushed the 166-when-the-ckb-transaction-is-pending-querying-the-get_balance-api-returns branch from 735ffb9 to 424f191 Compare June 19, 2024 06:20
(utxo) =>
!utxo.status.confirmed ||
// include utxo that confirmed in 20 minutes to avoid missing pending xudt
(utxo.status.block_time && Date.now() / 1000 - utxo.status.block_time < 20 * 60),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to identify RGBPP UTXOs with the pending jobs in the queue?

Copy link
Collaborator Author

@ahonn ahonn Jun 19, 2024

Choose a reason for hiding this comment

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

Yes, that's another way to accomplish this, but the transaction queue may contain many pending jobs. We need to retrieve transaction details using the pending jobs' txid to determine if the transaction belongs to the current address.

Also, the number of pending jobs might exceed the number of transactions that have occurred within the last 20 minutes by the current address.

The issue here is that we cannot obtain the pending amount between the BTC transaction being confirmed and the CKB transaction being confirmed. Therefore, I believe it is sufficient to obtain the confirmed BTC transactions 20 minutes before the current time would work and have minimal modification.

@Flouse Flouse added the enhancement New feature or request label Jun 19, 2024
@ahonn ahonn requested a review from ShookLyngs June 20, 2024 07:24
@ahonn ahonn merged commit 242d9a2 into develop Jun 21, 2024
4 checks passed
@ahonn ahonn deleted the 166-when-the-ckb-transaction-is-pending-querying-the-get_balance-api-returns branch June 21, 2024 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When the ckb transaction is pending, querying the get_balance api returns [ ]
4 participants