Separate Amount::{from_i64, from_nonnegative_i64} APIs

This is more intuitive than a boolean flag for handling non-negative
Amounts stored in i64 values.
This commit is contained in:
Jack Grigg
2019-08-08 00:55:23 +01:00
parent 59ed258c7f
commit 7c07914bfd
6 changed files with 46 additions and 32 deletions

View File

@@ -79,7 +79,7 @@ impl TxOut {
let value = {
let mut tmp = [0; 8];
reader.read_exact(&mut tmp)?;
Amount::from_i64_le_bytes(tmp, false)
Amount::from_nonnegative_i64_le_bytes(tmp)
}
.map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "value out of range"))?;
let script_pubkey = Script::read(&mut reader)?;