public void TestUInt32Length() { var value = new UInt32ColumnValue(); foreach (uint i in new[] { uint.MinValue, 1U, 2U, Any.UInt32, 65521U, uint.MaxValue - 1, uint.MaxValue }) { TestLengthForStruct(value, i, 4); } }
public void TestUInt32ValueAsObject() { var value = new UInt32ColumnValue(); foreach (uint i in new[] { uint.MinValue, 1U, 2U, Any.UInt32, 65521U, uint.MaxValue - 1, uint.MaxValue }) { TestValueAsObjectForStruct(value, i); } }
private IEnumerable <UnspentTx> ReadUnspentTransactionsInner() { using (SetSessionContext()) { Api.JetSetCurrentIndex(this.jetSession, this.unspentTxTableId, "IX_TxHash"); if (Api.TryMoveFirst(this.jetSession, this.unspentTxTableId)) { do { var txHashColumn = new BytesColumnValue { Columnid = this.txHashColumnId }; var blockIndexColumn = new Int32ColumnValue { Columnid = this.blockIndexColumnId }; var txIndexColumn = new Int32ColumnValue { Columnid = this.txIndexColumnId }; var txVersionColumn = new UInt32ColumnValue { Columnid = this.txVersionColumnId }; var isCoinbaseColumn = new BoolColumnValue { Columnid = this.isCoinbaseColumnId }; var outputStatesColumn = new BytesColumnValue { Columnid = this.outputStatesColumnId }; var txOutputBytesColumn = new BytesColumnValue { Columnid = this.txOutputBytesColumnId }; Api.RetrieveColumns(this.jetSession, this.unspentTxTableId, txHashColumn, blockIndexColumn, txIndexColumn, txVersionColumn, isCoinbaseColumn, outputStatesColumn, txOutputBytesColumn); var txHash = DbEncoder.DecodeUInt256(txHashColumn.Value); var blockIndex = blockIndexColumn.Value.Value; var txIndex = txIndexColumn.Value.Value; var txVersion = txVersionColumn.Value.Value; var isCoinbase = isCoinbaseColumn.Value.Value; var outputStates = DataDecoder.DecodeOutputStates(outputStatesColumn.Value); yield return(new UnspentTx(txHash, blockIndex, txIndex, txVersion, isCoinbase, outputStates)); }while (Api.TryMoveNext(this.jetSession, this.unspentTxTableId)); } } }
public bool TryGetUnspentTx(UInt256 txHash, out UnspentTx unspentTx) { CheckTransaction(); using (SetSessionContext()) { Api.JetSetCurrentIndex(this.jetSession, this.unspentTxTableId, "IX_TxHash"); Api.MakeKey(this.jetSession, this.unspentTxTableId, DbEncoder.EncodeUInt256(txHash), MakeKeyGrbit.NewKey); if (Api.TrySeek(this.jetSession, this.unspentTxTableId, SeekGrbit.SeekEQ)) { var blockIndexColumn = new Int32ColumnValue { Columnid = this.blockIndexColumnId }; var txIndexColumn = new Int32ColumnValue { Columnid = this.txIndexColumnId }; var txVersionColumn = new UInt32ColumnValue { Columnid = this.txVersionColumnId }; var isCoinbaseColumn = new BoolColumnValue { Columnid = this.isCoinbaseColumnId }; var outputStatesColumn = new BytesColumnValue { Columnid = this.outputStatesColumnId }; var txOutputBytesColumn = new BytesColumnValue { Columnid = this.txOutputBytesColumnId }; Api.RetrieveColumns(this.jetSession, this.unspentTxTableId, blockIndexColumn, txIndexColumn, txVersionColumn, isCoinbaseColumn, outputStatesColumn, txOutputBytesColumn); var blockIndex = blockIndexColumn.Value.Value; var txIndex = txIndexColumn.Value.Value; var txVersion = txVersionColumn.Value.Value; var isCoinbase = isCoinbaseColumn.Value.Value; var outputStates = DataDecoder.DecodeOutputStates(outputStatesColumn.Value); unspentTx = new UnspentTx(txHash, blockIndex, txIndex, txVersion, isCoinbase, outputStates); return(true); } unspentTx = default(UnspentTx); return(false); } }
private IEnumerable<UnspentTx> ReadUnspentTransactionsInner() { using (SetSessionContext()) { Api.JetSetCurrentIndex(this.jetSession, this.unspentTxTableId, "IX_TxHash"); if (Api.TryMoveFirst(this.jetSession, this.unspentTxTableId)) { do { var txHashColumn = new BytesColumnValue { Columnid = this.txHashColumnId }; var blockIndexColumn = new Int32ColumnValue { Columnid = this.blockIndexColumnId }; var txIndexColumn = new Int32ColumnValue { Columnid = this.txIndexColumnId }; var txVersionColumn = new UInt32ColumnValue { Columnid = this.txVersionColumnId }; var isCoinbaseColumn = new BoolColumnValue { Columnid = this.isCoinbaseColumnId }; var outputStatesColumn = new BytesColumnValue { Columnid = this.outputStatesColumnId }; var txOutputBytesColumn = new BytesColumnValue { Columnid = this.txOutputBytesColumnId }; Api.RetrieveColumns(this.jetSession, this.unspentTxTableId, txHashColumn, blockIndexColumn, txIndexColumn, txVersionColumn, isCoinbaseColumn, outputStatesColumn, txOutputBytesColumn); var txHash = DbEncoder.DecodeUInt256(txHashColumn.Value); var blockIndex = blockIndexColumn.Value.Value; var txIndex = txIndexColumn.Value.Value; var txVersion = txVersionColumn.Value.Value; var isCoinbase = isCoinbaseColumn.Value.Value; var outputStates = DataDecoder.DecodeOutputStates(outputStatesColumn.Value); yield return new UnspentTx(txHash, blockIndex, txIndex, txVersion, isCoinbase, outputStates); } while (Api.TryMoveNext(this.jetSession, this.unspentTxTableId)); } } }
public bool TryGetUnspentTx(UInt256 txHash, out UnspentTx unspentTx) { CheckTransaction(); using (SetSessionContext()) { Api.JetSetCurrentIndex(this.jetSession, this.unspentTxTableId, "IX_TxHash"); Api.MakeKey(this.jetSession, this.unspentTxTableId, DbEncoder.EncodeUInt256(txHash), MakeKeyGrbit.NewKey); if (Api.TrySeek(this.jetSession, this.unspentTxTableId, SeekGrbit.SeekEQ)) { var blockIndexColumn = new Int32ColumnValue { Columnid = this.blockIndexColumnId }; var txIndexColumn = new Int32ColumnValue { Columnid = this.txIndexColumnId }; var txVersionColumn = new UInt32ColumnValue { Columnid = this.txVersionColumnId }; var isCoinbaseColumn = new BoolColumnValue { Columnid = this.isCoinbaseColumnId }; var outputStatesColumn = new BytesColumnValue { Columnid = this.outputStatesColumnId }; var txOutputBytesColumn = new BytesColumnValue { Columnid = this.txOutputBytesColumnId }; Api.RetrieveColumns(this.jetSession, this.unspentTxTableId, blockIndexColumn, txIndexColumn, txVersionColumn, isCoinbaseColumn, outputStatesColumn, txOutputBytesColumn); var blockIndex = blockIndexColumn.Value.Value; var txIndex = txIndexColumn.Value.Value; var txVersion = txVersionColumn.Value.Value; var isCoinbase = isCoinbaseColumn.Value.Value; var outputStates = DataDecoder.DecodeOutputStates(outputStatesColumn.Value); unspentTx = new UnspentTx(txHash, blockIndex, txIndex, txVersion, isCoinbase, outputStates); return true; } unspentTx = default(UnspentTx); return false; } }