mirror of https://github.com/oxen-io/oxen-core.git
Merge pull request #1565 from jagerman/next-height-is-now
Next height is now
This commit is contained in:
commit
502f88cdc4
|
@ -207,7 +207,7 @@ namespace cryptonote {
|
|||
if (cryptonote::is_valid_address(address, m_nettype)) {
|
||||
cryptonote::address_parse_info addr_info {};
|
||||
cryptonote::get_account_address_from_str(addr_info, m_nettype, address);
|
||||
uint64_t next_payout_height = addr_info.address.next_payout_height(block_height - 1, conf.BATCHING_INTERVAL);
|
||||
uint64_t next_payout_height = addr_info.address.next_payout_height(block_height, conf.BATCHING_INTERVAL);
|
||||
if (block_height == next_payout_height) {
|
||||
payments.emplace_back(
|
||||
std::move(address),
|
||||
|
|
|
@ -150,10 +150,11 @@ uint64_t account_public_address::modulus(uint64_t interval) const
|
|||
|
||||
uint64_t account_public_address::next_payout_height(uint64_t current_height, uint64_t interval) const
|
||||
{
|
||||
uint64_t next_payout_height = current_height + (modulus(interval) - current_height % interval);
|
||||
if (next_payout_height <= current_height)
|
||||
next_payout_height += interval;
|
||||
return next_payout_height;
|
||||
auto pay_offset = modulus(interval);
|
||||
auto curr_offset = current_height % interval;
|
||||
if (pay_offset < curr_offset)
|
||||
pay_offset += interval;
|
||||
return current_height + pay_offset - curr_offset;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue