public bool NewTransaction(Transaction transaction, NodeConnection connection) { if (transaction == null || transaction.TargetChainId != ChainId) { return(false); } if (_blockStorage.HistoryContainsTransactionOrRegistration(transaction) != TransactionResultTypes.Ok) { return(false); } lock (_lock) { if (_transactions.ContainsKey(transaction.UniqueIdentifier)) { return(false); } _transactions[transaction.UniqueIdentifier] = transaction; } // broadcast to other members, if it's not from a member if (connection == null) { _ = Broadcast(new NodeTransactionMessage(transaction, 0) { SignKey = _node.NodeConfiguration.LocaleNodePrivateKey }, null); } else { lock (_lock) { if (!_voteConnections.Contains(connection)) { _ = Broadcast(new NodeTransactionMessage(transaction, 0) { SignKey = _node.NodeConfiguration.LocaleNodePrivateKey }, connection.NodeInfo.NodeId); } } } return(true); }