Skip to content

Commit

Permalink
Merge pull request jl777#66 from jl777/dev
Browse files Browse the repository at this point in the history
dev update
  • Loading branch information
ca333 authored Jan 22, 2018
2 parents 697c01b + df473cc commit b78cf0c
Show file tree
Hide file tree
Showing 37 changed files with 193 additions and 77 deletions.
6 changes: 5 additions & 1 deletion src/assetchains
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ komodo_asset JUMBLR 999999
komodo_asset BET 999999
komodo_asset CRYPTO 999999
komodo_asset HODL 9999999
komodo_asset SHARK 1401
#komodo_asset SHARK 1401
komodo_asset MSHARK 1400000
komodo_asset BOTS 999999
komodo_asset MGW 999999
#komodo_asset MVP 1000000
Expand All @@ -45,6 +46,9 @@ komodo_asset KV 1000000
komodo_asset CEAL 366666666
komodo_asset MESH 1000007
komodo_asset MNZ 257142858
komodo_asset AXO 200000000
komodo_asset ETOMIC 100000000
komodo_asset BTCH 20998641

komodo_asset USD
komodo_asset EUR
Expand Down
7 changes: 6 additions & 1 deletion src/assetchains.old
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ echo $pubkey
./komodod -pubkey=$pubkey -ac_name=BET -ac_supply=999999 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=CRYPTO -ac_supply=999999 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=HODL -ac_supply=9999999 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=SHARK -ac_supply=1401 -addnode=78.47.196.146 $1 &
#./komodod -pubkey=$pubkey -ac_name=SHARK -ac_supply=1401 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=MSHARK -ac_supply=1400000 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=BOTS -ac_supply=999999 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=MGW -ac_supply=999999 -addnode=78.47.196.146 $1 &
#./komodod -pubkey=$pubkey -ac_name=MVP -ac_supply=1000000 -addnode=78.47.196.146 $1 &
Expand All @@ -22,6 +23,10 @@ echo $pubkey
./komodod -pubkey=$pubkey -ac_name=CEAL -ac_supply=366666666 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=MESH -ac_supply=1000007 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=MNZ -ac_supply=257142858 -addnode=51.15.138.138 $1 &
./komodod -pubkey=$pubkey -ac_name=AXO -ac_supply=200000000 -addnode=78.47.196.146 &
./komodod -pubkey=$pubkey -ac_name=ETOMIC -ac_supply=100000000 -addnode=78.47.196.146 &
./komodod -pubkey=$pubkey -ac_name=BTCH -ac_supply=20998641 -addnode=78.47.196.146 &

sleep $delay

./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 &
Expand Down
3 changes: 2 additions & 1 deletion src/bitcoind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
*/

static bool fDaemon;
extern char ASSETCHAINS_SYMBOL[16];
#define KOMODO_ASSETCHAIN_MAXLEN 65
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
void komodo_passport_iteration();

void WaitForShutdown(boost::thread_group* threadGroup)
Expand Down
2 changes: 2 additions & 0 deletions src/chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ CBlockLocator CChain::GetLocator(const CBlockIndex *pindex) const {
}

const CBlockIndex *CChain::FindFork(const CBlockIndex *pindex) const {
if ( pindex == 0 )
return(0);
if (pindex->nHeight > Height())
pindex = pindex->GetAncestor(Height());
while (pindex && !Contains(pindex))
Expand Down
4 changes: 3 additions & 1 deletion src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ using namespace std;
* + Contains no strange transactions
*/
void *chainparams_commandline(void *ptr);
extern char ASSETCHAINS_SYMBOL[16];
#include "komodo_defs.h"

extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern uint16_t ASSETCHAINS_PORT;
extern uint32_t ASSETCHAIN_INIT;
extern uint32_t ASSETCHAINS_MAGIC;
Expand Down
3 changes: 2 additions & 1 deletion src/coins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "random.h"
#include "version.h"
#include "policy/fees.h"
#include "komodo_defs.h"

#include <assert.h>

Expand Down Expand Up @@ -387,7 +388,7 @@ const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const

//uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue);
extern char ASSETCHAINS_SYMBOL[16];
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];

CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTransaction& tx,uint32_t tiptime) const
{
Expand Down
4 changes: 4 additions & 0 deletions src/dpowassets
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dp
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CRYPTO\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HODL\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SHARK\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MSHARK\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BOTS\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MGW\",\"pubkey\":\"$pubkey\"}"
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MVP\",\"pubkey\":\"$pubkey\"}"
Expand All @@ -24,6 +25,9 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dp
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MESH\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MNZ\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CHIPS\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"AXO\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ETOMIC\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BTCH\",\"pubkey\":\"$pubkey\"}"


#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"USD\",\"pubkey\":\"$pubkey\"}"
Expand Down
70 changes: 37 additions & 33 deletions src/fiat-cli
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
#!/bin/bash
#set -x
echo aud; fiat/aud $1 $2 $3 $4
echo bgn; fiat/bgn $1 $2 $3 $4
echo cad; fiat/cad $1 $2 $3 $4
echo chf; fiat/chf $1 $2 $3 $4
echo cny; fiat/cny $1 $2 $3 $4
echo czk; fiat/czk $1 $2 $3 $4
echo dkk; fiat/dkk $1 $2 $3 $4
echo eur; fiat/eur $1 $2 $3 $4
echo gbp; fiat/gbp $1 $2 $3 $4
echo hkd; fiat/hkd $1 $2 $3 $4
echo hrk; fiat/hrk $1 $2 $3 $4
echo huf; fiat/huf $1 $2 $3 $4
echo idr; fiat/idr $1 $2 $3 $4
echo ils; fiat/ils $1 $2 $3 $4
echo inr; fiat/inr $1 $2 $3 $4
echo jpy; fiat/jpy $1 $2 $3 $4
echo krw; fiat/krw $1 $2 $3 $4
echo mxn; fiat/mxn $1 $2 $3 $4
echo myr; fiat/myr $1 $2 $3 $4
echo nok; fiat/nok $1 $2 $3 $4
echo nzd; fiat/nzd $1 $2 $3 $4
echo php; fiat/php $1 $2 $3 $4
echo pln; fiat/pln $1 $2 $3 $4
echo brl; fiat/brl $1 $2 $3 $4
echo ron; fiat/ron $1 $2 $3 $4
echo rub; fiat/rub $1 $2 $3 $4
echo sek; fiat/sek $1 $2 $3 $4
echo sgd; fiat/sgd $1 $2 $3 $4
echo thb; fiat/thb $1 $2 $3 $4
echo try; fiat/try $1 $2 $3 $4
echo usd; fiat/usd $1 $2 $3 $4
echo zar; fiat/zar $1 $2 $3 $4
#echo aud; fiat/aud $1 $2 $3 $4
#echo bgn; fiat/bgn $1 $2 $3 $4
#echo cad; fiat/cad $1 $2 $3 $4
#echo chf; fiat/chf $1 $2 $3 $4
#echo cny; fiat/cny $1 $2 $3 $4
#echo czk; fiat/czk $1 $2 $3 $4
#echo dkk; fiat/dkk $1 $2 $3 $4
#echo eur; fiat/eur $1 $2 $3 $4
#echo gbp; fiat/gbp $1 $2 $3 $4
#echo hkd; fiat/hkd $1 $2 $3 $4
#echo hrk; fiat/hrk $1 $2 $3 $4
#echo huf; fiat/huf $1 $2 $3 $4
#echo idr; fiat/idr $1 $2 $3 $4
#echo ils; fiat/ils $1 $2 $3 $4
#echo inr; fiat/inr $1 $2 $3 $4
#echo jpy; fiat/jpy $1 $2 $3 $4
#echo krw; fiat/krw $1 $2 $3 $4
#echo mxn; fiat/mxn $1 $2 $3 $4
#echo myr; fiat/myr $1 $2 $3 $4
#echo nok; fiat/nok $1 $2 $3 $4
#echo nzd; fiat/nzd $1 $2 $3 $4
#echo php; fiat/php $1 $2 $3 $4
#echo pln; fiat/pln $1 $2 $3 $4
#echo brl; fiat/brl $1 $2 $3 $4
#echo ron; fiat/ron $1 $2 $3 $4
#echo rub; fiat/rub $1 $2 $3 $4
#echo sek; fiat/sek $1 $2 $3 $4
#echo sgd; fiat/sgd $1 $2 $3 $4
#echo thb; fiat/thb $1 $2 $3 $4
#echo try; fiat/try $1 $2 $3 $4
#echo usd; fiat/usd $1 $2 $3 $4
#echo zar; fiat/zar $1 $2 $3 $4
echo revs; fiat/revs $1 $2 $3 $4
echo supernet; fiat/supernet $1 $2 $3 $4
echo dex; fiat/dex $1 $2 $3 $4
Expand All @@ -40,7 +40,8 @@ echo jumblr; fiat/jumblr $1 $2 $3 $4
echo bet; fiat/bet $1 $2 $3 $4
echo crypto; fiat/crypto $1 $2 $3 $4
echo hodl; fiat/hodl $1 $2 $3 $4
echo shark; fiat/shark $1 $2 $3 $4
#echo shark; fiat/shark $1 $2 $3 $4
echo mshark; fiat/mshark $1 $2 $3 $4
echo bots; fiat/bots $1 $2 $3 $4
echo mgw; fiat/mgw $1 $2 $3 $4
#echo mvp; fiat/mvp $1 $2 $3 $4
Expand All @@ -50,3 +51,6 @@ echo kv; fiat/kv $1 $2 $3 $4
echo ceal; fiat/ceal $1 $2 $3 $4
echo mesh; fiat/mesh $1 $2 $3 $4
echo mnz; fiat/mnz $1 $2 $3 $4
echo axo; fiat/axo $1 $2 $3 $4
echo etomic; fiat/etomic $1 $2 $3 $4
echo btch; fiat/btch $1 $2 $3 $4
2 changes: 2 additions & 0 deletions src/fiat/axo
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
./komodo-cli -ac_name=AXO $1 $2 $3 $4 $5 $6
2 changes: 2 additions & 0 deletions src/fiat/btch
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
./komodo-cli -ac_name=BTCH $1 $2 $3 $4 $5 $6
2 changes: 2 additions & 0 deletions src/fiat/etomic
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
./komodo-cli -ac_name=ETOMIC $1 $2 $3 $4 $5 $6
2 changes: 2 additions & 0 deletions src/fiat/mshark
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
./komodo-cli -ac_name=MSHARK $1 $2 $3 $4 $5 $6
1 change: 1 addition & 0 deletions src/komodo-tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ using namespace std;
#include "arith_uint256.h"
#include "komodo_structs.h"
#include "komodo_globals.h"
#include "komodo_defs.h"

#include "komodo_interest.h"

Expand Down
34 changes: 26 additions & 8 deletions src/komodo.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#ifndef H_KOMODO_H
#define H_KOMODO_H
#include "komodo_defs.h"

#ifdef _WIN32
#define printf(...)
Expand Down Expand Up @@ -56,14 +57,14 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char

void komodo_currentheight_set(int32_t height)
{
char symbol[16],dest[16]; struct komodo_state *sp;
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
sp->CURRENT_HEIGHT = height;
}

int32_t komodo_currentheight()
{
char symbol[16],dest[16]; struct komodo_state *sp;
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
return(sp->CURRENT_HEIGHT);
else return(0);
Expand Down Expand Up @@ -328,7 +329,7 @@ int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long
void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout)
{
static FILE *fp; static int32_t errs,didinit;
struct komodo_state *sp; char fname[512],symbol[16],dest[16]; int32_t retval,ht,func; uint8_t num,pubkeys[64][33];
struct komodo_state *sp; char fname[512],symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t retval,ht,func; uint8_t num,pubkeys[64][33];
if ( didinit == 0 )
{
portable_mutex_init(&KOMODO_KV_mutex);
Expand Down Expand Up @@ -475,7 +476,7 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar
int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scriptbuf,int32_t scriptlen,int32_t height,uint256 txhash,int32_t i,int32_t j,uint64_t *voutmaskp,int32_t *specialtxp,int32_t *notarizedheightp,uint64_t value,int32_t notarized,uint64_t signedmask)
{
static uint256 zero; static FILE *signedfp;
int32_t opretlen,nid,k,len = 0; uint256 kmdtxid,desttxid; uint8_t crypto777[33]; struct komodo_state *sp; char symbol[16],dest[16];
int32_t opretlen,nid,k,len = 0; uint256 kmdtxid,desttxid; uint8_t crypto777[33]; struct komodo_state *sp; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN];
if ( (sp= komodo_stateptr(symbol,dest)) == 0 )
return(-1);
if ( scriptlen == 35 && scriptbuf[0] == 33 && scriptbuf[34] == 0xac )
Expand Down Expand Up @@ -550,7 +551,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
if ( signedfp == 0 )
{
char fname[512];
komodo_statefname(fname,(char *)"",(char *)"signedmasks");
komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"signedmasks");
if ( (signedfp= fopen(fname,"rb+")) == 0 )
signedfp = fopen(fname,"wb");
else fseek(signedfp,0,SEEK_END);
Expand Down Expand Up @@ -633,7 +634,7 @@ int32_t komodo_notarycmp(uint8_t *scriptPubKey,int32_t scriptlen,uint8_t pubkeys
void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
{
static int32_t hwmheight;
uint64_t signedmask,voutmask; char symbol[16],dest[16]; struct komodo_state *sp;
uint64_t signedmask,voutmask; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
uint8_t scriptbuf[4096],pubkeys[64][33],rmd160[20],scriptPubKey[35]; uint256 kmdtxid,zero,btctxid,txhash;
int32_t i,j,k,numnotaries,notarized,scriptlen,isratification,nid,numvalid,specialtx,notarizedheight,notaryid,len,numvouts,numvins,height,txn_count;
memset(&zero,0,sizeof(zero));
Expand Down Expand Up @@ -691,8 +692,25 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
(numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) ||
numvalid > (numnotaries/5)) )
{
if ( height > 500000 || ASSETCHAINS_SYMBOL[0] != 0 )
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
if ( ASSETCHAINS_SYMBOL[0] != 0 )
{
static FILE *signedfp;
if ( signedfp == 0 )
{
char fname[512];
komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"signedmasks");
if ( (signedfp= fopen(fname,"rb+")) == 0 )
signedfp = fopen(fname,"wb");
else fseek(signedfp,0,SEEK_END);
}
if ( signedfp != 0 )
{
fwrite(&height,1,sizeof(height),signedfp);
fwrite(&signedmask,1,sizeof(signedmask),signedfp);
fflush(signedfp);
}
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
}
notarized = 1;
}
if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
Expand Down
4 changes: 3 additions & 1 deletion src/komodo_bitcoind.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <curl/easy.h>
#endif

#include "komodo_defs.h"

//#define issue_curl(cmdstr) bitcoind_RPC(0,(char *)"curl",(char *)"http://127.0.0.1:7776",0,0,(char *)(cmdstr))

struct MemoryStruct { char *memory; size_t size; };
Expand Down Expand Up @@ -559,7 +561,7 @@ uint32_t komodo_txtime(uint256 hash)

void komodo_disconnect(CBlockIndex *pindex,CBlock& block)
{
char symbol[16],dest[16]; struct komodo_state *sp;
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
//fprintf(stderr,"disconnect ht.%d\n",pindex->nHeight);
komodo_init(pindex->nHeight);
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
Expand Down
9 changes: 9 additions & 0 deletions src/komodo_defs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef KOMODO_DEFS_H
#define KOMODO_DEFS_H

#define ASSETCHAINS_MINHEIGHT 128
#define KOMODO_ELECTION_GAP 2000
#define ROUNDROBIN_DELAY 61
#define KOMODO_ASSETCHAIN_MAXLEN 65

#endif
1 change: 1 addition & 0 deletions src/komodo_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#ifndef H_KOMODOEVENTS_H
#define H_KOMODOEVENTS_H
#include "komodo_defs.h"

struct komodo_event *komodo_eventadd(struct komodo_state *sp,int32_t height,char *symbol,uint8_t type,uint8_t *data,uint16_t datalen)
{
Expand Down
Loading

0 comments on commit b78cf0c

Please sign in to comment.