BitSharp.Esent.EsentChainStateCursor.TryAddUnspentTx C# (CSharp) 메소드

TryAddUnspentTx() 공개 메소드

public TryAddUnspentTx ( UnspentTx unspentTx ) : bool
unspentTx UnspentTx
리턴 bool
        public bool TryAddUnspentTx(UnspentTx unspentTx)
        {
            CheckWriteTransaction();

            using (SetSessionContext())
            {
                try
                {
                    using (var jetUpdate = this.jetSession.BeginUpdate(this.unspentTxTableId, JET_prep.Insert))
                    {
                        Api.SetColumns(this.jetSession, this.unspentTxTableId,
                            new BytesColumnValue { Columnid = this.txHashColumnId, Value = DbEncoder.EncodeUInt256(unspentTx.TxHash) },
                            new Int32ColumnValue { Columnid = this.blockIndexColumnId, Value = unspentTx.BlockIndex },
                            new Int32ColumnValue { Columnid = this.txIndexColumnId, Value = unspentTx.TxIndex },
                            new UInt32ColumnValue { Columnid = this.txVersionColumnId, Value = unspentTx.TxVersion },
                            new BoolColumnValue { Columnid = this.isCoinbaseColumnId, Value = unspentTx.IsCoinbase },
                            new BytesColumnValue { Columnid = this.outputStatesColumnId, Value = DataEncoder.EncodeOutputStates(unspentTx.OutputStates) });

                        jetUpdate.Save();
                    }

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