예제 #1
0
 public void Notify(SignedLedger ledger)
 {
     foreach (var subscriptor in subscriptors)
     {
         var notification = new ConfirmationNotification()
         {
             Hash         = ledger.Hash.ToBase64(),
             Height       = ledger.GetHeight(),
             Timestamp    = ledger.GetTimestamp(),
             Transactions = GetTransactions(subscriptor.Value, ledger)
         };
         Send(subscriptor.Key, new NotificationMessage(notification));
     }
 }
 public void Notify(SignedLedger ledger)
 {
     foreach (var subscriptor in subscriptors)
     {
         var notification = new LedgerNotification()
         {
             Hash         = ledger.Hash.ToBase64(),
             Height       = ledger.GetHeight(),
             Timestamp    = ledger.GetTimestamp(),
             Transactions = ledger.Ledger.Block.Transactions.Count()
         };
         Send(subscriptor, new NotificationMessage(notification));
     }
 }
예제 #3
0
        // we create a new ledger state based on the current state and the new ledger
        private LedgerPostState CreateLedgerState(SignedLedger signedLedger)
        {
            var state = new LedgerPostState(LedgerState, signedLedger.GetHeight())
            {
                AccountCreated = account => LiveService.AccountManager.AddAccount(account.Address, new ExtendedAccount(account))
            };

            byte index = 0;

            foreach (var signed in signedLedger.Ledger.Block.Transactions)
            {
                // TODO make a better validation
                // Debug.Assert(signed.Transaction.Expire > signedLedger.Ledger.LedgerLight.BeginTime);
                Debug.Assert(signedLedger.Ledger.Block.FeeTransactionIndex == index++ || LiveService.TransactionManager.TransactionValidator.ValidateBalance(state, signed.Transaction.GetInputs()));
                LedgerService.SignedTransactionManager.Execute(state, signed.Transaction);
            }

            return(state);
        }