Commit Graph

841 Commits

Author SHA1 Message Date
Steven Roose 875545517d
Add clippy exceptions for needless_question_mark lint 2023-10-23 16:45:52 +01:00
Andrew Poelstra fe07c13bcc
Merge rust-bitcoin/rust-bitcoin#2131: encode: Implement encoding traits on Vec<BlockHeader>
10c1f7b9c6 encode: Implement encoding traits on Vec<BlockHeader> (Steven Roose)

Pull request description:

ACKs for top commit:
  clarkmoody:
    ACK 10c1f7b9c6
  apoelstra:
    ACK 10c1f7b9c6
  vincenzopalazzo:
    ACK 10c1f7b9c6

Tree-SHA512: 32182f4b18a2e4aee20efc4c649827be4e2f61991fae48d7e1360e2c8224bcd98ef89391b50ec2d4e12a720daf7350ca0beb23094153313b668a54cee9cda278
2023-10-19 15:38:54 +00:00
Andrew Poelstra 3a95365f46
Merge rust-bitcoin/rust-bitcoin#2124: Tracking PR for `v0.31.0-rc2` release
38960ab5a5 Bump version to 0.31.0-rc2 (Tobin C. Harding)
79dfe8d270 justfile: Add update-lock-files command (Tobin C. Harding)
178069c13e Add changelog entries for v0.31.0 (Tobin C. Harding)

Pull request description:

  Prepare for the v0.31.0-rc2 release.

  - Add changlog entries
  - Add a `just update-lock-files` command
  - Bump the version ready for next RC release

ACKs for top commit:
  apoelstra:
    ACK 38960ab5a5
  clarkmoody:
    ACK 38960ab5a5

Tree-SHA512: d2d459666117992689ea2bde2ba4a5d9a9cd36a85c5f0df443ceca3bf9d4ec351baffb4be09fbe25bf0767145d11a59b97031e7c8f9182fa9348a6883420b8fe
2023-10-19 13:32:03 +00:00
Steven Roose 10c1f7b9c6
encode: Implement encoding traits on Vec<BlockHeader> 2023-10-18 23:34:56 +01:00
Tobin C. Harding 38960ab5a5
Bump version to 0.31.0-rc2
In preparation for doing the next RC release bump the version.
2023-10-18 13:52:49 +11:00
Tobin C. Harding 178069c13e
Add changelog entries for v0.31.0
Add the remaining changelog entries for the v0.31.0 release. Includes
everything released in v0.31.0-rc1
2023-10-18 13:46:42 +11:00
Andrew Poelstra 37daf4620c
Merge rust-bitcoin/rust-bitcoin#2126: Implement manual fmt::Debug for BlockHeader to include block hash
b108ffa2ec Implement manual fmt::Debug for BlockHeader to include block hash (Steven Roose)

Pull request description:

  I think it makes sense for a block header to have the block hash shown in the debug print.

ACKs for top commit:
  tcharding:
    ACK b108ffa2ec
  vincenzopalazzo:
    ACK b108ffa2ec
  apoelstra:
    ACK b108ffa2ec

Tree-SHA512: 37b77f8b2d8da3903bc5ff329abd45dcb5f189ba2ac38fc309fa477b0eb569b01dd85c41f160e073bb56b4a599b7c4774fbfbd8da4b82ddb41540d60bfeafea3
2023-10-17 23:41:07 +00:00
Steven Roose b108ffa2ec
Implement manual fmt::Debug for BlockHeader to include block hash 2023-10-17 02:00:42 +01:00
Tobin C. Harding 6731e85dc1
bitcoin: Bump version to 0.31.0-rc1
In preparation for the first rc release; bump the version number.
2023-10-13 08:34:46 +11:00
Andrew Poelstra e0ddead255
Merge rust-bitcoin/rust-bitcoin#2107: Use `Target` as type for `pow_limit`
38005f6aa7 Use Target for pow_limit (Tobin C. Harding)

Pull request description:

  The `Params::pow_limit` field is currently a `Work` type, this is incorrect. The proof of work limit is the highest _target_ not the lowest work (even though these have a relationship).

  Note that we use the highest _attainable_ target, this differs from Bitcoin Core and the reasoning is already documented in the code.

  Add new consts and document where they came from as well as how they differ to Core.

  Use the new consts in the various network specific `Params` types.

  Fix: #2106

ACKs for top commit:
  junderw:
    ACK 38005f6aa7
  apoelstra:
    ACK 38005f6aa7

