Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnessary judgement when compose joint #90

Closed
ianhhhhhhhhe opened this issue Mar 24, 2018 · 0 comments
Closed

Unnessary judgement when compose joint #90

ianhhhhhhhhe opened this issue Mar 24, 2018 · 0 comments

Comments

@ianhhhhhhhhe
Copy link

In composer.js , after the code that judge the type of client

	if (conf.bLight && !params.lightProps){
		var network = require('./network.js');
		network.requestFromLightVendor(
			'light/get_parents_and_last_ball_and_witness_list_unit', 
			{witnesses: arrWitnesses}, 
			function(ws, request, response){
				if (response.error)
					return params.callbacks.ifError(response.error);
				if (!response.parent_units || !response.last_stable_mc_ball || !response.last_stable_mc_ball_unit || typeof response.last_stable_mc_ball_mci !== 'number')
					return params.callbacks.ifError("invalid parents from light vendor");
				params.lightProps = response;
				composeJoint(params);
			}
		);
		return;
	}

(line 383)

, the program judge it again.

	if (conf.bLight && !lightProps)
		throw Error("no parent props for light");

(line 436)

Why?

If I am using a light client, after I get all information from the vendor, the params.lightProps will be deleted and the lightProps must be null, and the the code will be an unnecessary code. Am I thinking right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant