Merge pull request #121 from jl777/dev

Dev
This commit is contained in:
jl777
2017-01-18 23:29:19 +02:00
committed by GitHub
8 changed files with 174 additions and 16 deletions

View File

@@ -26,6 +26,9 @@ cd komodo
git checkout dev
./zcutil/build-mac.sh
```
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`
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.

35
makeDistrib.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/sh
TMP_DIR=~/tmp/komodo
# make a tmp directory
mkdir -p $TMP_DIR
echo "making $TMP_DIR"
binaries=("komodo-cli" "komodod")
for binary in "${binaries[@]}";
do
echo "copying $binary to $TMP_DIR"
cp src/$binary $TMP_DIR
# find the dylibs to copy for komodod
DYLIBS=`otool -L $TMP_DIR/$binary | grep "/usr/local" | awk -F' ' '{ print $1 }'`
echo "copying $DYLIBS to $TMP_DIR"
# copy the dylibs to the tmpdir
for dylib in $DYLIBS; do cp -rf $dylib $TMP_DIR/; done
# modify komodod to point to dylibs
echo "modifying $binary to use local libraries"
for dylib in $DYLIBS; do install_name_tool -change $dylib @executable_path/`basename $dylib` $TMP_DIR/$binary; done;
done

View File

@@ -5443,7 +5443,7 @@ fiat/revs sendtoaddress RURYZ8FhS5oJ1h1xuv78EXe8rA32SiM4Dy 304.32862968
fiat/revs sendtoaddress RGba6AJogyFQGuMAzD1czE67KR6eW5PV2k 304.98070893
fiat/revs sendtoaddress RXMtwrMXyimRU5CWSdtWzHwWmcCeAc62ua 306.73973391
fiat/revs sendtoaddress RYEmXCS9D2qR71XKzzWbsiAMZGg5E2UWt3 307.15599818
fiat/revs sendtoaddress RWM3UrsRP4WtH6DTetm5KmUyBASvFCV6wH 313.40690770
fiat/revs sendtoaddress RWM3UrsRP4WtH6DTetm5KmUyBASvFCV6wH 3005.5069077
fiat/revs sendtoaddress RL4hFVzdntZQ2DM59QXZc619boZV45YFdk 316.05434626
fiat/revs sendtoaddress RG3vbi2TJp9jeqn8qDSnL1W5eFUeTGQJmu 317.33569076
fiat/revs sendtoaddress RQYgriDwRUuUbfw3E1AecAHZXryGSx1BdN 337.23469627
@@ -5587,7 +5587,7 @@ fiat/revs sendtoaddress RWU752dM2s3sjpPZCaWpihUEYmbL6m7Pne 2537.07064054
fiat/revs sendtoaddress RTCq8NorFo4bNwUTNnyKg9YwYgxH49SbbY 2556.94031291
fiat/revs sendtoaddress RNiUNTzDtBgQyA64txPH3W7gMXAjJriM1T 2597.18712886
fiat/revs sendtoaddress RHuJvZphT6ZhKP3hxCRDDsCnNmCMtDy43r 2603.59182293
fiat/revs sendtoaddress RKxJ7a2J8faQ7VD5dAyFFjMU9DxMDFqv3D 2692.10000000
fiat/revs sendtoaddress RKxJ7a2J8faQ7VD5dAyFFjMU9DxMDFqv3D 1.10000000
fiat/revs sendtoaddress RGyC2cGKrTbv1zQq4f6fbMc2byCNdUAwBX 2700.00000000
fiat/revs sendtoaddress RWJPh9C4WQGuT8UDMXb4u278Teqzcq3zQt 2784.22122603
fiat/revs sendtoaddress RNjNREuiLJ3D5eWGqLcsMvjno5RBsBxqKN 2894.22787069

View File

@@ -4,48 +4,90 @@ source pubkey.txt
echo $pubkey
./komodod -pubkey=$pubkey -ac_name=REVS -ac_supply=1300000 -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=SUPERNET -ac_supply=816061 -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=DEX -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=PANGEA -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=JUMBLR -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=BET -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=CRYPTO -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=HODL -ac_supply=9999999 -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=SHARK -ac_supply=1401 -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=BOTS -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=MGW -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=MVP -ac_supply=1000000 -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=EUR -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=JPY -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=GBP -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=AUD -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=CAD -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=CHF -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=NZD -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=CNY -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=RUB -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=MXN -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=BRL -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=INR -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=HKD -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=TRY -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=ZAR -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=PLN -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=NOK -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=SEK -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=DKK -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=CZK -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=HUF -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=ILS -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=KRW -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=MYR -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=PHP -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=RON -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=SGD -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=THB -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=BGN -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=IDR -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=HRK -addnode=78.47.196.146 $1 -gen &

