BitSharp.Esent.EsentChainStateCursor.TryAddBlockUnmintedTxes C# (CSharp) Method

TryAddBlockUnmintedTxes() public method

public TryAddBlockUnmintedTxes ( UInt256 blockHash, IImmutableList unmintedTxes ) : bool
blockHash UInt256
unmintedTxes IImmutableList
return bool
        public bool TryAddBlockUnmintedTxes(UInt256 blockHash, IImmutableList<UnmintedTx> unmintedTxes)
        {
            CheckWriteTransaction();

            try
            {
                using (SetSessionContext())
                using (var jetUpdate = this.jetSession.BeginUpdate(this.unmintedTxTableId, JET_prep.Insert))
                {
                    byte[] unmintedTxesBytes;
                    using (var stream = new MemoryStream())
                    using (var writer = new BinaryWriter(stream))
                    {
                        writer.WriteList(unmintedTxes, unmintedTx => DataEncoder.EncodeUnmintedTx(writer, unmintedTx));
                        unmintedTxesBytes = stream.ToArray();
                    }

                    Api.SetColumns(this.jetSession, this.unmintedTxTableId,
                        new BytesColumnValue { Columnid = this.unmintedBlockHashColumnId, Value = DbEncoder.EncodeUInt256(blockHash) },
                        new BytesColumnValue { Columnid = this.unmintedDataColumnId, Value = unmintedTxesBytes });

                    jetUpdate.Save();
                }

                return true;
            }
            catch (EsentKeyDuplicateException)
            {
                return false;
            }
        }