Skip to content

Commit

Permalink
increase size of block at V2 to allow bigger tx
Browse files Browse the repository at this point in the history
  • Loading branch information
steevebrush committed Dec 11, 2017
1 parent 9b19627 commit 7a8e6b4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,7 +1,7 @@
.DS_Store
build
.vs
CMakeFiles.txt.*
CMakeFiles.txt.user
*.dir
*.vcxproj
*.filters
Expand Down
4 changes: 2 additions & 2 deletions src/CryptoNoteConfig.h
Expand Up @@ -45,8 +45,8 @@ const unsigned EMISSION_SPEED_FACTOR = 18;
static_assert(EMISSION_SPEED_FACTOR <= 8 * sizeof(uint64_t), "Bad EMISSION_SPEED_FACTOR");

const size_t CRYPTONOTE_REWARD_BLOCKS_WINDOW = 100;
const size_t CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE = 20000; //size of block (bytes) after which reward for block calculated using block size
const size_t CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2 = 20000;
const size_t CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE = 20000; // size of block (bytes) after which reward for block calculated using block size
const size_t CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2 = 40000; // increasing to allow bigger tx
const size_t CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 = 20000;
const size_t CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_CURRENT = CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE;
const size_t CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE = 600;
Expand Down
25 changes: 24 additions & 1 deletion src/CryptoNoteCore/Currency.cpp
Expand Up @@ -476,6 +476,29 @@ Difficulty Currency::nextDifficulty(std::vector<uint64_t> timestamps,

return (low + timeSpan - 1) / timeSpan;
}
/* Original algo from 28/11/2017
# Dynamic EMA difficulty algo (Jacob Eliosoff's EMA and Zawy's adjustable window).
# Bitcoin Cash dev (Amaury?) came up with the median of three to reduce timestamp errors.
# For EMA origins see
# https://en.wikipedia.org/wiki/Moving_average#Application_to_measuring_computer_performance
# "Dynamic" means it triggers to a faster-responding value for N if a substantial change in hashrate
# is detected. It increases from that event back to Nmax
Nmax=70 # max EMA window
Nmin=25 # min EMA window
A=10, B=2, C=0.37 # A,B,C = 10,2,0.37 or 20, 1.65 0.45,
# TS=timestamp, T=target solvetime, i.e. 600 seconds
# Find the most recent unusual 20-block event
for (i=height-Nmax to height) { # height=current block index
if ( (median(TS[i],TS[i-1],TS[i-2]) - median(TS[i-20],TS[i-21],TS[i-22]))/T/A > B
or
(median(TS[i],TS[i-1],TS[i-2]) - median(TS[i-20],TS[i-21],TS[i-22]))/T/A < C )
{ unusual_event=height - i + Nmin }
}
N = min(Nmax, unusual_event))
# now use the EMA difficulty algorithm with this N */

Difficulty Currency::nextDifficulty(uint8_t version, uint32_t blockIndex, std::vector<uint64_t> timestamps,
std::vector<Difficulty> cumulativeDifficulties) const {
Expand Down Expand Up @@ -827,4 +850,4 @@ CurrencyBuilder& CurrencyBuilder::upgradeWindow(uint32_t val) {
return *this;
}

}
}

0 comments on commit 7a8e6b4

Please sign in to comment.