internal MemoryStorageManager(ChainedHeader chainTip = null, int? unspentTxCount = null, int? unspentOutputCount = null, int? totalTxCount = null, int? totalInputCount = null, int? totalOutputCount = null, ImmutableSortedDictionary<UInt256, ChainedHeader> headers = null, ImmutableSortedDictionary<UInt256, UnspentTx> unspentTransactions = null, ImmutableDictionary<int, BlockSpentTxes> spentTransactions = null)
        {
            blockStorage = new MemoryBlockStorage();
            blockTxesStorage = new MemoryBlockTxesStorage();
            chainStateStorage = new MemoryChainStateStorage(chainTip, unspentTxCount, unspentOutputCount, totalTxCount, totalInputCount, totalOutputCount, headers, unspentTransactions, spentTransactions);
            unconfirmedTxesStorage = new MemoryUnconfirmedTxesStorage();

            chainStateCursorCache = new DisposableCache<IChainStateCursor>(1024,
                createFunc: () => new MemoryChainStateCursor(chainStateStorage),
                prepareAction: cursor =>
                {
                    // rollback any open transaction before returning the cursor to the cache
                    if (cursor.InTransaction)
                        cursor.RollbackTransaction();
                });

            unconfirmedTxesCursorCache = new DisposableCache<IUnconfirmedTxesCursor>(1024,
                createFunc: () => new MemoryUnconfirmedTxesCursor(unconfirmedTxesStorage),
                prepareAction: cursor =>
                {
                    // rollback any open transaction before returning the cursor to the cache
                    if (cursor.InTransaction)
                        cursor.RollbackTransaction();
                });
        }
Example #2
0
        internal MemoryStorageManager(ChainedHeader chainTip = null, int?unspentTxCount = null, int?unspentOutputCount = null, int?totalTxCount = null, int?totalInputCount = null, int?totalOutputCount = null, ImmutableSortedDictionary <UInt256, ChainedHeader> headers = null, ImmutableSortedDictionary <UInt256, UnspentTx> unspentTransactions = null, ImmutableDictionary <int, BlockSpentTxes> spentTransactions = null)
        {
            blockStorage           = new MemoryBlockStorage();
            blockTxesStorage       = new MemoryBlockTxesStorage();
            chainStateStorage      = new MemoryChainStateStorage(chainTip, unspentTxCount, unspentOutputCount, totalTxCount, totalInputCount, totalOutputCount, headers, unspentTransactions, spentTransactions);
            unconfirmedTxesStorage = new MemoryUnconfirmedTxesStorage();

            chainStateCursorCache = new DisposableCache <IChainStateCursor>(1024,
                                                                            createFunc: () => new MemoryChainStateCursor(chainStateStorage),
                                                                            prepareAction: cursor =>
            {
                // rollback any open transaction before returning the cursor to the cache
                if (cursor.InTransaction)
                {
                    cursor.RollbackTransaction();
                }
            });

            unconfirmedTxesCursorCache = new DisposableCache <IUnconfirmedTxesCursor>(1024,
                                                                                      createFunc: () => new MemoryUnconfirmedTxesCursor(unconfirmedTxesStorage),
                                                                                      prepareAction: cursor =>
            {
                // rollback any open transaction before returning the cursor to the cache
                if (cursor.InTransaction)
                {
                    cursor.RollbackTransaction();
                }
            });
        }
Example #3
0
 internal MemoryChainStateCursor(MemoryChainStateStorage chainStateStorage)
 {
     this.chainStateStorage = chainStateStorage;
 }
 internal MemoryChainStateCursor(MemoryChainStateStorage chainStateStorage)
 {
     this.chainStateStorage = chainStateStorage;
 }
Example #5
0
 internal MemoryStorageManager(Chain chain = null, ImmutableSortedDictionary <UInt256, UnspentTx> unspentTransactions = null, ImmutableDictionary <int, IImmutableList <SpentTx> > spentTransactions = null)
 {
     this.blockStorage      = new MemoryBlockStorage();
     this.blockTxesStorage  = new MemoryBlockTxesStorage();
     this.chainStateStorage = new MemoryChainStateStorage(chain, unspentTransactions, spentTransactions);
 }