Skip to content

Commit bed7cde

Browse files
committed
Improve docs on verify function
Improve the docs on `verify` by doing: - Attempt to make the docs more terse with no loss of meaning. - Remove link to transactions, no need to bless a specific explorer, folk can use the explorer of their choice to look things up.
1 parent a692bb3 commit bed7cde

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

src/lib.rs

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -142,38 +142,33 @@ pub fn version() -> u32 { unsafe { bitcoinconsensus_version() as u32 } }
142142
///
143143
/// # Arguments
144144
///
145-
/// * spend_output_script: A Bitcoin transaction output script to be spent, serialized in Bitcoin's on wire format.
146-
/// * amount: The spent output amount in satoshis.
147-
/// * spending_transaction: The spending Bitcoin transaction, serialized in Bitcoin's on wire format.
148-
/// * input_index: The index of the input within spending_transaction.
145+
/// * `spend_output`: A Bitcoin transaction output script to be spent, serialized in Bitcoin's on wire format.
146+
/// * `amount`: The spent output amount in satoshis.
147+
/// * `spending_transaction`: The spending Bitcoin transaction, serialized in Bitcoin's on wire format.
148+
/// * `input_index`: The index of the input within spending_transaction.
149149
///
150150
/// # Examples
151151
///
152-
/// The (randomly choosen) Bitcoin transaction [aca326a724eda9a461c10a876534ecd5ae7b27f10f26c3862fb996f80ea2d45d](https://blockchain.info/tx/aca326a724eda9a461c10a876534ecd5ae7b27f10f26c3862fb996f80ea2d45d)
152+
/// The (randomly choosen) Bitcoin transaction
153+
///
154+
/// `aca326a724eda9a461c10a876534ecd5ae7b27f10f26c3862fb996f80ea2d45d`
155+
///
153156
/// spends one input, that is the first output of
154-
/// [95da344585fcf2e5f7d6cbf2c3df2dcce84f9196f7a7bb901a43275cd6eb7c3f](https://blockchain.info/tx/95da344585fcf2e5f7d6cbf2c3df2dcce84f9196f7a7bb901a43275cd6eb7c3f)
155-
/// with a value of 630482530 satoshis.
156157
///
157-
/// The spending transaction in wire format is:
158+
/// `95da344585fcf2e5f7d6cbf2c3df2dcce84f9196f7a7bb901a43275cd6eb7c3f`
158159
///
159-
/// `
160-
/// spending = 02000000013f7cebd65c27431a90bba7f796914fe8cc2ddfc3f2cbd6f7e5f2fc854534da95000000006b483045022100de1ac3bcdfb0332207c4a91f3832bd2c2915840165f876ab47c5f8996b971c3602201c6c053d750fadde599e6f5c4e1963df0f01fc0d97815e8157e3d59fe09ca30d012103699b464d1d8bc9e47d4fb1cdaa89a1c5783d68363c4dbc4b524ed3d857148617feffffff02836d3c01000000001976a914fc25d6d5c94003bf5b0c7b640a248e2c637fcfb088ac7ada8202000000001976a914fbed3d9b11183209a57999d54d59f67c019e756c88ac6acb0700
161-
/// `
160+
/// The spending transaction serialized is:
162161
///
163-
/// The script of the first output of the spent transaction is:
162+
/// `spending = 02000000013f7cebd65c27431a90bba7f796914fe8cc2ddfc3f2cbd6f7e5f2fc854534da95000000006b483045022100de1ac3bcdfb0332207c4a91f3832bd2c2915840165f876ab47c5f8996b971c3602201c6c053d750fadde599e6f5c4e1963df0f01fc0d97815e8157e3d59fe09ca30d012103699b464d1d8bc9e47d4fb1cdaa89a1c5783d68363c4dbc4b524ed3d857148617feffffff02836d3c01000000001976a914fc25d6d5c94003bf5b0c7b640a248e2c637fcfb088ac7ada8202000000001976a914fbed3d9b11183209a57999d54d59f67c019e756c88ac6acb0700`
164163
///
165-
/// `
166-
/// spent = 76a9144bfbaf6afb76cc5771bc6404810d1cc041a6933988ac
167-
/// `
164+
/// The script of the first output of the spent transaction is:
168165
///
169-
/// The (pseudo code) call:
166+
/// `spent = 76a9144bfbaf6afb76cc5771bc6404810d1cc041a6933988ac`
170167
///
171-
/// `
172-
/// verify(spent, 630482530, spending, 0)
173-
/// `
174-
/// should return `Ok(())`.
168+
/// The (pseudo code) call: `verify(spent, 630482530, spending, 0)` should return `Ok(())`.
175169
///
176-
/// **Note** since the spent amount will only be checked for Segwit transactions and the above example is not segwit, `verify` will succeed with any amount.
170+
/// **Note** since the spent amount will only be checked for Segwit transactions and the above
171+
/// example is not segwit, `verify` will succeed with any amount.
177172
pub fn verify(
178173
spent_output: &[u8],
179174
amount: u64,

0 commit comments

Comments
 (0)