}
/// <summary>
- /// Stake modifier checksum.
+ /// Stake modifier checksum
/// </summary>
public uint nStakeModifierChecksum;
public long nParentBlockID { get; set; }
/// <summary>
+ /// Transaction timestamp
+ /// </summary>
+ [Column("nTime")]
+ public uint nTime { get; set; }
+
+ /// <summary>
/// Transaction type flag
/// </summary>
[Column("TransactionFlags")]
{
reader.Seek(nBlockPos + nTxOffset, SeekOrigin.Begin); // Seek to transaction offset
- if (nTxSize != reader.Read(buffer, 0, nTxSize))
+ if (nTxSize != reader.Read(buffer, 0, (int)nTxSize))
{
return false;
}
/// Transaction size accessor
/// </summary>
[Ignore]
- public int nTxSize
+ public uint nTxSize
{
- get { return (int)VarInt.DecodeVarInt(TxSize); }
+ get { return (uint)VarInt.DecodeVarInt(TxSize); }
private set { TxSize = VarInt.EncodeVarInt(value); }
}
+ [Ignore]
+ public bool IsCoinBase
+ {
+ get { return TransactionFlags == TxFlags.TX_COINBASE; }
+ }
+
+ [Ignore]
+ public bool IsCoinStake
+ {
+ get { return TransactionFlags == TxFlags.TX_COINSTAKE; }
+ }
+
+ public CMerkleNode()
+ {
+ }
+
public CMerkleNode(CTransaction tx)
{
+ nTime = tx.nTime;
+
nTxOffset = -1;
nParentBlockID = -1;
if (tx.IsCoinBase)
{
- TransactionFlags |= TxFlags.TX_COINBASE;
+ TransactionFlags = TxFlags.TX_COINBASE;
}
else if (tx.IsCoinStake)
{
- TransactionFlags |= TxFlags.TX_COINSTAKE;
+ TransactionFlags = TxFlags.TX_COINSTAKE;
}
else
{
- TransactionFlags |= TxFlags.TX_USER;
+ TransactionFlags = TxFlags.TX_USER;
}
}
public CMerkleNode(long nBlockId, long nOffset, CTransaction tx)
{
+ nTime = tx.nTime;
+
nParentBlockID = nBlockId;
nTxOffset = nOffset;
public class TxOutItem
{
/// <summary>
+ /// Outpoint identifier.
+ /// </summary>
+ [PrimaryKey, AutoIncrement]
+ public long nOutpointID { get; set; }
+
+ /// <summary>
/// Reference to transaction item.
/// </summary>
[ForeignKey(typeof(CMerkleNode), Name = "nMerkleNodeID")]
/// Getter for output value.
/// </summary>
[Ignore]
- public ulong nValue
+ public long nValue
{
get { return VarInt.DecodeVarInt(OutputValue); }
set { OutputValue = VarInt.EncodeVarInt(value); }
public class InputsJoin : TxOutItem
{
public byte[] TransactionHash { get; set; }
+
+ /// <summary>
+ /// To avoid awkwardness of sqlite wrapper.
+ /// </summary>
+ /// <returns></returns>
+ public TxOutItem getTxOutItem()
+ {
+ return new TxOutItem()
+ {
+ nOutpointID = nOutpointID,
+ nMerkleNodeID = nMerkleNodeID,
+ outputFlags = outputFlags,
+ OutputNumber = OutputNumber,
+ OutputValue = OutputValue,
+ scriptPubKey = scriptPubKey
+ };
+ }
}