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:
parent
2eb2420b40
commit
a7117bf8f1
|
@ -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); }
|
||||||
|
|
Loading…
Reference in New Issue