Tree-SHA512: 5e71f69cdd555fd95a52fc1479e27b5e11226772f6432758c1364107a068bd1271486da6db1ece694da0287ce10cfbc18d28d6e3dbb0b9d387ff968eea43ab18
2023-10-12 15:05:51 +00:00
Tobin C. Harding 38005f6aa7
Use Target for pow_limit
The `Params::pow_limit` field is currently a `Work` type, this is
incorrect. The proof of work limit is the highest _target_ not the
lowest work (even though these have a relationship).

Note that we use the highest _attainable_ target, this differs from
Bitcoin Core and the reasoning is already documented in the code.

Add new consts and document where they came from as well as how they
differ to Core.

Use the new consts in the various network specific `Params` types.
2023-10-11 08:50:42 +11:00
Tobin C. Harding 678eee8d73
Use Message::from_digest
We have a new API function available with recent version of `secp256k1`
to create a `Message` directly from a sighash byte array.

Use `Message::from_digest(sighash.to_byte_array())` to construct
messages ready to sign.
2023-10-11 08:16:25 +11:00
Tobin C. Harding 6f30ac9d02
Upgrade the secp dependency
Upgrade the `secp256k1` dependency to the newly released `v0.28.0`.

FTR this includes two simple changes:
- Use `Message::from_digest_slice` instead of `Message::from_slice`.
- Use `secp256k1::Keypair` instead of `secp256k1::KeyPair`.
2023-10-10 10:04:31 +11:00
Tobin C. Harding 818a3c5424
Use Keypair instead of KeyPair in identifiers
In preparation for updating the secp dependency to v0.28.0, which
includes a change of `KeyPair` to `Keypair`, change our identifier usage
to indicate that "keypair" is a single word.

Deprecate the old forms.
2023-10-10 10:02:09 +11:00
Tobin C. Harding 33ee49f8e5
Update bech32 dependency
Update the `bech32` dependency to use the newly release beta version.

The main fix here is silent, a bug fix in `bech32` that was being hit by
our fuzzing suite.
2023-10-10 06:47:58 +11:00
Andrew Poelstra 342a35b4c4
Merge rust-bitcoin/rust-bitcoin#2109: ci: bump rustc to 1.60 for fuzz test
6b5d06f23e ci: fix the byteorder to 1.4.3 for edition 2018 (Vincenzo Palazzo)
98513ef151 clippy: more worning fixes (Vincenzo Palazzo)
05d3dc5d72 Remove redundant guard (Tobin C. Harding)
4537634e7e ci: bump rustc to 1.60 for fuzz test (Vincenzo Palazzo)

Pull request description:

  Ci looks like broken, so this should fix
  it

ACKs for top commit:
  apoelstra:
    ACK 6b5d06f23e

Tree-SHA512: bfa0eaf8cbc02a671237d99221db8c21264ce9df91301818c95c41dcc5ad4935e91254b0b3fa8f36738a9d71b6541fb8784ac8280d67057960a3d20e385a9f17
2023-10-07 16:40:36 +00:00
Vincenzo Palazzo 98513ef151
clippy: more worning fixes
error[E0308]: mismatched types
  --> bitcoin/src/psbt/raw.rs:87:24
   |
87 |               return Err(encode::Error::OversizedVectorAllocation {
   |  ________________________^
88 | |                 requested: key_byte_size as usize,
89 | |                 max: MAX_VEC_SIZE,
90 | |             });
   | |_____________^ expected enum `psbt::error::Error`, found enum `consensus::encode::Error`
   |
help: try wrapping the expression in `psbt::error::Error::ConsensusEncoding`
   |
87 ~             return Err(psbt::error::Error::ConsensusEncoding(encode::Error::OversizedVectorAllocation {
88 |                 requested: key_byte_size as usize,
89 |                 max: MAX_VEC_SIZE,
90 ~             }));
   |

----

  Compiling bitcoin v0.30.0 (/home/vincent/github/work/rust-btc/rust-bitcoin/bitcoin)
    Checking bitcoin-fuzz v0.0.1 (/home/vincent/github/work/rust-btc/rust-bitcoin/fuzz)
error: redundant clone
   --> bitcoin/examples/taproot-psbt.rs:453:77
    |
453 |             witness_utxo: { Some(TxOut { value, script_pubkey: script_pubkey.clone() }) },
    |                                                                             ^^^^^^^^ help: remove this
    |
    = note: `-D clippy::redundant-clone` implied by `-D warnings`
