Add comment on rountripping read/write scripint
We only support reads of upto 4 bytes where as Bitcoin Core allows reading a `CScriptNum` with more bytes than that. Add a rustdoc comment (incl. link to Bitcoin Core) mentioning that.
This commit is contained in:
parent
657dd51e8b
commit
2eb2420b40
|
@ -66,6 +66,11 @@ pub use self::types::*;
|
||||||
/// Encodes an integer in script(minimal CScriptNum) format.
|
/// Encodes an integer in script(minimal CScriptNum) format.
|
||||||
///
|
///
|
||||||
/// Writes bytes into the buffer and returns the number of bytes written.
|
/// Writes bytes into the buffer and returns the number of bytes written.
|
||||||
|
///
|
||||||
|
/// Note that `write_scriptint`/`read_scriptint` do not roundtrip if the value written requires
|
||||||
|
/// more than 4 bytes, this is in line with Bitcoin Core (see [`CScriptNum::serialize`]).
|
||||||
|
///
|
||||||
|
/// [`CScriptNum::serialize`]: <https://github.com/bitcoin/bitcoin/blob/8ae2808a4354e8dcc697f76bacc5e2f2befe9220/src/script/script.h#L345>
|
||||||
pub fn write_scriptint(out: &mut [u8; 8], n: i64) -> usize {
|
pub fn write_scriptint(out: &mut [u8; 8], n: i64) -> usize {
|
||||||
let mut len = 0;
|
let mut len = 0;
|
||||||
if n == 0 { return len; }
|
if n == 0 { return len; }
|
||||||
|
|
Loading…
Reference in New Issue