def get_status(self, clearance=6): netcode = keys.netcode_from_wif(self.api.auth_wif) return self.full_duplex_channel_status(self.handle, netcode, self.c2h_state, self.h2c_state, self.secrets.get, clearance=clearance)
def can_cull(self): netcode = keys.netcode_from_wif(self.api.auth_wif) scripts = [self.c2h_state["deposit_script"]] scripts += [c["script"] for c in self.c2h_state["commits_active"]] scripts += [c["script"] for c in self.c2h_state["commits_revoked"]] scripts += [c["script"] for c in self.h2c_state["commits_active"]] scripts += [c["script"] for c in self.h2c_state["commits_revoked"]] for script in scripts: address = util.script_address(script, netcode) if self.address_in_use(address): return False return True
def finalize_commit(self, get_wif_func, state): commit = self.api.mpc_highest_commit(state=state) if commit is None: return None deposit_script = state["deposit_script"] pubkey = scripts.get_deposit_payee_pubkey(deposit_script) wif = get_wif_func(pubkey=pubkey) rawtx = scripts.sign_finalize_commit(self.get_rawtx, wif, commit["rawtx"], deposit_script) netcode = keys.netcode_from_wif(wif) deposit_address = util.script_address(deposit_script, netcode) deposit_utxos = self.api.get_unspent_txouts(address=deposit_address, unconfirmed=False) if self._can_publish(rawtx, deposit_utxos) and self.publish(rawtx): return rawtx return None