public void RollbackBlock(ChainedHeader chainedHeader, IEnumerable <BlockTx> blockTxes) { var unconfirmedTxes = ImmutableDictionary.CreateBuilder <UInt256, BlockTx>(); updateLock.DoWrite(() => { using (var handle = storageManager.OpenUnconfirmedTxesCursor()) { var unconfirmedTxesCursor = handle.Item; unconfirmedTxesCursor.BeginTransaction(); var newChain = chain.Value.ToBuilder().RemoveBlock(chainedHeader).ToImmutable(); foreach (var blockTx in blockTxes) { unconfirmedTxes.Add(blockTx.Hash, blockTx); } unconfirmedTxesCursor.ChainTip = chainedHeader; commitLock.DoWrite(() => { unconfirmedTxesCursor.CommitTransaction(); chain = new Lazy <Chain>(() => newChain).Force(); }); } }); TxesUnconfirmed?.Invoke(this, new TxesUnconfirmedEventArgs(chainedHeader, unconfirmedTxes.ToImmutable())); }
private void RaiseTxesUnconfirmed(object sender, TxesUnconfirmedEventArgs e) { TxesUnconfirmed?.Invoke(this, e); }