src/Stratis.FederatedPeg.Features.FederationGateway/TargetChain/CrossChainTransferStore.cs
/// <summary>Persist multiple cross-chain transfer information into the database.</summary>
/// <param name="dbreezeTransaction">The DBreeze transaction context to use.</param>
/// <param name="crossChainTransfers">Cross-chain transfers to be inserted.</param>
Persist multiple cross-chain transfer information into the database.
Persist multiple cross - chain transfer information into the database .
private void PutTransfers(DBreeze.Transactions.Transaction dbreezeTransaction, ICrossChainTransfer[] crossChainTransfers)
        {
            Guard.NotNull(crossChainTransfers, nameof(crossChainTransfers));
            var byteListComparer = new ByteListComparer();
            List<ICrossChainTransfer> orderedTransfers = crossChainTransfers.ToList();
            orderedTransfers.Sort((pair1, pair2) => byteListComparer.Compare(pair1.DepositTransactionId.ToBytes(), pair2.DepositTransactionId.ToBytes()));
            foreach (ICrossChainTransfer transfer in orderedTransfers)
            {
                byte[] transferBytes = this.dBreezeSerializer.Serialize(transfer);
                dbreezeTransaction.Insert<byte[], byte[]>(transferTableName, transfer.DepositTransactionId.ToBytes(), transferBytes);
            }
        }
private void PutTransfers ( DBreeze . Transactions . Transaction dbreezeTransaction , ICrossChainTransfer [ ] crossChainTransfers ) { Guard . NotNull ( crossChainTransfers , nameof ( crossChainTransfers ) ) ; var byteListComparer = new ByteListComparer ( ) ; List < ICrossChainTransfer > orderedTransfers = crossChainTransfers . ToList ( ) ; orderedTransfers . Sort ( ( pair1 , pair2 ) => byteListComparer . Compare ( pair1 . DepositTransactionId . ToBytes ( ) , pair2 . DepositTransactionId . ToBytes ( ) ) ) ; foreach ( ICrossChainTransfer transfer in orderedTransfers ) { byte [ ] transferBytes = this . dBreezeSerializer . Serialize ( transfer ) ; dbreezeTransaction . Insert < byte [ ] , byte [ ] > ( transferTableName , transfer . DepositTransactionId . ToBytes ( ) , transferBytes ) ; } }
Persist multiple cross-chain transfer information into the database.
Persist multiple cross - chain transfer information into the database .
// Optimal ordering for DB consumption. // Write each transfer in order.
dbreezeTransaction
DBreeze.Transactions.Transaction
The DBreeze transaction context to use.
The DBreeze transaction context to use .
crossChainTransfers
ICrossChainTransfer[]
Cross-chain transfers to be inserted.
Cross - chain transfers to be inserted .