Improve documentation test in merkle_tree

Removes unnecessary usage of vector and adds a missing assert.
This commit is contained in:
Jiri Jakes 2024-09-14 15:50:56 +08:00
parent 7360c3ce9a
commit 9fc2c2a5b1
No known key found for this signature in database
GPG Key ID: 01F5B01A5D686F31
1 changed files with 2 additions and 2 deletions

View File

@ -7,11 +7,11 @@
//! ``` //! ```
//! # use bitcoin::Txid; //! # use bitcoin::Txid;
//! # use bitcoin::merkle_tree::{MerkleNode as _, TxMerkleNode}; //! # use bitcoin::merkle_tree::{MerkleNode as _, TxMerkleNode};
//! # use bitcoin::hashes::Hash;
//! # let tx1 = Txid::from_byte_array([0xAA; 32]); // Arbitrary dummy hash values. //! # let tx1 = Txid::from_byte_array([0xAA; 32]); // Arbitrary dummy hash values.
//! # let tx2 = Txid::from_byte_array([0xFF; 32]); //! # let tx2 = Txid::from_byte_array([0xFF; 32]);
//! let tx_hashes = vec![tx1, tx2]; // All the hashes we wish to merkelize. //! let tx_hashes = [tx1, tx2]; // All the hashes we wish to merkelize.
//! let root = TxMerkleNode::calculate_root(tx_hashes.into_iter()); //! let root = TxMerkleNode::calculate_root(tx_hashes.into_iter());
//! assert!(root.is_some());
//! ``` //! ```
mod block; mod block;