Merge pull request #34 from jl777/master

Monthly cap on active user reward
This commit is contained in:
pbca26
2018-05-04 19:16:45 +03:00
committed by GitHub
7 changed files with 66 additions and 26 deletions

View File

@@ -1,4 +1,6 @@
First off you need Apple's Xcode (at least version 7, preferably 8.x) and the Xcode Command Line Tools: ## Install for Mac OS X
First off you need Apple's Xcode (at least version 7, preferably 8.x or later) and the Xcode Command Line Tools:
https://itunes.apple.com/us/app/xcode/id497799835?mt=12 https://itunes.apple.com/us/app/xcode/id497799835?mt=12
@@ -11,25 +13,51 @@ And this is the list of brew packages you'll need installed:
```shell ```shell
brew tap discoteq/discoteq; brew install flock brew tap discoteq/discoteq; brew install flock
brew install autoconf autogen automake brew install autoconf autogen automake
brew tap homebrew/versions; brew install homebrew/versions/gcc5 brew install gcc5
brew install binutils brew install binutils
brew install protobuf brew install protobuf
brew install coreutils brew install coreutils
brew install wget brew install wget
``` ```
or
```shell
brew tap discoteq/discoteq; brew install flock autoconf autogen automake gcc5 binutils protobuf coreutils wget
```
Get all that installed, then run: Get all that installed, then run:
```shell ```shell
git clone https://github.com/j-cimb-barker/komodo.git git clone https://github.com/jl777/komodo.git
cd komodo cd komodo
git checkout dev
./zcutil/build-mac.sh ./zcutil/build-mac.sh
./zcutil/fetch-params.sh
``` ```
To build a distributable version of komodo then run the makeDistrib.sh script after building. To build a distributable version of komodo then run the makeDistrib.sh script after building.
When you are done building, you need to do a few things in the [Configuration](https://github.com/zcash/zcash/wiki/1.0-User-Guide#configuration) section of the Zcash User Guide differently because we are on the Mac. All instances of `~/.zcash` need to be replaced by `~/Library/Application\ Support/Zcash` When you are done building, you need to create `Komodo.conf` the Mac way.
The fetch-params.sh script, however, has already been altered to fetch the proving keys into the correct directory to conform to Mac specific naming conventions.
```shell
mkdir ~/Library/Application\ Support/Komodo
touch ~/Library/Application\ Support/Komodo/Komodo.conf
nano ~/Library/Application\ Support/Komodo/Komodo.conf
```
Add the following lines to the Komodo.conf file:
```shell
rpcuser=dontuseweakusernameoryougetrobbed
rpcpassword=dontuseweakpasswordoryougetrobbed
txindex=1
addnode=5.9.102.210
addnode=78.47.196.146
addnode=178.63.69.164
addnode=88.198.65.74
addnode=5.9.122.241
addnode=144.76.94.38
addnode=89.248.166.91
```
Happy Building Happy Building

View File

@@ -93,14 +93,16 @@ To reset the blockchain, from *~/.komodo* `rm -rf blocks chainstate debug.log ko
Create komodo.conf Create komodo.conf
------------------ ------------------
Please use a secure rpcuser and rpcpassword to ensure your funds safety.
``` ```
cd ~ cd ~
mkdir .komodo mkdir .komodo
cd .komodo cd .komodo
pico komodo.conf pico komodo.conf
#Add the following lines to the komodo.conf file: #Add the following lines to the komodo.conf file:
rpcuser=bitcoinrpc rpcuser=dontuseweakusernameoryougetrobbed
rpcpassword=password rpcpassword=dontuseweakpasswordoryougetrobbed
txindex=1 txindex=1
addnode=5.9.102.210 addnode=5.9.102.210
addnode=78.47.196.146 addnode=78.47.196.146

View File

@@ -1,5 +1,5 @@
rpcuser=minion rpcuser=dontuseweakusernameoryougetrobbed
rpcpassword=1235baf8-3725-11e8-b9ec-1239db4ec123 rpcpassword=dontuseweakpasswordoryougetrobbed
txindex=1 txindex=1
server=1 server=1
rpcworkqueue=64 rpcworkqueue=64

View File

@@ -45,7 +45,7 @@ struct komodo_state KOMODO_STATES[34];
int COINBASE_MATURITY = _COINBASE_MATURITY;//100; int COINBASE_MATURITY = _COINBASE_MATURITY;//100;
int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND; int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND;
int32_t KOMODO_LASTMINED,prevKOMODO_LASTMINED,JUMBLR_PAUSE,ASSETCHAINS_CC; int32_t KOMODO_LASTMINED,prevKOMODO_LASTMINED,JUMBLR_PAUSE=1,ASSETCHAINS_CC;
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY;
uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33]; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33];

View File

@@ -80,13 +80,15 @@ uint64_t komodo_moneysupply(int32_t height)
} }
#endif #endif
uint64_t _komodo_interestnew(uint64_t nValue,uint32_t nLockTime,uint32_t tiptime) uint64_t _komodo_interestnew(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime)
{ {
int32_t minutes; uint64_t interest = 0; int32_t minutes; uint64_t interest = 0;
if ( nLockTime >= LOCKTIME_THRESHOLD && tiptime > nLockTime && (minutes= (tiptime - nLockTime) / 60) >= 60 ) if ( nLockTime >= LOCKTIME_THRESHOLD && tiptime > nLockTime && (minutes= (tiptime - nLockTime) / 60) >= 60 )
{ {
if ( minutes > 365 * 24 * 60 ) if ( minutes > 365 * 24 * 60 )
minutes = 365 * 24 * 60; minutes = 365 * 24 * 60;
if ( txheight >= 1000000 && minutes > 31 * 24 * 60 )
minutes = 31 * 24 * 60;
minutes -= 59; minutes -= 59;
interest = ((nValue / 10512000) * minutes); interest = ((nValue / 10512000) * minutes);
} }
@@ -97,7 +99,7 @@ uint64_t komodo_interestnew(int32_t txheight,uint64_t nValue,uint32_t nLockTime,
{ {
uint64_t interest = 0; uint64_t interest = 0;
if ( txheight < KOMODO_ENDOFERA && nLockTime >= LOCKTIME_THRESHOLD && tiptime != 0 && nLockTime < tiptime && nValue >= 10*COIN ) //komodo_moneysupply(txheight) < MAX_MONEY && if ( txheight < KOMODO_ENDOFERA && nLockTime >= LOCKTIME_THRESHOLD && tiptime != 0 && nLockTime < tiptime && nValue >= 10*COIN ) //komodo_moneysupply(txheight) < MAX_MONEY &&
interest = _komodo_interestnew(nValue,nLockTime,tiptime); interest = _komodo_interestnew(txheight,nValue,nLockTime,tiptime);
return(interest); return(interest);
} }
@@ -151,21 +153,21 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin
else if ( txheight < 1000000 ) else if ( txheight < 1000000 )
{ {
interest = (numerator * minutes) / ((uint64_t)365 * 24 * 60); interest = (numerator * minutes) / ((uint64_t)365 * 24 * 60);
interestnew = _komodo_interestnew(nValue,nLockTime,tiptime); interestnew = _komodo_interestnew(txheight,nValue,nLockTime,tiptime);
if ( interest < interestnew ) if ( interest < interestnew )
printf("pathA current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime); printf("pathA current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime);
} }
else interest = _komodo_interestnew(nValue,nLockTime,tiptime); else interest = _komodo_interestnew(txheight,nValue,nLockTime,tiptime);
} }
else if ( txheight < 1000000 ) else if ( txheight < 1000000 )
{ {
numerator = (nValue * KOMODO_INTEREST); numerator = (nValue * KOMODO_INTEREST);
interest = (numerator / denominator) / COIN; interest = (numerator / denominator) / COIN;
interestnew = _komodo_interestnew(nValue,nLockTime,tiptime); interestnew = _komodo_interestnew(txheight,nValue,nLockTime,tiptime);
if ( interest < interestnew ) if ( interest < interestnew )
printf("pathB current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime); printf("pathB current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime);
} }
else interest = _komodo_interestnew(nValue,nLockTime,tiptime); else interest = _komodo_interestnew(txheight,nValue,nLockTime,tiptime);
} }
else else
{ {
@@ -187,11 +189,11 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin
numerator = (nValue / 20); // assumes 5%! numerator = (nValue / 20); // assumes 5%!
interest = ((numerator * minutes) / ((uint64_t)365 * 24 * 60)); interest = ((numerator * minutes) / ((uint64_t)365 * 24 * 60));
//fprintf(stderr,"interest %llu %.8f <- numerator.%llu minutes.%d\n",(long long)interest,(double)interest/COIN,(long long)numerator,(int32_t)minutes); //fprintf(stderr,"interest %llu %.8f <- numerator.%llu minutes.%d\n",(long long)interest,(double)interest/COIN,(long long)numerator,(int32_t)minutes);
interestnew = _komodo_interestnew(nValue,nLockTime,tiptime); interestnew = _komodo_interestnew(txheight,nValue,nLockTime,tiptime);
if ( interest < interestnew ) if ( interest < interestnew )
fprintf(stderr,"pathC current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime); fprintf(stderr,"pathC current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime);
} }
else interest = _komodo_interestnew(nValue,nLockTime,tiptime); else interest = _komodo_interestnew(txheight,nValue,nLockTime,tiptime);
} }
if ( 0 && numerator == (nValue * KOMODO_INTEREST) ) if ( 0 && numerator == (nValue * KOMODO_INTEREST) )
fprintf(stderr,"komodo_interest.%d %lld %.8f nLockTime.%u tiptime.%u minutes.%d interest %lld %.8f (%llu / %llu) prod.%llu\n",txheight,(long long)nValue,(double)nValue/COIN,nLockTime,tiptime,minutes,(long long)interest,(double)interest/COIN,(long long)numerator,(long long)denominator,(long long)(numerator * minutes)); fprintf(stderr,"komodo_interest.%d %lld %.8f nLockTime.%u tiptime.%u minutes.%d interest %lld %.8f (%llu / %llu) prod.%llu\n",txheight,(long long)nValue,(double)nValue/COIN,nLockTime,tiptime,minutes,(long long)interest,(double)interest/COIN,(long long)numerator,(long long)denominator,(long long)(numerator * minutes));

View File

@@ -203,7 +203,10 @@ UniValue jumblr_deposit(const UniValue& params, bool fHelp)
{ {
string addr = params[0].get_str(); string addr = params[0].get_str();
if ( (retval= Jumblr_depositaddradd((char *)addr.c_str())) >= 0 ) if ( (retval= Jumblr_depositaddradd((char *)addr.c_str())) >= 0 )
{
result.push_back(Pair("result", retval)); result.push_back(Pair("result", retval));
JUMBLR_PAUSE = 0;
}
else result.push_back(Pair("error", retval)); else result.push_back(Pair("error", retval));
} else result.push_back(Pair("error", "invalid address")); } else result.push_back(Pair("error", "invalid address"));
return(result); return(result);
@@ -222,6 +225,7 @@ UniValue jumblr_secret(const UniValue& params, bool fHelp)
retval = Jumblr_secretaddradd((char *)addr.c_str()); retval = Jumblr_secretaddradd((char *)addr.c_str());
result.push_back(Pair("result", "success")); result.push_back(Pair("result", "success"));
result.push_back(Pair("num", retval)); result.push_back(Pair("num", retval));
JUMBLR_PAUSE = 0;
} else result.push_back(Pair("error", "invalid address")); } else result.push_back(Pair("error", "invalid address"));
return(result); return(result);
} }

View File

@@ -2,7 +2,11 @@
set -eu set -eu
PARAMS_DIR="$HOME/.zcash-params" if [[ "$OSTYPE" == "darwin"* ]]; then
PARAMS_DIR="$HOME/Library/Application Support/ZcashParams"
else
PARAMS_DIR="$HOME/.zcash-params"
fi
SPROUT_PKEY_NAME='sprout-proving.key' SPROUT_PKEY_NAME='sprout-proving.key'
SPROUT_VKEY_NAME='sprout-verifying.key' SPROUT_VKEY_NAME='sprout-verifying.key'