note: this value is dropped without further use
   --> bitcoin/examples/taproot-psbt.rs:453:64
    |
453 |             witness_utxo: { Some(TxOut { value, script_pubkey: script_pubkey.clone() }) },
    |                                                                ^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

error: could not compile `bitcoin` due to previous error
warning: build failed, waiting for other jobs to finish...
error: redundant clone
    --> bitcoin/src/psbt/mod.rs:1095:13
     |
1095 |             .clone()
     |             ^^^^^^^^ help: remove this
     |
     = note: `-D clippy::redundant-clone` implied by `-D warnings`
note: this value is dropped without further use
    --> bitcoin/src/psbt/mod.rs:1094:17
     |
1094 |           assert!(psbt
     |  _________________^
1095 | |             .clone()
     | |____________^
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-10-07 11:40:44 +02:00
Tobin C. Harding 05d3dc5d72 Remove redundant guard
Clippy warns: redundant guard

As suggested, remove the redundant guard.
2023-10-07 11:19:47 +02:00
Andrew Poelstra eab9f89779
Merge rust-bitcoin/rust-bitcoin#1986: Remove private hex test macro
8eff4d0385 Remove private hex test macro (Tobin C. Harding)

Pull request description:

  We have this macro in `hex-conservative` now, remove the version here.

  This patch does not change the public API and only touches test code.

ACKs for top commit:
  apoelstra:
    ACK 8eff4d0385
  clarkmoody:
    ACK 8eff4d0385

Tree-SHA512: 93a08fff778930071cd1a28c19202e4a94ca8881b2e873538de2e942b71c2cd6184ed6364c572538a8a699295a71761c6f836accaf251a15683138b71f148fab
2023-10-06 22:14:12 +00:00
Andrew Poelstra 3743f2743b
Merge rust-bitcoin/rust-bitcoin#2101: Audit error types code base wide
10374af75c Make error types uniform (Tobin C. Harding)
43d3306822 Use explicit error::Error impl instead of the default (Tobin C. Harding)
2512dbafc2 Remove impl_std_error macro (Tobin C. Harding)
6933ca4fc2 Add suffix to HiddenNodes error type (Tobin C. Harding)
2b40ea24fb Add suffix to IncompleteBuilder error type (Tobin C. Harding)
f41416a0ea Add suffix to UnknownMagic error type (Tobin C. Harding)
5658dac024 Add suffix to UnknownChainHash error type (Tobin C. Harding)
2fb71dd943 Move p2p error types to bottom of file (Tobin C. Harding)
39314ad52f Move error code to match conventional layout (Tobin C. Harding)

Pull request description:

  PR aims to achieve two things:
  - Make error code brain dead easy to read
  - Get error code closer to being ready for v1.0

  The first 8 patches are pretty basic, and are broken up into really small changes. The last patch is much bigger, it has a long git log to explain it but reviewing should not take too much brain power.

  This PR does not introduce anything new, it just applies what we have been doing recently with errors. Before v1.0.0 others will likely want to re go over all the error types. As such I believe this PR can be merged under the one ack carve-out.

  ### TODOs (future PRs)

  We have a few errors that still need splitting up:

  - Split up `merkle_tree::block::MerkleBlockError`
  - Split up `psbt::error::Error`
  - Split up `IncompleteBuilderError`

  Also, all error From's should probably have `#[inline]`, I noticed late in the process and did not have the heart to visit every error again.

ACKs for top commit:
  apoelstra:
    ACK 10374af75c
  clarkmoody:
    ACK 10374af75c

Tree-SHA512: 4f4f3533f42dc11af8e7978f3272752bb56d12a68199752ed4af0c02a46a87892b55c695b7007bc3d0bdf389493068d068e2be1780e8c3008815efec3a02eedf
2023-10-06 14:19:39 +00:00
Andrew Poelstra b549faa1ca
Merge rust-bitcoin/rust-bitcoin#2102: rand-std should enable std
a1538a42c1 rand-std should enable std (sanket1729)

Pull request description:

ACKs for top commit:
  realeinherjar:
    ACK a1538a42c1
  apoelstra:
    ACK a1538a42c1
  tcharding:
    ACK a1538a42c1

Tree-SHA512: 5a1f9b6f40bfc24bc1f9a21dce4b8d91e5f4066170096443694068788def23653759bca30a36b60016ca81ba6196b8a6b5badea0d3ce654ecfbd8981c65d53f5
2023-10-05 12:23:39 +00:00
Tobin C. Harding be8aee6968
Remove stale link 2023-10-05 15:19:33 +11:00
Tobin C. Harding 7d54cd3485
Fix typo in docs 2023-10-05 15:13:09 +11:00
sanket1729 a1538a42c1
rand-std should enable std
Users should not need to specify both.
2023-10-03 23:10:23 -07:00
Tobin C. Harding 10374af75c
Make error types uniform
On our way to v1.0.0 we are defining a standard for our error types,
this includes:

- Uses the following derives (unless not possible, usually because of `io::Error`)

  `#[derive(Debug, Clone, PartialEq, Eq)]`

- Has `non_exhaustive` unless we really know we can commit to not adding
  anything.

Furthermore, we are trying to make the codebase easy to read. Error code
is write-once-read-many (well it should be) so if we make all the error
code super uniform the users can flick to an error and quickly see what
it includes. In an effort to achieve this I have made up a style and
over recent times have change much of the error code to that new style,
this PR audits _all_ error types in the code base and enforces the
style, specifically:

- Is layed out: definition, [impl block], Display impl, error::Error impl, From impls
- `error::Error` impl matches on enum even if it returns `None` for all variants
- Display/Error impls import enum variants locally
- match uses *self and `ref e`
- error::Error variants that return `Some` come first, `None` after

Re: non_exhaustive

To make dev and review easier I have added `non_exhaustive` to _every_
error type. We can then remove it error by error as we see fit. This is
because it takes a bit of thinking to do and review where as this patch
should not take much brain power to review.
2023-10-04 15:15:52 +11:00
Tobin C. Harding 43d3306822
Use explicit error::Error impl instead of the default
In a further effort to make the code brain-dead easy to read; use an
explicit implementation of `std::error::Error` that returns `None`
instead of relying on the default trait implementation.
2023-10-04 15:15:43 +11:00
Tobin C. Harding 2512dbafc2
Remove impl_std_error macro
We would like the codebase to be optimized for readability not ease of
development, as such code that is write-once-read-many should not use
macros.

Currently we use the `impl_std_error` macro to implement
`std::error::Error` for struct error types. This makes the code harder
to read at a glance because one has to think what the macro does.

Remove the `impl_std_error` macro and write the code explicitly.
2023-10-04 15:15:34 +11:00
Tobin C. Harding 6933ca4fc2
Add suffix to HiddenNodes error type
By convention we always include the suffix "Error" on our error types.

Rename the error type `HiddenNodes` to `HiddenNodesError`.
2023-10-04 15:15:21 +11:00
Tobin C. Harding 2b40ea24fb
Add suffix to IncompleteBuilder error type
By convention we always include the suffix "Error" on our error types.

Rename the error type `IncompleteBuilder` to `IncompleteBuilderError`.
2023-10-04 15:14:45 +11:00
Tobin C. Harding f41416a0ea
Add suffix to UnknownMagic error type
By convention we always include the suffix "Error" on our error types.

Rename the error type `UnknownMagic` to `UnknownMagicError`.
2023-10-04 12:29:05 +11:00
Tobin C. Harding 5658dac024
Add suffix to UnknownChainHash error type
By convention we always include the suffix "Error" on our error types.

Rename the error type `UnknownChainHash` to `UnknownChainHashError`.
2023-10-04 12:28:05 +11:00
Tobin C. Harding 2fb71dd943
Move p2p error types to bottom of file
Move the p2p error types to the bottom of the file next to the various
impls for these types.

Code move only, no other changes.
2023-10-04 12:28:05 +11:00
Tobin C. Harding 39314ad52f
Move error code to match conventional layout
We typically layout error code as: definition, [impl block], `Display` impl,
`error::Error` impl, from imlps.

Code move only, no other changes.
2023-10-04 12:11:07 +11:00
Andrew Poelstra fcd4ad51ef
Merge rust-bitcoin/rust-bitcoin#1389: Add `PartialMerkleTree::calc_tree_height` method
752adff9d1 Add method calc_height (Tobin C. Harding)
46f5588646 Add unit test for calc_tree_width (Tobin C. Harding)

Pull request description:

  Add a private `PartialMerkleTree::calc_tree_width` function and a unit test to test it.

ACKs for top commit:
  apoelstra:
    ACK 752adff9d1
  clarkmoody:
    ACK 752adff9d1

Tree-SHA512: 9c4ad9f6ff47d8faad1c7c1e977427f1528af2712ceffd05357d0c9117b5fdb7b2783afc00a75cb19b853bfbd7b3895baa3a3563bdc496593cc9b06ce80dbbf8
2023-10-03 13:55:45 +00:00
Andrew Poelstra bd9c4125cf
Merge rust-bitcoin/rust-bitcoin#2082: example: Modify `taproot-psbt.rs` to make the use of prevouts clearer.
3b60ad5567 example: Modify `taproot-psbt.rs` to make the use of prevouts clearer. (S. Santos)

Pull request description:

  The `taroot-psbt.rs` example uses only one input, and therefore the current code may not make it clear that the number of prevout items must correspond to the number of transaction inputs, since the prevout slice is built within a loop.

  This PR aims to make this clear to any user who wants to reuse the logic from the example code.

ACKs for top commit:
  tcharding:
    ACK 3b60ad5567
  apoelstra:
    ACK 3b60ad5567

Tree-SHA512: afad63782b0e8a459de6cf69712d31fdab860c0d4cf9f3a51c3d85544a067bd50f4febc10ec4046e3a37d9ca518bbf2460c2599f1569549701c07f8a267dfd05
2023-10-01 15:12:25 +00:00
S. Santos 3b60ad5567 example: Modify `taproot-psbt.rs` to make the use of prevouts clearer. 2023-09-29 20:19:32 -03:00
Tobin C. Harding 8eff4d0385
Remove private hex test macro
We have this macro in `hex-conservative` now, remove the version here.

This patch does not change the public API and only touches test code.
2023-09-30 06:22:52 +10:00
Andrew Poelstra a0540bdb21
Merge rust-bitcoin/rust-bitcoin#2064: Feature: Psbt fee checks
dac627cc09 Feature: Psbt fee checks (junderw)

Pull request description:

  Closes #2061

  These new methods on Psbt will add checks for high fees by default. The threshold for "high fees" is currently set to 25000 sat/vbyte, which is about 20x higher than the highest next block fees seen on the "Mempool" website.

  The primary goal of this change is to prevent users of the library from accidentally sending absurd amounts of fees.

  (ie. Recently in September 2023 there was a transaction that sent an absurd amount of fees and made news in the Bitcoin world. Luckily the mining pool gave it back, but some might not be so lucky.)

  There are variants of the method that allow for users to set their own "absurd" threshold using a `FeeRate` value. And there is a method that performs no checks, and the method name is alarming enough to draw attention in a review, so at least developers will be aware of the concept.

ACKs for top commit:
  apoelstra:
    ACK dac627cc09
  tcharding:
    ACK dac627cc09

Tree-SHA512: ae0beafdb50339ba3efc44a48ba19c0aeeb0a2671eb43867c1e02b807677ce99fb6b4c47b74a9ed2999f827b3edc00a8871fa4730dd12a4cb265be99437c13db
2023-09-29 17:13:30 +00:00
junderw dac627cc09
Feature: Psbt fee checks 2023-09-28 00:11:33 -07:00
Andrew Poelstra 0de8ec5b19
Merge rust-bitcoin/rust-bitcoin#2076: Re-write the weight/size API
c34e3cc7cc Re-write size/weight API (Tobin C. Harding)
73f7fbf520 Add code comments to transaction serialization (Tobin C. Harding)
29f20c1d0b Add segwit serialization constants (Tobin C. Harding)

Pull request description:

  Audit and re-write the weight/size API for `Block` and `Transaction`. First two patches are trivial, patch 3 contains justification and explanation for this work, copied here:

  ```
      Recently we introduced a bug in the weight/size code, while
      investigating I found that our `Transaction`/`Block` weight/size APIs
      were in a total mess because:

      - The docs were stale
      - The concept of weight (weight units) and size (bytes) were mixed up

      I audited all the API functions, read some bips (141, 144) and re-wrote
      the API with the following goals:

      - Use terminology from the bips
      - Use abstractions that mirror the bips where possible
  ```

  Please note, this PR introduces panics if a sciptPubkey overflows the calculation `weight = spk.size() * 4`.

  Fix #2049

ACKs for top commit:
  apoelstra:
    ACK c34e3cc7cc
  sanket1729:
    ACK c34e3cc7cc.

Tree-SHA512: 4944f652e6e362a282a5731140a9438a82d243a4c646b4627d9046a9f9cf13c476881750d432cfbc6b5fe5de1f0c4c9c44ed4569dac4bc11b55a5db28793803c
2023-09-26 20:08:56 +00:00
Andrew Poelstra 1c29dd97ce
Merge rust-bitcoin/rust-bitcoin#2084: Add `Witness::p2wpkh` constructor
5901d35095 Add push_p2wpkh function on Witness (Tobin C. Harding)
8cd409d561 Deprecate push_bitcoin_signature (Tobin C. Harding)

Pull request description:

  In order to create the witness to spend p2wpkh output one must create a `Witness` that includes the signature and the pubkey, we should have a function for this.

  ## Notes
  The PR originally added a `push_p2wphk` method, this is now instead a constrcutor `Witness:p2wpkh` (after review discussion below).

  - Patch 1 changes `push_bitcoin_signature` to take an `ecdsa::Sigtnture` instead of an `ecdsa::SerializedSignature`
  - Patch 2 takes a `secp256k1::PublicKey` removing the need for an error path (discussed below).

ACKs for top commit:
  sanket1729:
    ACK 5901d35095
  apoelstra:
    ACK 5901d35095

Tree-SHA512: 646014d97daafbf0909106d8990debaf481ac6f3578f0ddf232d739c3e2d55ae1d0275abe5a4a1db1c5c192c8c5f0b5546fc65aac37b91a3729db881c5ad3dec
2023-09-26 13:08:56 +00:00
Tobin C. Harding 5901d35095
Add push_p2wpkh function on Witness
In order to create the witness to spend p2wpkh output one must push the
signature and the pubkey, we should have a function for this.
2023-09-26 10:14:23 +10:00
Andrew Poelstra c31b933c10
Merge rust-bitcoin/rust-bitcoin#1952: Add changelog entries
24e5e19ed0 Add changelog entries (Tobin C. Harding)
79f2157311 bitcoin: Grab changelog entry from 0.30.1 release (Tobin C. Harding)

Pull request description:

  Gearing up for the next release add changelog entries for everything merged upto July 24.

ACKs for top commit:
  apoelstra:
    ACK 24e5e19ed0
  clarkmoody:
    ACK 24e5e19ed0

Tree-SHA512: 12761623f3d61fea77b5dfe4c505dcdb5041ec4473ae05524b818eb2d4e3cbc3b039b8f1400022916c9f2d1ee97fcccd7e7b6da0bb5f868a1b77bdcfade3d7ed
2023-09-25 19:53:42 +00:00
Tobin C. Harding c34e3cc7cc
Re-write size/weight API
Recently we introduced a bug in the weight/size code, while
investigating I found that our `Transaction`/`Block` weight/size APIs
were in a total mess because:

- The docs were stale
- The concept of weight (weight units) and size (bytes) were mixed up

I audited all the API functions, read some bips (141, 144) and re-wrote
the API with the following goals:

- Use terminology from the bips
- Use abstractions that mirror the bips where possible
2023-09-25 08:25:49 +10:00
Tobin C. Harding 24e5e19ed0
Add changelog entries
Add changelog entries to `bitcoin` after going through all merged PRs
upto July 24 (Sydney time).
2023-09-25 07:44:26 +10:00
Tobin C. Harding 79f2157311
bitcoin: Grab changelog entry from 0.30.1 release
In preparation for adding a 0.31.0 changelog entry grab the changelog
entry from the 0.30.1 tagged release branch so it does not get lost.
2023-09-25 07:43:53 +10:00
Tobin C. Harding 8cd409d561
Deprecate push_bitcoin_signature
The `Witness::push_bitcoin_signature` method is old and a bit stale.
Bitcoin has taproot signatures now so the name is stale, also we have
the `crate::ecdsa::Signature` type that holds the secp sig and the hash
type so we can use that instead of having two separate parameters.

Add a new, up to date, `Witness::push_ecdsa_signature` function and
deprecate the `push_bitcoin_signature` one.
2023-09-25 07:21:20 +10:00
Tobin C. Harding f31fb08651
Remove default impl from transaction version
There is no logical default for the transaction version number, there is
only pre-bip68 (v1) and post-bip68 (v2). Uses should specify the version
they want not rely on us making the choice.

(I originally added this impl to support testing, this was in hindsight
the wrong thing to do, props to Sanket for noticing.)
2023-09-25 05:51:24 +10:00
Clark Moody 72a7280d7d
Merge pull request #2006 from tcharding/08-18-tx-version
Add transaction::Version data type
2023-09-23 13:13:52 -05:00
Tobin C. Harding 73f7fbf520
Add code comments to transaction serialization
In an attempt to help super new devs add code comments about transaction
serialization formats pre and post segwit.
2023-09-23 14:38:25 +10:00