private void ReadWrite(BitcoinStream stream)
{
if(stream.Serializing)
{
stream.ReadWrite((byte)0x32);
stream.ReadWrite(Flags);
}
else
{
if(stream.Inner.ReadByte() != 0x32)
throw new FormatException("Invalid magic version");
Flags = (byte)stream.Inner.ReadByte();
}
stream.ReadWrite(ref _Nonce);
if(stream.Serializing)
{
uint256 txId = OutPoint.Hash;
stream.ReadWrite(ref txId);
uint index = OutPoint.N;
stream.ReadWrite(ref index);
}
else
{
uint256 txId = new uint256();
stream.ReadWrite(ref txId);
uint index = 0;
stream.ReadWrite(ref index);
_OutPoint = new OutPoint(txId, index);
}
ulong amount = stream.Serializing ? (ulong)_Amount.Satoshi : 0;
stream.ReadWrite(ref amount);
_Amount = Money.Satoshis(amount);
_Signature = stream.Serializing ? _Signature : new byte[8];
stream.ReadWrite(ref _Signature);
}