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;
}
}
}