Document source of logic fro read_scriptint

Our `script::read_scriptint` function is based on the constructor
code (incl. call to `set_vch`) code from Bitcoin Core. Add rustdoc
comment saying so, emit a link because there are already multiple links
to `script.h` in this file (one just right below the added comment).
This commit is contained in:
Tobin C. Harding 2023-02-10 12:02:32 +11:00
parent 2eb2420b40
commit a7117bf8f1
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 2 additions and 0 deletions

View File

@ -115,6 +115,8 @@ pub fn write_scriptint(out: &mut [u8; 8], n: i64) -> usize {
/// don't fit in 64 bits (for efficiency on modern processors) so we /// don't fit in 64 bits (for efficiency on modern processors) so we
/// simply say, anything in excess of 32 bits is no longer a number. /// simply say, anything in excess of 32 bits is no longer a number.
/// This is basically a ranged type implementation. /// This is basically a ranged type implementation.
///
/// This code is based on the `CScriptNum` constructor in Bitcoin Core (see `script.h`).
pub fn read_scriptint(v: &[u8]) -> Result<i64, Error> { pub fn read_scriptint(v: &[u8]) -> Result<i64, Error> {
let len = v.len(); let len = v.len();
if len > 4 { return Err(Error::NumericOverflow); } if len > 4 { return Err(Error::NumericOverflow); }