(self)
| 40 | self.supports_cli = False |
| 41 | |
| 42 | def setup_chain(self): |
| 43 | super().setup_chain() |
| 44 | #Append rpcauth to bitcoin.conf before initialization |
| 45 | self.rtpassword = "cA773lm788buwYe4g4WT+05pKyNruVKjQ25x3n0DQcM=" |
| 46 | rpcauth = "rpcauth=rt:93648e835a54c573682c2eb19f882535$7681e9c5b74bdd85e78166031d2058e1069b3ed7ed967c93fc63abba06f31144" |
| 47 | |
| 48 | self.rpcuser = "rpcuser💻" |
| 49 | self.rpcpassword = "rpcpassword🔑" |
| 50 | |
| 51 | config = configparser.ConfigParser() |
| 52 | config.read_file(open(self.options.configfile)) |
| 53 | gen_rpcauth = config['environment']['RPCAUTH'] |
| 54 | |
| 55 | # Generate RPCAUTH with specified password |
| 56 | self.rt2password = "8/F3uMDw4KSEbw96U3CA1C4X05dkHDN2BPFjTgZW4KI=" |
| 57 | p = subprocess.Popen([sys.executable, gen_rpcauth, 'rt2', self.rt2password], stdout=subprocess.PIPE, universal_newlines=True) |
| 58 | lines = p.stdout.read().splitlines() |
| 59 | rpcauth2 = lines[1] |
| 60 | |
| 61 | # Generate RPCAUTH without specifying password |
| 62 | self.user = ''.join(SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(10)) |
| 63 | p = subprocess.Popen([sys.executable, gen_rpcauth, self.user], stdout=subprocess.PIPE, universal_newlines=True) |
| 64 | lines = p.stdout.read().splitlines() |
| 65 | rpcauth3 = lines[1] |
| 66 | self.password = lines[3] |
| 67 | |
| 68 | with open(os.path.join(get_datadir_path(self.options.tmpdir, 0), "elements.conf"), 'a', encoding='utf8') as f: |
| 69 | f.write(rpcauth + "\n") |
| 70 | f.write(rpcauth2 + "\n") |
| 71 | f.write(rpcauth3 + "\n") |
| 72 | with open(os.path.join(get_datadir_path(self.options.tmpdir, 1), "elements.conf"), 'a', encoding='utf8') as f: |
| 73 | f.write("rpcuser={}\n".format(self.rpcuser)) |
| 74 | f.write("rpcpassword={}\n".format(self.rpcpassword)) |
| 75 | |
| 76 | def test_auth(self, node, user, password): |
| 77 | self.log.info('Correct...') |
nothing calls this directly
no test coverage detected