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(rpc): gettxchainlocks should return mempool=false when tx not in mempool #5742

Merged

Conversation

ogabrielides
Copy link
Collaborator

@ogabrielides ogabrielides commented Nov 28, 2023

Issue being fixed or feature implemented

Platform (in the scope of Withdrawals) need to be aware if a tx isn't in mempool when requesting status of a tx using RPC gettxchainlocks.
cc @markin-io

What was done?

  • mempool is passed to GetTransaction and saving the result for checking latter.
  • If the returned tx_ref is nullptr, then the RPC returns null for the corresponding tx in the array.

Example:
tx1 is mined and chainlocked, tx2 is in mempool and tx3 doesn't exist.
The result now is:
[ { "height": 830, "chainlock": false, "mempool": true }, { "height": -1, "chainlock": false, "mempool": true }, { "height": -1, "chainlock": false, "mempool": false } ]

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
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@ogabrielides ogabrielides added the RPC Some notable changes to RPC params/behaviour/descriptions label Nov 28, 2023
@ogabrielides ogabrielides added this to the 20.1 milestone Nov 28, 2023
knst
knst previously approved these changes Nov 29, 2023
Copy link
Collaborator

@knst knst left a comment

Choose a reason for hiding this comment

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

utACK

src/rpc/rawtransaction.cpp Outdated Show resolved Hide resolved
knst
knst previously approved these changes Nov 29, 2023
Copy link
Collaborator

@knst knst left a comment

Choose a reason for hiding this comment

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

utACK

UdjinM6
UdjinM6 previously approved these changes Nov 29, 2023
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK

@PastaPastaPasta PastaPastaPasta modified the milestones: 20.1, 21 Dec 4, 2023
Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

This is a breaking change and cannot be merged until v21

@PastaPastaPasta PastaPastaPasta changed the title feat(rpc): gettxchainlocks should return null when tx not in mempool feat(rpc)!: gettxchainlocks should return null when tx not in mempool Dec 19, 2023
@ogabrielides ogabrielides dismissed stale reviews from UdjinM6 and knst via 3c71b99 December 19, 2023 14:32
@ogabrielides ogabrielides changed the title feat(rpc)!: gettxchainlocks should return null when tx not in mempool feat(rpc)!: gettxchainlocks should return mempool=false when tx not in mempool Dec 19, 2023
@ogabrielides
Copy link
Collaborator Author

Updated this for backward compatibility.

@ogabrielides ogabrielides changed the title feat(rpc)!: gettxchainlocks should return mempool=false when tx not in mempool feat(rpc)!: gettxchainlocks should return mempool=false when tx not in mempool Dec 19, 2023
@ogabrielides ogabrielides changed the title feat(rpc)!: gettxchainlocks should return mempool=false when tx not in mempool feat(rpc): gettxchainlocks should return mempool=false when tx not in mempool Dec 19, 2023
@UdjinM6 UdjinM6 force-pushed the rpc_gettxchainlocks_changes branch from 3c71b99 to fdfa815 Compare December 19, 2023 22:56
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

Help text (description and RPCResult) should be updated accordingly

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

Needs release notes; otherwise looks good :)

@ogabrielides
Copy link
Collaborator Author

Applied suggestions + added func test case for mempool=true.

knst
knst previously approved these changes Dec 22, 2023
Copy link
Collaborator

@knst knst left a comment

Choose a reason for hiding this comment

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

utACK

src/rpc/rawtransaction.cpp Outdated Show resolved Hide resolved
src/rpc/rawtransaction.cpp Outdated Show resolved Hide resolved
src/rpc/rawtransaction.cpp Outdated Show resolved Hide resolved
src/rpc/rawtransaction.cpp Outdated Show resolved Hide resolved
src/rpc/rawtransaction.cpp Outdated Show resolved Hide resolved
knst
knst previously approved these changes Dec 22, 2023
Copy link
Collaborator

@knst knst left a comment

Choose a reason for hiding this comment

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

LGTM

UdjinM6
UdjinM6 previously approved these changes Dec 22, 2023
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK

@ogabrielides ogabrielides dismissed stale reviews from UdjinM6 and knst via 21b6326 December 22, 2023 16:28
@ogabrielides
Copy link
Collaborator Author

Fixed CI.
For some reasons, self.sync_mempools() is failing. Made the test simpler for now.

@ogabrielides ogabrielides requested review from knst and UdjinM6 December 22, 2023 16:29
@UdjinM6
Copy link

UdjinM6 commented Dec 22, 2023

ah, right, node1 is isolated, can't use sync_mempool here 🙈 how about 7cfe181 to make it even more compact?

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK

@UdjinM6 UdjinM6 modified the milestones: 21, 20.1 Dec 24, 2023
Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

utACK for squash merge

@PastaPastaPasta PastaPastaPasta merged commit 25cef45 into dashpay:develop Dec 24, 2023
8 checks passed
@ogabrielides ogabrielides deleted the rpc_gettxchainlocks_changes branch December 24, 2023 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RPC Some notable changes to RPC params/behaviour/descriptions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants