prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Suicidal detector fails on external functions
  If the [example](https://github.com/crytic/slither/wiki/Detector-Documentation#suicidal) function for the suicidal detector is changed from `public` to `external` the issue is no longer flagged.
  
  ```
  pragma solidity ^0.5.0;
  contract Suicidal{
      function kill() external{
          selfdestruct(msg.sender);
      }
  }
  ```
  
  `slither --version`: 0.6.12
  `solc --version`: 0.5.15
  Suicidal detector fails on external functions
  If the [example](https://github.com/crytic/slither/wiki/Detector-Documentation#suicidal) function for the suicidal detector is changed from `public` to `external` the issue is no longer flagged.
  
  ```
  pragma solidity ^0.5.0;
  contract Suicidal{
      function kill() external{
          selfdestruct(msg.sender);
      }
  }
  ```
  
  `slither --version`: 0.6.12
  `solc --version`: 0.5.15
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `slither/detectors/functions/suicidal.py`
  Content:
  ```
  1 """
  2 Module detecting suicidal contract
  3 
  4 A suicidal contract is an unprotected function that calls selfdestruct
  5 """
  6 
  7 from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification
  8 
  9 
  10 class Suicidal(AbstractDetector):
  11     """
  12     Unprotected function detector
  13     """
  14 
  15     ARGUMENT = 'suicidal'
  16     HELP = 'Functions allowing anyone to destruct the contract'
  17     IMPACT = DetectorClassification.HIGH
  18     CONFIDENCE = DetectorClassification.HIGH
  19 
  20     WIKI = 'https://github.com/crytic/slither/wiki/Detector-Documentation#suicidal'
  21 
  22 
  23     WIKI_TITLE = 'Suicidal'
  24     WIKI_DESCRIPTION = 'Unprotected call to a function executing `selfdestruct`/`suicide`.'
  25     WIKI_EXPLOIT_SCENARIO = '''
  26 ```solidity
  27 contract Suicidal{
  28     function kill() public{
  29         selfdestruct(msg.sender);
  30     }
  31 }
  32 ```
  33 Bob calls `kill` and destructs the contract.'''
  34 
  35     WIKI_RECOMMENDATION = 'Protect access to all sensitive functions.'
  36 
  37     @staticmethod
  38     def detect_suicidal_func(func):
  39         """ Detect if the function is suicidal
  40 
  41         Detect the public functions calling suicide/selfdestruct without protection
  42         Returns:
  43             (bool): True if the function is suicidal
  44         """
  45 
  46         if func.is_constructor:
  47             return False
  48 
  49         if func.visibility != 'public':
  50             return False
  51 
  52         calls = [c.name for c in func.internal_calls]
  53         if not ('suicide(address)' in calls or 'selfdestruct(address)' in calls):
  54             return False
  55 
  56         if func.is_protected():
  57             return False
  58 
  59         return True
  60 
  61     def detect_suicidal(self, contract):
  62         ret = []
  63         for f in [f for f in contract.functions if f.contract_declarer == contract]:
  64             if self.detect_suicidal_func(f):
  65                 ret.append(f)
  66         return ret
  67 
  68     def _detect(self):
  69         """ Detect the suicidal functions
  70         """
  71         results = []
  72         for c in self.contracts:
  73             functions = self.detect_suicidal(c)
  74             for func in functions:
  75 
  76                 info = [func, " allows anyone to destruct the contract\n"]
  77 
  78                 res = self.generate_result(info)
  79 
  80                 results.append(res)
  81 
  82         return results
  83
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/slither/detectors/functions/suicidal.py b/slither/detectors/functions/suicidal.py
  --- a/slither/detectors/functions/suicidal.py
  +++ b/slither/detectors/functions/suicidal.py
  @@ -46,7 +46,7 @@
           if func.is_constructor:
               return False
   
  -        if func.visibility != 'public':
  +        if func.visibility not in ['public', 'external']:
               return False
   
           calls = [c.name for c in func.internal_calls]
  @@ -60,7 +60,7 @@
   
       def detect_suicidal(self, contract):
           ret = []
  -        for f in [f for f in contract.functions if f.contract_declarer == contract]:
  +        for f in contract.functions_declared:
               if self.detect_suicidal_func(f):
                   ret.append(f)
           return ret
  
verification_info: {"golden_diff": "diff --git a/slither/detectors/functions/suicidal.py b/slither/detectors/functions/suicidal.py\n--- a/slither/detectors/functions/suicidal.py\n+++ b/slither/detectors/functions/suicidal.py\n@@ -46,7 +46,7 @@\n         if func.is_constructor:\n             return False\n \n-        if func.visibility != 'public':\n+        if func.visibility not in ['public', 'external']:\n             return False\n \n         calls = [c.name for c in func.internal_calls]\n@@ -60,7 +60,7 @@\n \n     def detect_suicidal(self, contract):\n         ret = []\n-        for f in [f for f in contract.functions if f.contract_declarer == contract]:\n+        for f in contract.functions_declared:\n             if self.detect_suicidal_func(f):\n                 ret.append(f)\n         return ret\n", "issue": "Suicidal detector fails on external functions\nIf the [example](https://github.com/crytic/slither/wiki/Detector-Documentation#suicidal) function for the suicidal detector is changed from `public` to `external` the issue is no longer flagged.\r\n\r\n```\r\npragma solidity ^0.5.0;\r\ncontract Suicidal{\r\n    function kill() external{\r\n        selfdestruct(msg.sender);\r\n    }\r\n}\r\n```\r\n\r\n`slither --version`: 0.6.12\r\n`solc --version`: 0.5.15\nSuicidal detector fails on external functions\nIf the [example](https://github.com/crytic/slither/wiki/Detector-Documentation#suicidal) function for the suicidal detector is changed from `public` to `external` the issue is no longer flagged.\r\n\r\n```\r\npragma solidity ^0.5.0;\r\ncontract Suicidal{\r\n    function kill() external{\r\n        selfdestruct(msg.sender);\r\n    }\r\n}\r\n```\r\n\r\n`slither --version`: 0.6.12\r\n`solc --version`: 0.5.15\n", "before_files": [{"content": "\"\"\"\nModule detecting suicidal contract\n\nA suicidal contract is an unprotected function that calls selfdestruct\n\"\"\"\n\nfrom slither.detectors.abstract_detector import AbstractDetector, DetectorClassification\n\n\nclass Suicidal(AbstractDetector):\n    \"\"\"\n    Unprotected function detector\n    \"\"\"\n\n    ARGUMENT = 'suicidal'\n    HELP = 'Functions allowing anyone to destruct the contract'\n    IMPACT = DetectorClassification.HIGH\n    CONFIDENCE = DetectorClassification.HIGH\n\n    WIKI = 'https://github.com/crytic/slither/wiki/Detector-Documentation#suicidal'\n\n\n    WIKI_TITLE = 'Suicidal'\n    WIKI_DESCRIPTION = 'Unprotected call to a function executing `selfdestruct`/`suicide`.'\n    WIKI_EXPLOIT_SCENARIO = '''\n```solidity\ncontract Suicidal{\n    function kill() public{\n        selfdestruct(msg.sender);\n    }\n}\n```\nBob calls `kill` and destructs the contract.'''\n\n    WIKI_RECOMMENDATION = 'Protect access to all sensitive functions.'\n\n    @staticmethod\n    def detect_suicidal_func(func):\n        \"\"\" Detect if the function is suicidal\n\n        Detect the public functions calling suicide/selfdestruct without protection\n        Returns:\n            (bool): True if the function is suicidal\n        \"\"\"\n\n        if func.is_constructor:\n            return False\n\n        if func.visibility != 'public':\n            return False\n\n        calls = [c.name for c in func.internal_calls]\n        if not ('suicide(address)' in calls or 'selfdestruct(address)' in calls):\n            return False\n\n        if func.is_protected():\n            return False\n\n        return True\n\n    def detect_suicidal(self, contract):\n        ret = []\n        for f in [f for f in contract.functions if f.contract_declarer == contract]:\n            if self.detect_suicidal_func(f):\n                ret.append(f)\n        return ret\n\n    def _detect(self):\n        \"\"\" Detect the suicidal functions\n        \"\"\"\n        results = []\n        for c in self.contracts:\n            functions = self.detect_suicidal(c)\n            for func in functions:\n\n                info = [func, \" allows anyone to destruct the contract\\n\"]\n\n                res = self.generate_result(info)\n\n                results.append(res)\n\n        return results\n", "path": "slither/detectors/functions/suicidal.py"}], "after_files": [{"content": "\"\"\"\nModule detecting suicidal contract\n\nA suicidal contract is an unprotected function that calls selfdestruct\n\"\"\"\n\nfrom slither.detectors.abstract_detector import AbstractDetector, DetectorClassification\n\n\nclass Suicidal(AbstractDetector):\n    \"\"\"\n    Unprotected function detector\n    \"\"\"\n\n    ARGUMENT = 'suicidal'\n    HELP = 'Functions allowing anyone to destruct the contract'\n    IMPACT = DetectorClassification.HIGH\n    CONFIDENCE = DetectorClassification.HIGH\n\n    WIKI = 'https://github.com/crytic/slither/wiki/Detector-Documentation#suicidal'\n\n\n    WIKI_TITLE = 'Suicidal'\n    WIKI_DESCRIPTION = 'Unprotected call to a function executing `selfdestruct`/`suicide`.'\n    WIKI_EXPLOIT_SCENARIO = '''\n```solidity\ncontract Suicidal{\n    function kill() public{\n        selfdestruct(msg.sender);\n    }\n}\n```\nBob calls `kill` and destructs the contract.'''\n\n    WIKI_RECOMMENDATION = 'Protect access to all sensitive functions.'\n\n    @staticmethod\n    def detect_suicidal_func(func):\n        \"\"\" Detect if the function is suicidal\n\n        Detect the public functions calling suicide/selfdestruct without protection\n        Returns:\n            (bool): True if the function is suicidal\n        \"\"\"\n\n        if func.is_constructor:\n            return False\n\n        if func.visibility not in ['public', 'external']:\n            return False\n\n        calls = [c.name for c in func.internal_calls]\n        if not ('suicide(address)' in calls or 'selfdestruct(address)' in calls):\n            return False\n\n        if func.is_protected():\n            return False\n\n        return True\n\n    def detect_suicidal(self, contract):\n        ret = []\n        for f in contract.functions_declared:\n            if self.detect_suicidal_func(f):\n                ret.append(f)\n        return ret\n\n    def _detect(self):\n        \"\"\" Detect the suicidal functions\n        \"\"\"\n        results = []\n        for c in self.contracts:\n            functions = self.detect_suicidal(c)\n            for func in functions:\n\n                info = [func, \" allows anyone to destruct the contract\\n\"]\n\n                res = self.generate_result(info)\n\n                results.append(res)\n\n        return results\n", "path": "slither/detectors/functions/suicidal.py"}]}