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

add CTID field in the tx command request #672

Merged
merged 11 commits into from
Feb 12, 2024
Merged

Conversation

ckeshava
Copy link
Collaborator

@ckeshava ckeshava commented Jan 11, 2024

High Level Overview of Change

This PR incorporates the CTID update (XLS-37d) in the Python wrapper library.

Context of Change

Based on a cursory read of the CTID PR (https://github.com/XRPLF/rippled/pull/4418/files), I believe the tx request accepts a new parameter titled "ctid". This has been incorporated into the Python Request wrapper class.

I couldn't identify any other commands that might have been impacted by the CTID feature.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

Did you update CHANGELOG.md?

  • Yes
  • No, this change does not impact library users

Test Plan

This PR adds a unit test file for the tx request. Three combinations of the ctid and transaction inputs have been verified.

@ckeshava ckeshava requested a review from JST5000 January 11, 2024 21:40
xrpl/models/requests/tx.py Outdated Show resolved Hide resolved
Comment on lines 41 to 44
present_items = [
item for item in [self.transaction, self.ctid] if item is not None
]
return len(present_items) == 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of list comprehension here, you can use filter to remove items which don't pass a test. If you're just trying to remove falsey values like None bool is a good enough function. (https://www.geeksforgeeks.org/remove-falsy-values-from-a-list-in-python/)

Explanation of truthy / falsey values in python: truthy

And last note, for readability I'd just recommend pulling the array [self.transaction, self.ctid] into a separate variable as there's already a lot going on in the one-liner, and that'll allow you to label why those two variables are being grouped. Ex. unique_ids = [self.transaction, self.ctid]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

okay, fixed in ce890c0

@ckeshava
Copy link
Collaborator Author

can I merge this PR? I have addressed the residual comments

@ckeshava ckeshava changed the title fix DGE-2049: add CTID field in the tx command request add CTID field in the tx command request Feb 1, 2024
@ckeshava ckeshava merged commit 6f484c6 into XRPLF:main Feb 12, 2024
18 checks passed
@mvadari mvadari mentioned this pull request Sep 17, 2024
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.

4 participants