Repository: madMAx43v3r/chia-plotter
File: src/chia_plot.cpp (C++)

Code before:
		return -2;
	}
	if(contract_addr_str.empty() && pool_key_str.empty()) {
		std::cout << "Pool Public Key (for solo farming) or Pool Contract Address (for pool farming) needs to be specified via -p or -c, see `chia_plot --help`." << std::endl;
		return -2;
	}
	if(!contract_addr_str.empty() && !pool_key_str.empty()) {
		std::cout << "Choose either Pool Public Key (for solo farming) or Pool Contract Address (for pool farming), see `chia_plot --help`." << std::endl;
		return -2;
	}
	if(farmer_key_str.empty()) {
		std::cout << "Farmer Public Key (48 bytes) needs to be specified via -f, see `chia keys show`." << std::endl;
		return -2;
	}
	if(tmp_dir.empty()) {
		std::cout << "tmpdir needs to be specified via -t path/" << std::endl;
		return -2;
	}
	if(tmp_dir2.empty()) {
		tmp_dir2 = tmp_dir;
	}
	if(final_dir.empty()) {
		final_dir = tmp_dir;
	}
	if(stage_dir.empty()) {
		stage_dir = final_dir;
	}
	if(num_buckets_3 <= 0) {
		num_buckets_3 = num_buckets;
	}
	switch(port) {
		case 11337: make_unique = true; break;
	}
	std::vector<uint8_t> pool_key;
	std::vector<uint8_t> puzzle_hash;
	const auto farmer_key = hex_to_bytes(farmer_key_str);
	const int log_num_buckets = num_buckets >= 16 ? int(log2(num_buckets)) : num_buckets;
	const int log_num_buckets_3 = num_buckets_3 >= 16 ? int(log2(num_buckets_3)) : num_buckets_3;

	if(contract_addr_str.empty()) {
		pool_key = hex_to_bytes(pool_key_str);
		if(pool_key.size() != bls::G1Element::SIZE) {
			std::cout << "Invalid poolkey: " << bls::Util::HexStr(pool_key) << ", '" << pool_key_str
				<< "' (needs to be " << bls::G1Element::SIZE << " bytes, see `chia keys show`)" << std::endl;
			return -2;
		}
	}
	else {
		try {
			puzzle_hash = bech32_address_decode(contract_addr_str);
			if(puzzle_hash.size() != 32) {

Review comment (suggestion):
`stage_dir` should be `tmp_dir` by default. otherwise it's like `directout` would be enabled by default.

Code after:
		return -2;
	}
	if(contract_addr_str.empty() && pool_key_str.empty()) {
		std::cout << "Pool Public Key (for solo farming) or Pool Contract Address (for pool farming) needs to be specified via -p or -c, see `chia_plot --help`." << std::endl;
		return -2;
	}
	if(!contract_addr_str.empty() && !pool_key_str.empty()) {
		std::cout << "Choose either Pool Public Key (for solo farming) or Pool Contract Address (for pool farming), see `chia_plot --help`." << std::endl;
		return -2;
	}
	if(farmer_key_str.empty()) {
		std::cout << "Farmer Public Key (48 bytes) needs to be specified via -f, see `chia keys show`." << std::endl;
		return -2;
	}
	if(tmp_dir.empty()) {
		std::cout << "tmpdir needs to be specified via -t path/" << std::endl;
		return -2;
	}
	if(tmp_dir2.empty()) {
		tmp_dir2 = tmp_dir;
	}
	if(final_dir.empty()) {
		final_dir = tmp_dir;
	}
	if(!stage_dir.empty() && tmptoggle) {
		std::cout << "Stagedir and tmptoggle are mutually exclusive options." << std::endl;
		return -2;
	}
	if(!stage_dir.empty() && stage_dir.find_last_of("/\\") != stage_dir.size() - 1) {
		std::cout << "Invalid stagedir: " << stage_dir << " (needs trailing '/' or '\\')" << std::endl;
		return -2;
	}
	if(stage_dir.empty()) {
		stage_dir = tmp_dir;
	}
	if(num_buckets_3 <= 0) {
		num_buckets_3 = num_buckets;
	}
	switch(port) {
		case 11337: make_unique = true; break;
	}
	std::vector<uint8_t> pool_key;
	std::vector<uint8_t> puzzle_hash;
	const auto farmer_key = hex_to_bytes(farmer_key_str);
	const int log_num_buckets = num_buckets >= 16 ? int(log2(num_buckets)) : num_buckets;
	const int log_num_buckets_3 = num_buckets_3 >= 16 ? int(log2(num_buckets_3)) : num_buckets_3;

	if(contract_addr_str.empty()) {
		pool_key = hex_to_bytes(pool_key_str);
		if(pool_key.size() != bls::G1Element::SIZE) {
			std::cout << "Invalid poolkey: " << bls::Util::HexStr(pool_key) << ", '" << pool_key_str