public bool TryAddUnspentTxOutput(TxOutputKey txOutputKey, TxOutput txOutput)
{
CheckWriteTransaction();
using (SetSessionContext())
{
try
{
using (var jetUpdate = this.jetSession.BeginUpdate(this.unspentTxOutputTableId, JET_prep.Insert))
{
Api.SetColumns(this.jetSession, this.unspentTxOutputTableId,
new BytesColumnValue { Columnid = this.txOutputKeyColumnId, Value = DbEncoder.EncodeTxOutputKey(txOutputKey) },
new BytesColumnValue { Columnid = this.txOutputBytesColumnId, Value = DataEncoder.EncodeTxOutput(txOutput) });
jetUpdate.Save();
}
return true;
}
catch (EsentKeyDuplicateException)
{
return false;
}
}
}