diff --git a/CHANGELOG.md b/CHANGELOG.md index 15f2b9c..51e8281 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. The format ## Table of Contents +- [1.1.10 - 2024-10-18](#119---2024-10-18) - [1.1.9 - 2024-10-01](#118---2024-10-01) - [1.1.8 - 2024-09-17](#118---2024-09-17) - [1.1.7 - 2024-09-10](#117---2024-09-10) @@ -16,6 +17,23 @@ All notable changes to this project will be documented in this file. The format - [1.1.0 - 2024-08-19](#110---2024-08-19) - [1.0.0 - 2024-06-06](#100---2024-06-06) +## [1.1.10] - 2024-10-18 + Big thanks for contributions from @wregulski and @siggi + + ### Changed + - `pubKey.ToDER()` now returns bytes + - `pubKey.ToHash()` is now `pubKey.Hash()` + - `pubKey.SerializeCompressed()` is now `pubKey.Compressed()` + - `pubKey.SerializeHybrid()` is now `pubKey.Hybrid()` + + ### Added + - `publickey.ToDERHex()` returns a hex encoded public key + - `script.Chunks` helper method for `DecodeScript(scriptBytes)` + - `script.PubKey` returns a `*ec.PublicKey` + - `script.PubKeyHex` + - `script.Address` + - Example - get address and p2pkh pubkey from script + ## [1.1.9] - 2024-10-01 ### Changed - Updated readme diff --git a/transaction/fees.go b/transaction/fees.go index de65fde..f737547 100644 --- a/transaction/fees.go +++ b/transaction/fees.go @@ -17,6 +17,7 @@ type FeeModel interface { ComputeFee(tx *Transaction) (uint64, error) } +// Fee computes the fee for the transaction. func (tx *Transaction) Fee(f FeeModel, changeDistribution ChangeDistribution) error { fee, err := f.ComputeFee(tx) if err != nil { diff --git a/transaction/transaction.go b/transaction/transaction.go index 3188079..b68d2d3 100644 --- a/transaction/transaction.go +++ b/transaction/transaction.go @@ -443,7 +443,7 @@ func (tx *Transaction) AddMerkleProof(bump *MerklePath) error { return nil } -// Fee returns the fee of the transaction. +// Sign signs the transaction with the unlocking script. func (tx *Transaction) Sign() error { err := tx.checkFeeComputed() if err != nil { diff --git a/transaction/transaction_test.go b/transaction/transaction_test.go index 25c3151..0418bc8 100644 --- a/transaction/transaction_test.go +++ b/transaction/transaction_test.go @@ -35,6 +35,7 @@ func TestNewTransaction(t *testing.T) { // Create a new P2PKH unlocker from the private key unlocker, err := p2pkh.Unlock(priv, nil) require.NoError(t, err) + // Add an input tx.AddInputFromTx(sourceTransaction, 0, unlocker)