Transaction and header version is signed int
This commit is contained in:
parent
e8bcde4d38
commit
e9f1f11c2c
|
@ -37,7 +37,7 @@ use VarInt;
|
||||||
#[derive(Copy, PartialEq, Eq, Clone, Debug)]
|
#[derive(Copy, PartialEq, Eq, Clone, Debug)]
|
||||||
pub struct BlockHeader {
|
pub struct BlockHeader {
|
||||||
/// The protocol version. Should always be 1.
|
/// The protocol version. Should always be 1.
|
||||||
pub version: u32,
|
pub version: i32,
|
||||||
/// Reference to the previous block in the chain
|
/// Reference to the previous block in the chain
|
||||||
pub prev_blockhash: BlockHash,
|
pub prev_blockhash: BlockHash,
|
||||||
/// The root hash of the merkle tree of transactions in the block
|
/// The root hash of the merkle tree of transactions in the block
|
||||||
|
@ -320,4 +320,3 @@ mod tests {
|
||||||
assert_eq!(header.bits, BlockHeader::compact_target_from_u256(&header.target()));
|
assert_eq!(header.bits, BlockHeader::compact_target_from_u256(&header.target()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ impl Default for TxOut {
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
||||||
pub struct Transaction {
|
pub struct Transaction {
|
||||||
/// The protocol version, is currently expected to be 1 or 2 (BIP 68).
|
/// The protocol version, is currently expected to be 1 or 2 (BIP 68).
|
||||||
pub version: u32,
|
pub version: i32,
|
||||||
/// Block number before which this transaction is valid, or 0 for
|
/// Block number before which this transaction is valid, or 0 for
|
||||||
/// valid immediately.
|
/// valid immediately.
|
||||||
pub lock_time: u32,
|
pub lock_time: u32,
|
||||||
|
@ -531,7 +531,7 @@ impl Encodable for Transaction {
|
||||||
|
|
||||||
impl Decodable for Transaction {
|
impl Decodable for Transaction {
|
||||||
fn consensus_decode<D: io::Read>(mut d: D) -> Result<Self, encode::Error> {
|
fn consensus_decode<D: io::Read>(mut d: D) -> Result<Self, encode::Error> {
|
||||||
let version = u32::consensus_decode(&mut d)?;
|
let version = i32::consensus_decode(&mut d)?;
|
||||||
let input = Vec::<TxIn>::consensus_decode(&mut d)?;
|
let input = Vec::<TxIn>::consensus_decode(&mut d)?;
|
||||||
// segwit
|
// segwit
|
||||||
if input.is_empty() {
|
if input.is_empty() {
|
||||||
|
@ -1229,4 +1229,3 @@ mod tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ use consensus::encode::Encodable;
|
||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
#[deprecated(since="0.24.0", note="please use `SigHashCache` instead")]
|
#[deprecated(since="0.24.0", note="please use `SigHashCache` instead")]
|
||||||
pub struct SighashComponents {
|
pub struct SighashComponents {
|
||||||
tx_version: u32,
|
tx_version: i32,
|
||||||
tx_locktime: u32,
|
tx_locktime: u32,
|
||||||
/// Hash of all the previous outputs
|
/// Hash of all the previous outputs
|
||||||
pub hash_prevouts: SigHash,
|
pub hash_prevouts: SigHash,
|
||||||
|
|
Loading…
Reference in New Issue