Skip to content

Commit

Permalink
NeoScrypt Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostlander committed Sep 26, 2015
1 parent dab3acb commit 78dc34f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 30 deletions.
2 changes: 1 addition & 1 deletion orbitcoin-qt.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE
CONFIG += no_include_pwd
CONFIG += thread
CONFIG += static
QMAKE_CFLAGS += -DSHA256 -DASM
QMAKE_CFLAGS += -DSHA256 -DASM -DOPT

# for boost 1.37, add -mt to the boost libraries
# use: qmake BOOST_LIB_SUFFIX=-mt
Expand Down
6 changes: 0 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ CBigNum bnProofOfWorkLimit(~uint256(0) >> 20); // 0.000244140625 PoW difficulty
CBigNum bnProofOfStakeLimit(~uint256(0) >> 20); // the same for PoS
uint256 nPoWBase = uint256("0x00000000ffff0000000000000000000000000000000000000000000000000000"); // difficulty-1 target

/* The PoW difficulty after switching to NeoScrypt (0.25) */
static CBigNum bnNeoScryptSwitch(~uint256(0) >> 30);

CBigNum bnProofOfWorkLimitTestNet(~uint256(0) >> 16);
CBigNum bnProofOfStakeLimitTestNet(~uint256(0) >> 16);

Expand Down Expand Up @@ -1142,9 +1139,6 @@ unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfS
} else {
if(!fNeoScrypt && (nHeight >= nForkSix))
fNeoScrypt = true;
/* PoW difficulty reset after the switch */
if(!fProofOfStake && (nHeight == nForkSix))
return(bnNeoScryptSwitch.GetCompact());
}

if((fTestNet && (nHeight <= nTestnetForkThree)) ||
Expand Down
23 changes: 8 additions & 15 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -1311,19 +1311,15 @@ class CBlock
}

/* Block hashing */
uint256 GetHash(int nHeight = 0) const {
uint256 GetHash() const {
if(timeCached != nTime) {
uint profile = 0x0;

/* Not fail safe, but better than nothing */
if(!nHeight)
nHeight = GetBlockHeight();

if(fTestNet) {
if(nHeight < nTestnetForkFive)
if(!fTestNet) {
if(nTime < 1418511997) /* nForkSix */
profile = 0x3;
} else {
if(nHeight < nForkSix)
if(nTime < 1418144320) /* nTestnetForkFive */
profile = 0x3;
}

Expand Down Expand Up @@ -1359,13 +1355,11 @@ class CBlock
uint256 hashPoW;
uint profile = 0x0;

/* All these blocks must be v2+ with valid nHeight */
int nHeight = GetBlockHeight();
if(fTestNet) {
if(nHeight < nTestnetForkFive)
if(!fTestNet) {
if(nTime < 1418511997) /* nForkSix */
profile = 0x3;
} else {
if(nHeight < nForkSix)
if(nTime < 1418144320) /* nTestnetForkFive */
profile = 0x3;
}

Expand Down Expand Up @@ -2101,8 +2095,7 @@ class CDiskBlockIndex : public CBlockIndex
block.nBits = nBits;
block.nNonce = nNonce;

/* nHeight is known and should be used to avoid trouble */
const_cast<CDiskBlockIndex*>(this)->blockHash = block.GetHash(nHeight);
const_cast<CDiskBlockIndex*>(this)->blockHash = block.GetHash();

return(blockHash);
}
Expand Down
4 changes: 2 additions & 2 deletions src/makefile.bsd
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ version.cpp: obj/build.h
DEFS += -DHAVE_BUILD_INFO

obj/neoscrypt.o: neoscrypt.c
$(CC) $(CFLAGS) -DSHA256 -DASM -c -o $@ $^
$(CC) $(CFLAGS) -DSHA256 -DASM -DOPT -c -o $@ $^

obj/neoscrypt_asm.o: neoscrypt_asm.S
$(CC) -c -DSHA256 -DASM -o $@ $^
$(CC) -c -DSHA256 -DASM -DOPT -o $@ $^

obj/scrypt-x86.o: scrypt-x86.S
$(CC) -c -MMD -o $@ $<
Expand Down
4 changes: 2 additions & 2 deletions src/makefile.mingw
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ obj/%.o: %.cpp $(HEADERS)
$(CXX) -c $(CFLAGS) -o $@ $<

obj/neoscrypt.o: neoscrypt.c
$(CC) $(CFLAGS) -DSHA256 -DASM -c -o $@ $^
$(CC) $(CFLAGS) -DSHA256 -DASM -DOPT -c -o $@ $^

obj/neoscrypt_asm.o: neoscrypt_asm.S
$(CC) -c -DSHA256 -DASM -o $@ $^
$(CC) -c -DSHA256 -DASM -DOPT -o $@ $^

obj/scrypt-x86.o: scrypt-x86.S
$(CC) -c -MMD -o $@ $<
Expand Down
4 changes: 2 additions & 2 deletions src/makefile.osx
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ obj/%.o: %.cpp
rm -f $(@:%.o=%.d)

obj/neoscrypt.o: neoscrypt.c
$(CC) $(CFLAGS) -DSHA256 -DASM -c -o $@ $^
$(CC) $(CFLAGS) -DSHA256 -DASM -DOPT -c -o $@ $^

obj/neoscrypt_asm.o: neoscrypt_asm.S
$(CC) -c -DSHA256 -DASM -o $@ $^
$(CC) -c -DSHA256 -DASM -DOPT -o $@ $^

obj/scrypt-x86.o: scrypt-x86.S
$(CC) -c -MMD -o $@ $<
Expand Down
4 changes: 2 additions & 2 deletions src/makefile.unix
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ version.cpp: obj/build.h
DEFS += -DHAVE_BUILD_INFO

obj/neoscrypt.o: neoscrypt.c
$(CC) $(CFLAGS) -DSHA256 -DASM -c -o $@ $^
$(CC) $(CFLAGS) -DSHA256 -DASM -DOPT -c -o $@ $^

obj/neoscrypt_asm.o: neoscrypt_asm.S
$(CC) -c -DSHA256 -DASM -o $@ $^
$(CC) -c -DSHA256 -DASM -DOPT -o $@ $^

obj/scrypt-x86.o: scrypt-x86.S
$(CC) -c -MMD -o $@ $<
Expand Down

0 comments on commit 78dc34f

Please sign in to comment.