Add code comments to transaction serialization
In an attempt to help super new devs add code comments about transaction serialization formats pre and post segwit.
This commit is contained in:
parent
29f20c1d0b
commit
73f7fbf520
|
@ -1022,10 +1022,12 @@ impl Encodable for Transaction {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Legacy transaction serialization format only includes inputs and outputs.
|
||||||
if !have_witness {
|
if !have_witness {
|
||||||
len += self.input.consensus_encode(w)?;
|
len += self.input.consensus_encode(w)?;
|
||||||
len += self.output.consensus_encode(w)?;
|
len += self.output.consensus_encode(w)?;
|
||||||
} else {
|
} else {
|
||||||
|
// BIP-141 (segwit) transaction serialization also includes marker, flag, and witness data.
|
||||||
len += SEGWIT_MARKER.consensus_encode(w)?;
|
len += SEGWIT_MARKER.consensus_encode(w)?;
|
||||||
len += SEGWIT_FLAG.consensus_encode(w)?;
|
len += SEGWIT_FLAG.consensus_encode(w)?;
|
||||||
len += self.input.consensus_encode(w)?;
|
len += self.input.consensus_encode(w)?;
|
||||||
|
|
Loading…
Reference in New Issue