Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

feat: retry policy of unconfirmed transaction from stream #304

Merged
merged 53 commits into from
Sep 28, 2021

Conversation

Alex-Werner
Copy link
Contributor

@Alex-Werner Alex-Werner commented Sep 1, 2021

Issue being fixed or feature implemented

Built on top of #295, this PR aim to fix #220 and #295 remaining bit.
When a transaction is being fetched but is not included in a block, Wallet-lib is not able to fetch it's corresponding blockHeader.
This PR adds a retry policy on the transaction stream such that for each unconfirmed transaction received, it will wait for next blockheight change to retry fetching the transaction in order to wait for its inclusion in a block and therefore correctly identity its metadata.

What was done?

  • feat: retry to fetch a unconfirmed transaction at next block
  • feat: allow transactionMetadata to be replaced on import transaction
  • feat: retry at next block to fetch transaction on getTransaction of unconfirmed tx

How Has This Been Tested?

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Will help for testing and managing properly
@lgtm-com
Copy link

lgtm-com bot commented Sep 1, 2021

This pull request fixes 1 alert when merging 5626d14 into c729801 - view on LGTM.com

fixed alerts:

  • 1 for Superfluous trailing arguments

@lgtm-com
Copy link

lgtm-com bot commented Sep 1, 2021

This pull request fixes 1 alert when merging 43d16a3 into c729801 - view on LGTM.com

fixed alerts:

  • 1 for Superfluous trailing arguments

@lgtm-com
Copy link

lgtm-com bot commented Sep 1, 2021

This pull request fixes 1 alert when merging 5d98212 into c729801 - view on LGTM.com

fixed alerts:

  • 1 for Superfluous trailing arguments

@Alex-Werner Alex-Werner added this to the v0.21.0 milestone Sep 1, 2021
@Alex-Werner Alex-Werner marked this pull request as ready for review September 1, 2021 21:48
@Alex-Werner Alex-Werner requested a review from shumkov September 28, 2021 12:32
Copy link
Member

@shumkov shumkov left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@Alex-Werner Alex-Werner merged commit d59cd1d into v0.21-dev Sep 28, 2021
@Alex-Werner Alex-Werner deleted the feat/delayed-fetch-tx branch September 28, 2021 14:09
shumkov added a commit that referenced this pull request Sep 29, 2021
shuplenkov pushed a commit that referenced this pull request Oct 25, 2021
* feat: added TransactionMetadataNotInStore error

* feat(Storage): added TransactionMetadata import and store

* fix(Account): getTransaction to ensure tx before adding it

* feat(DAPIClientTransport)!: getTransaction return transaction and meta

* feat(Storage): addedd getTransactionMetadata & searchTransactionMetadata

* feat: allow transaction with metadata to be stored in bulk

* feat(Account)!: getTransaction returns metadata when able

* feat(TransactionSyncStreamWorker): sync transaction with metadata

* fix: merge conflict artifact

* fix: getTransaction correctly add metadata if not in store

* test: updated tests

* fix: disable promise executor as need async

* doc: updated documentation & ts specs

* test: update integration test

* feat: implements extendTransactionsWithMetadata utils

* feat: implements categorizeTransactions utils

* feat: implements filterTransactions util method

* feat: move utils to single file

Will help for testing and managing properly

* feat: ensure we retrieve the tx inclusion blockheader too

* feat(account): re-enable and clean-up getTransactionHistory

* doc: describe getTransactionHistory returned types

* test: provide utils coverage

* feat: categorizedTransaction added from & to props

* test(filterTransactions): added test

* test(extendTx): added tests

* feat: categorizeTransaction to classify otherAccountAddresses

* feat: categorizeTransactions tests + correct type categorization

* feat: getTransactionHistory to return expected output

* docs: provide documentation

* fix: only import blockHeader when existing

* feat: provide filter for misc address

* feat: provide classifyAddresses for privatekey based account

* doc: updated TransactionHistory types

* test: fix transaction hash

* test: fixed utils tests

* feat: calculateTransactionFees warning on missing input's output

* fix: syncing not waiting for last transaction response

* test: provide getTransactionHistory tests

* doc: fix lint

* test: fix wrong hash in getTx

* test: update test with correct block hash

* fix: searchTransactionMetadata is not a function (#303)

* feat(subscribeToBlocks): announce blockheight

* feat: add retry policy for unconfirmed transaction from stream

* feat: use blockheight instead of setTimeout

* feat: retry fetching transaction at next lock if unconfirmed

* feat(importTransaction): replace previous metadata on import

* doc: added event and plugin accessing listener doc

* fix: import transaction handling on height is zero

* style: update from review

Co-authored-by: Konstantin Shuplenkov <konstantin.shuplenkov@dash.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

getTransaction throws INVALID_ARGUMENT: hash or height is not specified
2 participants