private bool AddTransaction(Transaction tx, bool verify) { if (context.Snapshot.ContainsTransaction(tx.Hash) || (verify && !tx.Verify(context.Snapshot, context.Transactions.Values)) || !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.Signatures[context.MyIndex] = context.MakeHeader().Sign(context.KeyPair); SignAndRelay(context.MakePrepareResponse(context.Signatures[context.MyIndex])); CheckSignatures(); } else { RequestChangeView(); return(false); } } return(true); }