private bool AddTransaction(Transaction tx, bool verify) { if (context.ContainsTransaction(tx.Hash) || (verify && !context.VerifyTransaction(tx)) || !Plugin.CheckPolicy(tx)) { Log($"reject tx: {tx.Hash}{Environment.NewLine}{tx.ToArray().ToHexString()}", LogLevel.Warning); RequestChangeView(); return(false); } context.Transactions[tx.Hash] = tx; if (context.TransactionHashes.Length == context.Transactions.Count) { if (context.VerifyRequest()) { Log($"send prepare response"); context.State |= ConsensusState.SignatureSent; context.SignHeader(); localNode.Tell(new LocalNode.SendDirectly { Inventory = context.MakePrepareResponse(context.Signatures[context.MyIndex]) }); CheckSignatures(); } else { RequestChangeView(); return(false); } } return(true); }