diff --git a/bitcoin/examples/ecdsa-psbt-simple.rs b/bitcoin/examples/ecdsa-psbt-simple.rs index b96cb7367..1acfab8e9 100644 --- a/bitcoin/examples/ecdsa-psbt-simple.rs +++ b/bitcoin/examples/ecdsa-psbt-simple.rs @@ -101,7 +101,7 @@ fn dummy_unspent_transaction_outputs() -> Vec<(OutPoint, TxOut)> { .script_pubkey(); let out_point_1 = OutPoint { - txid: Txid::all_zeros(), // Obviously invalid. + txid: Txid::from_byte_array([0xFF; 32]), // Arbitrary invalid dummy value. vout: 0, }; @@ -115,7 +115,7 @@ fn dummy_unspent_transaction_outputs() -> Vec<(OutPoint, TxOut)> { .script_pubkey(); let out_point_2 = OutPoint { - txid: Txid::all_zeros(), // Obviously invalid. + txid: Txid::from_byte_array([0xFF; 32]), // Arbitrary invalid dummy value. vout: 1, }; diff --git a/bitcoin/examples/sign-tx-segwit-v0.rs b/bitcoin/examples/sign-tx-segwit-v0.rs index 932663c94..997104d66 100644 --- a/bitcoin/examples/sign-tx-segwit-v0.rs +++ b/bitcoin/examples/sign-tx-segwit-v0.rs @@ -119,7 +119,7 @@ fn dummy_unspent_transaction_output(wpkh: WPubkeyHash) -> (OutPoint, TxOut) { let script_pubkey = ScriptBuf::new_p2wpkh(wpkh); let out_point = OutPoint { - txid: Txid::all_zeros(), // Obviously invalid. + txid: Txid::from_byte_array([0xFF; 32]), // Arbitrary invalid dummy value. vout: 0, }; diff --git a/bitcoin/examples/sign-tx-taproot.rs b/bitcoin/examples/sign-tx-taproot.rs index 23b8b2923..c56f5e912 100644 --- a/bitcoin/examples/sign-tx-taproot.rs +++ b/bitcoin/examples/sign-tx-taproot.rs @@ -119,7 +119,7 @@ fn dummy_unspent_transaction_output( let script_pubkey = ScriptBuf::new_p2tr(secp, internal_key, None); let out_point = OutPoint { - txid: Txid::all_zeros(), // Obviously invalid. + txid: Txid::from_byte_array([0xFF; 32]), // Arbitrary invalid dummy value. vout: 0, }; diff --git a/bitcoin/examples/taproot-psbt-simple.rs b/bitcoin/examples/taproot-psbt-simple.rs index edd375ec6..90fc3a602 100644 --- a/bitcoin/examples/taproot-psbt-simple.rs +++ b/bitcoin/examples/taproot-psbt-simple.rs @@ -111,7 +111,7 @@ fn dummy_unspent_transaction_outputs() -> Vec<(OutPoint, TxOut)> { .script_pubkey(); let out_point_1 = OutPoint { - txid: Txid::all_zeros(), // Obviously invalid. + txid: Txid::from_byte_array([0xFF; 32]), // Arbitrary invalid dummy value. vout: 0, }; @@ -125,7 +125,7 @@ fn dummy_unspent_transaction_outputs() -> Vec<(OutPoint, TxOut)> { .script_pubkey(); let out_point_2 = OutPoint { - txid: Txid::all_zeros(), // Obviously invalid. + txid: Txid::from_byte_array([0xFF; 32]), // Arbitrary invalid dummy value. vout: 1, }; diff --git a/bitcoin/src/blockdata/block.rs b/bitcoin/src/blockdata/block.rs index 2578e3f8d..1670389d4 100644 --- a/bitcoin/src/blockdata/block.rs +++ b/bitcoin/src/blockdata/block.rs @@ -305,7 +305,7 @@ impl Block { let hashes = self.txdata.iter().enumerate().map(|(i, t)| { if i == 0 { // Replace the first hash with zeroes. - Wtxid::all_zeros() + Wtxid::COINBASE } else { t.compute_wtxid() } diff --git a/bitcoin/src/blockdata/constants.rs b/bitcoin/src/blockdata/constants.rs index 7ac1d4905..e553d129c 100644 --- a/bitcoin/src/blockdata/constants.rs +++ b/bitcoin/src/blockdata/constants.rs @@ -226,7 +226,7 @@ mod test { assert_eq!(gen.version, transaction::Version::ONE); assert_eq!(gen.input.len(), 1); - assert_eq!(gen.input[0].previous_output.txid, Txid::all_zeros()); + assert_eq!(gen.input[0].previous_output.txid, Txid::COINBASE_PREVOUT); assert_eq!(gen.input[0].previous_output.vout, 0xFFFFFFFF); assert_eq!(serialize(&gen.input[0].script_sig), hex!("4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73")); diff --git a/bitcoin/src/merkle_tree/mod.rs b/bitcoin/src/merkle_tree/mod.rs index f024482b0..39c9310b3 100644 --- a/bitcoin/src/merkle_tree/mod.rs +++ b/bitcoin/src/merkle_tree/mod.rs @@ -8,8 +8,8 @@ //! # use bitcoin::Txid; //! # use bitcoin::merkle_tree::{MerkleNode as _, TxMerkleNode}; //! # use bitcoin::hashes::Hash; -//! # let tx1 = Txid::all_zeros(); // Dummy hash values. -//! # let tx2 = Txid::all_zeros(); +//! # let tx1 = Txid::from_byte_array([0xAA; 32]); // Arbitrary dummy hash values. +//! # let tx2 = Txid::from_byte_array([0xFF; 32]); //! let tx_hashes = vec![tx1, tx2]; // All the hashes we wish to merkelize. //! let root = TxMerkleNode::calculate_root(tx_hashes.into_iter()); //! ```