src/Stratis.FederatedPeg.Features.FederationGateway/TargetChain/CrossChainTransferStore.cs
/// <summary>Attempts to synchronizes the store with the chain.</summary>
/// <returns>Returns <c>true</c> if the store is in sync or <c>false</c> otherwise.</returns>
Attempts to synchronizes the store with the chain.
Attempts to synchronizes the store with the chain .
private bool Synchronize()
        {
            lock (this.lockObj)
            {
                HashHeightPair tipToChase = this.TipToChase();
                if (tipToChase.Hash == this.TipHashAndHeight.HashBlock)
                {
                    this.logger.LogTrace("(-)[SYNCHRONIZED]:true");
                    return true;
                }
                while (!this.cancellation.IsCancellationRequested)
                {
                    if (this.HasSuspended())
                    {
                        ICrossChainTransfer[] transfers = this.Get(this.depositsIdsByStatus[CrossChainTransferStatus.Suspended].ToArray());
                        this.NextMatureDepositHeight = transfers.Min(t => t.DepositHeight) ?? this.NextMatureDepositHeight;
                    }
                    this.RewindIfRequired();
                    if (this.SynchronizeBatch())
                    {
                        using (DBreeze.Transactions.Transaction dbreezeTransaction = this.DBreeze.GetTransaction())
                        {
                            dbreezeTransaction.SynchronizeTables(transferTableName, commonTableName);
                            this.SaveTipHashAndHeight(dbreezeTransaction, this.TipHashAndHeight);
                            dbreezeTransaction.Commit();
                        }
                        return true;
                    }
                }
                return false;
            }
        }
private bool Synchronize ( ) { lock ( this . lockObj ) { HashHeightPair tipToChase = this . TipToChase ( ) ; if ( tipToChase . Hash == this . TipHashAndHeight . HashBlock ) { this . logger . LogTrace ( " " ) ; return true ; } while ( ! this . cancellation . IsCancellationRequested ) { if ( this . HasSuspended ( ) ) { ICrossChainTransfer [ ] transfers = this . Get ( this . depositsIdsByStatus [ CrossChainTransferStatus . Suspended ] . ToArray ( ) ) ; this . NextMatureDepositHeight = transfers . Min ( t => t . DepositHeight ) ?? this . NextMatureDepositHeight ; } this . RewindIfRequired ( ) ; if ( this . SynchronizeBatch ( ) ) { using ( DBreeze . Transactions . Transaction dbreezeTransaction = this . DBreeze . GetTransaction ( ) ) { dbreezeTransaction . SynchronizeTables ( transferTableName , commonTableName ) ; this . SaveTipHashAndHeight ( dbreezeTransaction , this . TipHashAndHeight ) ; dbreezeTransaction . Commit ( ) ; } return true ; } } return false ; } }
Attempts to synchronizes the store with the chain.
Attempts to synchronizes the store with the chain .
// Indicate that we are synchronized.
None