btcsuite / btcd

An alternative full node bitcoin implementation written in Go (golang)
https://github.com/btcsuite/btcd/blob/master/README.md
ISC License
6.1k stars 2.31k forks source link

wire: add method TxID to MsgTx #2055

Closed ffranr closed 3 months ago

ffranr commented 8 months ago

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 commented 8 months ago

Pull Request Test Coverage Report for Build 8419979356

Details


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

💛 - Coveralls
ffranr commented 7 months ago

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.

saubyk commented 7 months ago

@yyforyongyu for your review