Skip to content

Commit

Permalink
Merge pull request #994 from toxeus/worklmt
Browse files Browse the repository at this point in the history
eliminate settings::work_limit()
  • Loading branch information
evoskuil committed Jul 17, 2018
2 parents 30ea853 + 3671f6a commit 6e19dad
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
2 changes: 0 additions & 2 deletions include/bitcoin/bitcoin/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ class BC_API settings
public:
settings();

uint32_t work_limit(bool retarget=true) const;

uint32_t retargeting_factor;
uint32_t target_spacing_seconds;
uint32_t easy_spacing_seconds;
Expand Down
2 changes: 1 addition & 1 deletion src/chain/chain_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ chain_state::data chain_state::to_pool(const chain_state& top,
// Hash and bits.self are unused.
data.height = height;
data.hash = null_hash;
data.bits.self = settings.work_limit(retarget);
data.bits.self = 0;
data.version.self = signal_version(forks);
return data;
}
Expand Down
4 changes: 3 additions & 1 deletion src/chain/header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,9 @@ bool header::is_valid_timestamp() const
bool header::is_valid_proof_of_work(bool retarget) const
{
const auto bits = compact(bits_);
static const uint256_t pow_limit(compact{ settings_.work_limit(retarget) });
const auto work_limit = retarget ? settings_.retarget_proof_of_work_limit :
settings_.no_retarget_proof_of_work_limit;
static const uint256_t pow_limit(compact{ work_limit });

if (bits.is_overflowed())
return false;
Expand Down
6 changes: 0 additions & 6 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,4 @@ settings::settings()
{
}

uint32_t settings::work_limit(bool retarget) const
{
return retarget ? retarget_proof_of_work_limit :
no_retarget_proof_of_work_limit;
}

} // namespace libbitcoin

0 comments on commit 6e19dad

Please sign in to comment.