src/Stratis.Features.FederatedPeg/TargetChain/CrossChainTransferStore.cs
/// <summary>Performs any needed initialisation for the database.</summary>
Performs any needed initialisation for the database.
Performs any needed initialisation for the database .
public void Initialize()
        {
            lock (this.lockObj)
            {
                using (DBreeze.Transactions.Transaction dbreezeTransaction = this.DBreeze.GetTransaction())
                {
                    dbreezeTransaction.ValuesLazyLoadingIsOn = false;
                    this.LoadTipHashAndHeight(dbreezeTransaction);
                    this.LoadNextMatureHeight(dbreezeTransaction);
                    foreach (Row<byte[], byte[]> transferRow in dbreezeTransaction.SelectForward<byte[], byte[]>(transferTableName))
                    {
                        var transfer = new CrossChainTransfer();
                        transfer.FromBytes(transferRow.Value, this.network.Consensus.ConsensusFactory);
                        this.depositsIdsByStatus[transfer.Status].Add(transfer.DepositTransactionId);
                        if (transfer.BlockHash != null && transfer.BlockHeight != null)
                        {
                            if (!this.depositIdsByBlockHash.TryGetValue(transfer.BlockHash, out HashSet<uint256> deposits))
                            {
                                deposits = new HashSet<uint256>();
                                this.depositIdsByBlockHash[transfer.BlockHash] = deposits;
                            }
                            deposits.Add(transfer.DepositTransactionId);
                            this.blockHeightsByBlockHash[transfer.BlockHash] = (int)transfer.BlockHeight;
                        }
                    }
                }
            }
        }
public void Initialize ( ) { lock ( this . lockObj ) { using ( DBreeze . Transactions . Transaction dbreezeTransaction = this . DBreeze . GetTransaction ( ) ) { dbreezeTransaction . ValuesLazyLoadingIsOn = false ; this . LoadTipHashAndHeight ( dbreezeTransaction ) ; this . LoadNextMatureHeight ( dbreezeTransaction ) ; foreach ( Row < byte [ ] , byte [ ] > transferRow in dbreezeTransaction . SelectForward < byte [ ] , byte [ ] > ( transferTableName ) ) { var transfer = new CrossChainTransfer ( ) ; transfer . FromBytes ( transferRow . Value , this . network . Consensus . ConsensusFactory ) ; this . depositsIdsByStatus [ transfer . Status ] . Add ( transfer . DepositTransactionId ) ; if ( transfer . BlockHash != null && transfer . BlockHeight != null ) { if ( ! this . depositIdsByBlockHash . TryGetValue ( transfer . BlockHash , out HashSet < uint256 > deposits ) ) { deposits = new HashSet < uint256 > ( ) ; this . depositIdsByBlockHash [ transfer . BlockHash ] = deposits ; } deposits . Add ( transfer . DepositTransactionId ) ; this . blockHeightsByBlockHash [ transfer . BlockHash ] = ( int ) transfer . BlockHeight ; } } } } }
Performs any needed initialisation for the database.
Performs any needed initialisation for the database .
// Initialize the lookups.