View File

@@ -40,7 +40,7 @@ void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t heig
{
struct komodo_event_notarized N;
if ( komodo_verifynotarization(symbol,dest,height,notarizedheight,notarized_hash,notarized_desttxid) != 0 )
printf("%s error validating notarization\n",ASSETCHAINS_SYMBOL);
printf("[%s] error validating notarization ht.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,height,notarizedheight);
else
{
memset(&N,0,sizeof(N));

View File

@@ -429,7 +429,7 @@ uint64_t _komodo_paxprice(uint64_t *kmdbtcp,uint64_t *btcusdp,int32_t height,cha
height -= 10;
if ( (baseid= komodo_baseid(base)) >= 0 && (relid= komodo_baseid(rel)) >= 0 )
{
portable_mutex_lock(&komodo_mutex);
//portable_mutex_lock(&komodo_mutex);
for (i=NUM_PRICES-1; i>=0; i--)
{
ptr = &PVALS[36 * i];
@@ -440,18 +440,47 @@ uint64_t _komodo_paxprice(uint64_t *kmdbtcp,uint64_t *btcusdp,int32_t height,cha
*kmdbtcp = ptr[MAX_CURRENCIES + 1] / 539;
*btcusdp = ptr[MAX_CURRENCIES + 2] / 539;
}
portable_mutex_unlock(&komodo_mutex);
//portable_mutex_unlock(&komodo_mutex);
if ( kmdbtc != 0 && btcusd != 0 )
return(komodo_paxcalc(&ptr[1],baseid,relid,basevolume,kmdbtc,btcusd));
else return(0);
}
}
portable_mutex_unlock(&komodo_mutex);
//portable_mutex_unlock(&komodo_mutex);
} //else printf("paxprice invalid base.%s %d, rel.%s %d\n",base,baseid,rel,relid);
return(0);
}
uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume)
int32_t komodo_kmdbtcusd(int32_t rwflag,uint64_t *kmdbtcp,uint64_t *btcusdp,int32_t height)
{
static uint64_t *KMDBTCS,*BTCUSDS; static int32_t maxheight = 0; int32_t incr = 10000;
if ( height >= maxheight )
{
//printf("height.%d maxheight.%d incr.%d\n",height,maxheight,incr);
if ( height >= maxheight+incr )
incr = (height - (maxheight+incr) + 1000);
KMDBTCS = (uint64_t *)realloc(KMDBTCS,((incr + maxheight) * sizeof(*KMDBTCS)));
memset(&KMDBTCS[maxheight],0,(incr * sizeof(*KMDBTCS)));
BTCUSDS = (uint64_t *)realloc(BTCUSDS,((incr + maxheight) * sizeof(*BTCUSDS)));
memset(&BTCUSDS[maxheight],0,(incr * sizeof(*BTCUSDS)));
maxheight += incr;
}
if ( rwflag == 0 )
{
*kmdbtcp = KMDBTCS[height];
*btcusdp = BTCUSDS[height];
}
else
{
KMDBTCS[height] = *kmdbtcp;
BTCUSDS[height] = *btcusdp;
}
if ( *kmdbtcp != 0 && *btcusdp != 0 )
return(0);
else return(-1);
}
uint64_t komodo_paxpriceB(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume)
{
int32_t i,j,k,ind,zeroes,numvotes,wt,nonz; int64_t delta; uint64_t lastprice,tolerance,den,densum,sum=0,votes[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],btcusds[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],kmdbtcs[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],kmdbtc,btcusd;
*seedp = komodo_seed(height);
@@ -467,15 +496,19 @@ uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uin
}
numvotes = (int32_t)(sizeof(Peggy_inds)/sizeof(*Peggy_inds));
memset(votes,0,sizeof(votes));
memset(btcusds,0,sizeof(btcusds));
memset(kmdbtcs,0,sizeof(kmdbtcs));
for (i=0; i<numvotes; i++)
//if ( komodo_kmdbtcusd(0,&kmdbtc,&btcusd,height) < 0 ) crashes when via passthru GUI use
{
_komodo_paxprice(&kmdbtcs[numvotes-1-i],&btcusds[numvotes-1-i],height-i,base,rel,100000,0,0);
//printf("(%llu %llu) ",(long long)kmdbtcs[numvotes-1-i],(long long)btcusds[numvotes-1-i]);
memset(btcusds,0,sizeof(btcusds));
memset(kmdbtcs,0,sizeof(kmdbtcs));
for (i=0; i<numvotes; i++)
{
_komodo_paxprice(&kmdbtcs[numvotes-1-i],&btcusds[numvotes-1-i],height-i,base,rel,100000,0,0);
//printf("(%llu %llu) ",(long long)kmdbtcs[numvotes-1-i],(long long)btcusds[numvotes-1-i]);
}
kmdbtc = komodo_paxcorrelation(kmdbtcs,numvotes,*seedp) * 539;
btcusd = komodo_paxcorrelation(btcusds,numvotes,*seedp) * 539;
//komodo_kmdbtcusd(1,&kmdbtc,&btcusd,height);
}
kmdbtc = komodo_paxcorrelation(kmdbtcs,numvotes,*seedp) * 539;
btcusd = komodo_paxcorrelation(btcusds,numvotes,*seedp) * 539;
for (i=nonz=0; i<numvotes; i++)
{
if ( (votes[numvotes-1-i]= _komodo_paxprice(0,0,height-i,base,rel,100000,kmdbtc,btcusd)) == 0 )
@@ -491,6 +524,49 @@ uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uin
return(komodo_paxcorrelation(votes,numvotes,*seedp) * basevolume / 100000);
}
uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume)
{
int32_t i,nonz=0; int64_t diff; uint64_t price,seed,sum = 0;
if ( chainActive.Tip() != 0 && height > chainActive.Tip()->nHeight )
return(0);
portable_mutex_lock(&komodo_mutex);
for (i=0; i<17; i++)
{
if ( (price= komodo_paxpriceB(&seed,height-i,base,rel,basevolume)) != 0 )
{
sum += price;
nonz++;
if ( 0 && i == 1 && nonz == 2 )
{
diff = (((int64_t)price - (sum >> 1)) * 10000);
if ( diff < 0 )
diff = -diff;
diff /= price;
printf("(%llu %llu %lld).%lld ",(long long)price,(long long)(sum>>1),(long long)(((int64_t)price - (sum >> 1)) * 10000),(long long)diff);
if ( diff < 33 )
break;
}
else if ( 0 && i == 3 && nonz == 4 )
{
diff = (((int64_t)price - (sum >> 2)) * 10000);
if ( diff < 0 )
diff = -diff;
diff /= price;
printf("(%llu %llu %lld).%lld ",(long long)price,(long long)(sum>>2),(long long) (((int64_t)price - (sum >> 2)) * 10000),(long long)diff);
if ( diff < 20 )
break;
}
}
if ( height < 165000 )
break;
}
portable_mutex_unlock(&komodo_mutex);
if ( nonz != 0 )
sum /= nonz;
//printf("-> %lld %s/%s i.%d ht.%d\n",(long long)sum,base,rel,i,height);
return(sum);
}
int32_t komodo_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *base,char *rel)
{
int32_t baseid=-1,relid=-1,i,num = 0; uint32_t *ptr;

View File

@@ -1533,6 +1533,8 @@ void komodo_args()
fclose(fp);
//printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS);
} else printf("couldnt open.(%s)\n",fname);
if ( IS_KOMODO_NOTARY == 0 )
break;
}
}
//fprintf(stderr,"%s chain params initialized\n",ASSETCHAINS_SYMBOL);

View File

@@ -2510,7 +2510,7 @@ uint64_t komodo_interestsum()
BOOST_FOREACH(const COutput& out,vecOutputs)
{
CAmount nValue = out.tx->vout[out.i].nValue;
if ( out.tx->nLockTime != 0 )
if ( out.tx->nLockTime != 0 && out.fSpendable != 0 )
{
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
CBlockIndex *tipindex,*pindex = it->second;