Skip to content

Commit

Permalink
Merge rust-bitcoin#3406: Move Witness to primitives
Browse files Browse the repository at this point in the history
c1eccfd Move Witness to primitives (Tobin C. Harding)
6ce76cd Add unstable constructor to Witness (Tobin C. Harding)

Pull request description:

  Patch 1 introduces a new policy to the codebase, we use `foo__unstable` for public unstable functions and there are zero semver guarantees if you call these functions.

  Patch 2 does the move.

  Close rust-bitcoin#3406

ACKs for top commit:
  apoelstra:
    ACK c1eccfd; successfully ran local tests

Tree-SHA512: 2388066be2b6bb2cf3d6757c8f6334beeda6115ef1ce7c537955d32aa5e466add5162d0d2adee27f416fe622fc93c4e94bd848326463ee55e08d1c0f4e03719c
  • Loading branch information
apoelstra committed Oct 18, 2024
2 parents 62db1df + c1eccfd commit 51d5037
Show file tree
Hide file tree
Showing 14 changed files with 792 additions and 676 deletions.
4 changes: 3 additions & 1 deletion Cargo-minimal.lock
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ name = "bitcoin-internals"
version = "0.4.0"
dependencies = [
"bincode",
"hex-conservative",
"serde",
"serde_json",
]
Expand All @@ -111,6 +112,7 @@ name = "bitcoin-primitives"
version = "0.100.0"
dependencies = [
"arbitrary",
"bincode",
"bitcoin-internals",
"bitcoin-io",
"bitcoin-units",
Expand All @@ -119,6 +121,7 @@ dependencies = [
"mutagen",
"ordered",
"serde",
"serde_json",
]

[[package]]
Expand Down Expand Up @@ -204,7 +207,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1aa273bf451e37ed35ced41c71a5e2a4e29064afb104158f2514bcd71c2c986"
dependencies = [
"arrayvec",
"serde",
]

[[package]]
Expand Down
4 changes: 3 additions & 1 deletion Cargo-recent.lock
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ name = "bitcoin-internals"
version = "0.4.0"
dependencies = [
"bincode",
"hex-conservative",
"serde",
"serde_json",
]
Expand All @@ -110,6 +111,7 @@ name = "bitcoin-primitives"
version = "0.100.0"
dependencies = [
"arbitrary",
"bincode",
"bitcoin-internals",
"bitcoin-io",
"bitcoin-units",
Expand All @@ -118,6 +120,7 @@ dependencies = [
"mutagen",
"ordered",
"serde",
"serde_json",
]

[[package]]
Expand Down Expand Up @@ -206,7 +209,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd"
dependencies = [
"arrayvec",
"serde",
]

[[package]]
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ are no plans to do so. Of course, patches to fix specific consensus incompatibil
16-bit pointer sizes are not supported and we can't promise they will be. If you care about them
please let us know, so we can know how large the interest is and possibly decide to support them.

### Semver compliance

We try hard to maintain strict semver compliance with our releases. This codebase includes some
public functions marked unstable (e.g., `pub fn foo__unstable()`). These functions do not adhere to
semver rules; use them at your own discretion.


## Documentation

Currently can be found on [docs.rs/bitcoin](https://docs.rs/bitcoin/). Patches to add usage examples
Expand Down
1 change: 1 addition & 0 deletions bitcoin/examples/ecdsa-psbt-simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use bitcoin::bip32::{ChildNumber, DerivationPath, Fingerprint, IntoDerivationPat
use bitcoin::locktime::absolute;
use bitcoin::psbt::Input;
use bitcoin::secp256k1::{Secp256k1, Signing};
use bitcoin::witness::WitnessExt as _;
use bitcoin::{
consensus, transaction, Address, Amount, EcdsaSighashType, Network, OutPoint, Psbt, ScriptBuf,
Sequence, Transaction, TxIn, TxOut, Txid, WPubkeyHash, Witness,
Expand Down
1 change: 1 addition & 0 deletions bitcoin/examples/sign-tx-segwit-v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use bitcoin::address::script_pubkey::ScriptBufExt as _;
use bitcoin::locktime::absolute;
use bitcoin::secp256k1::{rand, Message, Secp256k1, SecretKey, Signing};
use bitcoin::sighash::{EcdsaSighashType, SighashCache};
use bitcoin::witness::WitnessExt as _;
use bitcoin::{
transaction, Address, Amount, Network, OutPoint, ScriptBuf, Sequence, Transaction, TxIn, TxOut,
Txid, WPubkeyHash, Witness,
Expand Down
1 change: 1 addition & 0 deletions bitcoin/examples/sign-tx-taproot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use bitcoin::key::{Keypair, TapTweak, TweakedKeypair, UntweakedPublicKey};
use bitcoin::locktime::absolute;
use bitcoin::secp256k1::{rand, Message, Secp256k1, SecretKey, Signing, Verification};
use bitcoin::sighash::{Prevouts, SighashCache, TapSighashType};
use bitcoin::witness::WitnessExt as _;
use bitcoin::{
transaction, Address, Amount, Network, OutPoint, ScriptBuf, Sequence, Transaction, TxIn, TxOut,
Txid, Witness,
Expand Down
1 change: 1 addition & 0 deletions bitcoin/examples/taproot-psbt-simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use bitcoin::key::UntweakedPublicKey;
use bitcoin::locktime::absolute;
use bitcoin::psbt::Input;
use bitcoin::secp256k1::{Secp256k1, Signing};
use bitcoin::witness::WitnessExt as _;
use bitcoin::{
consensus, transaction, Address, Amount, Network, OutPoint, Psbt, ScriptBuf, Sequence,
TapLeafHash, TapSighashType, Transaction, TxIn, TxOut, Txid, Witness, XOnlyPublicKey,
Expand Down
Loading

0 comments on commit 51d5037

Please sign in to comment.