From a7117bf8f1ca295258c25c7d2eb5646bf78da078 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 10 Feb 2023 12:02:32 +1100 Subject: [PATCH] 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). --- bitcoin/src/blockdata/script/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bitcoin/src/blockdata/script/mod.rs b/bitcoin/src/blockdata/script/mod.rs index 5e00b1a5..b843ac82 100644 --- a/bitcoin/src/blockdata/script/mod.rs +++ b/bitcoin/src/blockdata/script/mod.rs @@ -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 /// simply say, anything in excess of 32 bits is no longer a number. /// 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 { let len = v.len(); if len > 4 { return Err(Error::NumericOverflow); }