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

wire: add method TxID to MsgTx #2055

Merged
merged 1 commit into from
Mar 25, 2024
Merged

Conversation

ffranr
Copy link
Contributor

@ffranr ffranr commented Nov 6, 2023

This commit adds a method to MsgTx called TxID. This method returns the transaction ID (txid) of the subject transaction. This commit also adds a function for deriving the transaction ID from the double hash of the transaction.

@coveralls
Copy link

coveralls commented Nov 6, 2023

Pull Request Test Coverage Report for Build 8419979356

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 56.862%

Totals Coverage Status
Change from base Build 8334044258: 0.006%
Covered Lines: 29421
Relevant Lines: 51741

💛 - Coveralls

@ffranr
Copy link
Contributor Author

ffranr commented Nov 7, 2023

I am aware of chainhash.Hash.String(), but I still think this PR is a good idea.

This PR makes it clear what txid is in relation to MsgTx. It isn't clear that chainhash.Hash.String() is txid. And it isn't necessarily always txid because chainhash.Hash doesn't have to be a double sha256.

Copy link
Collaborator

@kcalvinalvin kcalvinalvin left a comment

Choose a reason for hiding this comment

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

I think it's ok to have a method that returns a string directly.

But there's no need for all this code to do so.

wire/msgtx.go Outdated Show resolved Hide resolved
wire/msgtx.go Outdated Show resolved Hide resolved
@saubyk
Copy link

saubyk commented Nov 28, 2023

@yyforyongyu for your review

wire/msgtx_test.go Outdated Show resolved Hide resolved
wire/msgtx_test.go Outdated Show resolved Hide resolved
This commit adds a method to MsgTx called TxID. This method returns the
transaction ID (txid) of the subject transaction.
@guggero guggero merged commit e39d2eb into btcsuite:master Mar 25, 2024
3 checks passed
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.

6 participants