Skip to content

Commit

Permalink
Add bonus interest for currency defence.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Jul 4, 2019
1 parent 2406f98 commit 6f16817
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
8 changes: 4 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 3)
define(_CLIENT_VERSION_MAJOR, 4)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_REVISION, 2)
define(_CLIENT_VERSION_BUILD, 99)
define(_CLIENT_VERSION_IS_RELEASE, false)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2018)
define(_HODL_COPYRIGHT_YEAR, 2019)
AC_INIT([HOdlcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/HOdlcoin/HOdlcoin/issues],[hodlcoin])
Expand Down
8 changes: 4 additions & 4 deletions src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
*/

//! These need to be macros, as clientversion.cpp's and bitcoin*-res.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 3
#define CLIENT_VERSION_MAJOR 4
#define CLIENT_VERSION_MINOR 0
#define CLIENT_VERSION_REVISION 1
#define CLIENT_VERSION_BUILD 99
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0

//! Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE false
#define CLIENT_VERSION_IS_RELEASE true

/**
* Copyright year (2009-this)
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4069,7 +4069,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
CAddress addrFrom;
uint64_t nNonce = 1;
vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe;
if (pfrom->nVersion < (chainActive.Height() < THEUNFORKENING ? MIN_PEER_PROTO_MINERHODLFORK_VERSION : MIN_PEER_PROTO_THEUNFORKENING_VERSION))
if (pfrom->nVersion < (chainActive.Height() < MININGFEESFORK-4000 ? MIN_PEER_PROTO_THEUNFORKENING_VERSION : MIN_PEER_PROTO_MINERFEES_VERSION))
{
// disconnect from peers older than this proto version
LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion);
Expand Down
18 changes: 17 additions & 1 deletion src/primitives/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ std::string initRateTable(){

CAmount GetInterest(CAmount nValue, int outputBlockHeight, int valuationHeight, int maturationBlock){



//These conditions generally should not occur
if(maturationBlock >= 500000000 || outputBlockHeight<0 || valuationHeight<0 || valuationHeight<outputBlockHeight){
return nValue;
Expand Down Expand Up @@ -273,5 +275,19 @@ CAmount GetInterest(CAmount nValue, int outputBlockHeight, int valuationHeight,
}
}

return nValue+interestAmount+termDepositAmount;
if(outputBlockHeight>=MININGFEESFORK){
//If output is higher than MININGFEESFORK, simple, add bonus
return nValue+((interestAmount+termDepositAmount)*75);
}else if(outputBlockHeight+blocks<=MININGFEESFORK){
//If output plus block earned interest on are lower or equal than MININGFEESFORK, simple straight interest
return nValue+interestAmount+termDepositAmount;
}else if(outputBlockHeight<MININGFEESFORK && outputBlockHeight+blocks>MININGFEESFORK){
//Complex situation here. interest straddles two periods. Need to break the interest into two parts
CAmount firstPeriod = GetInterest(nValue, outputBlockHeight, MININGFEESFORK, maturationBlock)-nValue;
CAmount secondPeriod = GetInterest(nValue, MININGFEESFORK+1, valuationHeight, maturationBlock)-nValue;
return nValue+firstPeriod+secondPeriod;
}else{
//This should never be hit
return nValue;
}
}
2 changes: 1 addition & 1 deletion src/primitives/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "uint256.h"

static const unsigned int THEUNFORKENING = 257000;
static const unsigned int MININGFEESFORK = 999999999;
static const unsigned int MININGFEESFORK = 683000;

/** An outpoint - a combination of a transaction hash and an index n into its vout */
class COutPoint
Expand Down
3 changes: 2 additions & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* network protocol versioning
*/

static const int PROTOCOL_VERSION = 250000;
static const int PROTOCOL_VERSION = 683000;

//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
Expand All @@ -23,6 +23,7 @@ static const int MIN_PEER_PROTO_VERSION = GETHEADERS_VERSION;
//! disconnect from peers once fork height reached
static const int MIN_PEER_PROTO_MINERHODLFORK_VERSION = 70010;
static const int MIN_PEER_PROTO_THEUNFORKENING_VERSION = 250000;
static const int MIN_PEER_PROTO_MINERFEES_VERSION = 683000;

//! nTime field added to CAddress, starting with this version;
//! if possible, avoid requesting addresses nodes older than this
Expand Down

0 comments on commit 6f16817

Please sign in to comment.