Skip to content

Commit

Permalink
Merge pull request #6 from jl777/master
Browse files Browse the repository at this point in the history
master update
  • Loading branch information
ca333 authored Mar 23, 2017
2 parents 9beb1bc + 7674e37 commit 9fe0c0c
Show file tree
Hide file tree
Showing 16 changed files with 646 additions and 247 deletions.
163 changes: 82 additions & 81 deletions src/assetchains
Original file line number Diff line number Diff line change
@@ -1,86 +1,87 @@
#!/bin/bash
#!/bin/bash
set -x
delay=10
source pubkey.txt
echo $pubkey

./komodod -pubkey=$pubkey -ac_name=REVS -ac_supply=1300000 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=SUPERNET -ac_supply=816061 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=DEX -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=PANGEA -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=JUMBLR -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=BET -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=CRYPTO -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=HODL -ac_supply=9999999 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=SHARK -ac_supply=1401 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=BOTS -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=MGW -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=MVP -ac_supply=1000000 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=WIRELESS -ac_supply=21000000 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=KV -ac_supply=1000000 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=CEAL -ac_supply=366666666 -addnode=78.47.196.146 $1 -gen &
./komodod -pubkey=$pubkey -ac_name=MESH -ac_supply=1000000 -addnode=78.47.196.146 $1 -gen &
sleep 10
./komodod -pubkey=$pubkey -ac_name=REVS -ac_supply=1300000 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=SUPERNET -ac_supply=816061 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=DEX -ac_supply=999999 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=PANGEA -ac_supply=999999 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=JUMBLR -ac_supply=999999 -addnode=78.47.196.146 $1 &
./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=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 &
./komodod -pubkey=$pubkey -ac_name=WIRELESS -ac_supply=21000000 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=KV -ac_supply=1000000 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=CEAL -ac_supply=366666666 -addnode=78.47.196.146 $1 &
./komodod -pubkey=$pubkey -ac_name=MESH -ac_supply=1000000 -addnode=78.47.196.146 $1 &
sleep $delay

./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 &
./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=EUR -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=JPY -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=GBP -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=AUD -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=CAD -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=CHF -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=NZD -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=CNY -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=RUB -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=MXN -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=BRL -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=INR -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=HKD -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=TRY -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=ZAR -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=PLN -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=NOK -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=SEK -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=DKK -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=CZK -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=HUF -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=ILS -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=KRW -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=MYR -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=PHP -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=RON -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=SGD -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=THB -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=BGN -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=IDR -addnode=78.47.196.146 $1 &
sleep $delay
./komodod -pubkey=$pubkey -ac_name=HRK -addnode=78.47.196.146 $1 &
8 changes: 5 additions & 3 deletions src/bitcoind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ void WaitForShutdown(boost::thread_group* threadGroup)
while (!fShutdown)
{
//fprintf(stderr,"call passport iteration\n");
MilliSleep(10000);
komodo_passport_iteration();
if ( ASSETCHAINS_SYMBOL[0] == 0 )
{
komodo_passport_iteration();
MilliSleep(10000);
} else MilliSleep(1000);
fShutdown = ShutdownRequested();
}
if (threadGroup)
Expand Down Expand Up @@ -189,7 +192,6 @@ bool AppInit(int argc, char* argv[])
} catch (...) {
PrintExceptionContinue(NULL, "AppInit()");
}
fprintf(stderr,"fRet.%d\n",(int32_t)fRet);
if (!fRet)
{
threadGroup.interrupt_all();
Expand Down
28 changes: 17 additions & 11 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,8 @@ static void ZC_LoadParams()
/** Initialize bitcoin.
* @pre Parameters should be parsed and config file should be read.
*/
extern int32_t KOMODO_REWIND;

bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
{
// ********************************************************* Step 1: setup
Expand Down Expand Up @@ -1244,10 +1246,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
LogPrintf("Prune: pruned datadir may not have more than %d blocks; -checkblocks=%d may fail\n",
MIN_BLOCKS_TO_KEEP, GetArg("-checkblocks", 288));
}
if (!CVerifyDB().VerifyDB(pcoinsdbview, GetArg("-checklevel", 3),
GetArg("-checkblocks", 288))) {
strLoadError = _("Corrupted block database detected");
break;
if ( KOMODO_REWIND >= 0 )
{
if (!CVerifyDB().VerifyDB(pcoinsdbview, GetArg("-checklevel", 3),
GetArg("-checkblocks", 288))) {
strLoadError = _("Corrupted block database detected");
break;
}
}
} catch (const std::exception& e) {
if (fDebug) LogPrintf("%s\n", e.what());
Expand Down Expand Up @@ -1456,13 +1461,14 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)

if (mapArgs.count("-blocknotify"))
uiInterface.NotifyBlockTip.connect(BlockNotifyCallback);

uiInterface.InitMessage(_("Activating best chain..."));
// scan for better chains in the block chain database, that are not yet connected in the active best chain
CValidationState state;
if ( !ActivateBestChain(state))
strErrors << "Failed to connect best block";

if ( KOMODO_REWIND >= 0 )
{
uiInterface.InitMessage(_("Activating best chain..."));
// scan for better chains in the block chain database, that are not yet connected in the active best chain
CValidationState state;
if ( !ActivateBestChain(state))
strErrors << "Failed to connect best block";
}
std::vector<boost::filesystem::path> vImportFiles;
if (mapArgs.count("-loadblock"))
{
Expand Down
12 changes: 10 additions & 2 deletions src/komodo.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
return(-1);
if ( scriptlen == 35 && scriptbuf[0] == 33 && scriptbuf[34] == 0xac )
{
if ( i == 0 && j == 0 && memcmp(NOTARY_PUBKEY33,scriptbuf+1,33) == 0 )
if ( i == 0 && j == 0 && memcmp(NOTARY_PUBKEY33,scriptbuf+1,33) == 0 && NOTARY_PUBKEY33[0] != 0 )
{
printf("%s KOMODO_LASTMINED.%d -> %d\n",ASSETCHAINS_SYMBOL,KOMODO_LASTMINED,height);
prevKOMODO_LASTMINED = KOMODO_LASTMINED;
Expand Down Expand Up @@ -447,7 +447,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
}
}

if ( *isratificationp == 0 && (signedmask != 0 || (scriptbuf[len] != 'X' && scriptbuf[len] != 'A' && scriptbuf[len] != 'I')) )
if ( *isratificationp == 0 && (signedmask != 0 || (scriptbuf[len] != 'X' && scriptbuf[len] != 'A')) ) // && scriptbuf[len] != 'I')
komodo_stateupdate(height,0,0,0,txhash,0,0,0,0,0,0,value,&scriptbuf[len],opretlen,j);
}
}
Expand Down Expand Up @@ -545,6 +545,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
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 )
printf("(tx.%d: ",i);
for (j=0; j<numvouts; j++)
{
/*if ( i == 0 && j == 0 )
Expand All @@ -561,6 +563,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
}
}
}*/
if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
printf("%.8f ",dstr(block.vtx[i].vout[j].nValue));
len = block.vtx[i].vout[j].scriptPubKey.size();
if ( len >= sizeof(uint32_t) && len <= sizeof(scriptbuf) )
{
Expand All @@ -578,6 +582,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
}
}
}
if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
printf(") ");
//printf("%s ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d notarized.%d special.%d isratification.%d\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts,notarized,specialtx,isratification);
if ( notarized != 0 && (notarizedheight != 0 || specialtx != 0) )
{
Expand Down Expand Up @@ -618,6 +624,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
}
}
}
if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
printf("%s ht.%d\n",ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL,height);
if ( pindex->nHeight == hwmheight )
komodo_stateupdate(height,0,0,0,zero,0,0,0,0,height,(uint32_t)pindex->nTime,0,0,0,0);
} else fprintf(stderr,"komodo_connectblock: unexpected null pindex\n");
Expand Down
9 changes: 6 additions & 3 deletions src/komodo_bitcoind.h
Original file line number Diff line number Diff line change
Expand Up @@ -740,10 +740,12 @@ int32_t komodo_checkpoint(int32_t *notarized_heightp,int32_t nHeight,uint256 has
return(0);
}

uint32_t komodo_interest_args(int32_t *txheightp,uint32_t *tiptimep,uint64_t *valuep,uint256 hash,int32_t n)
uint32_t komodo_interest_args(uint32_t *txheighttimep,int32_t *txheightp,uint32_t *tiptimep,uint64_t *valuep,uint256 hash,int32_t n)
{
LOCK(cs_main);
CTransaction tx; uint256 hashBlock; CBlockIndex *pindex,*tipindex;
*txheighttimep = *txheightp = *tiptimep = 0;
*valuep = 0;
if ( !GetTransaction(hash,tx,hashBlock,true) )
return(0);
uint32_t locktime = 0;
Expand All @@ -753,6 +755,7 @@ uint32_t komodo_interest_args(int32_t *txheightp,uint32_t *tiptimep,uint64_t *va
{
*valuep = tx.vout[n].nValue;
*txheightp = pindex->nHeight;
*txheighttimep = pindex->nTime;
*tiptimep = tipindex->nTime;
locktime = tx.nLockTime;
//fprintf(stderr,"tx locktime.%u %.8f height.%d | tiptime.%u\n",locktime,(double)*valuep/COIN,*txheightp,*tiptimep);
Expand All @@ -764,8 +767,8 @@ uint32_t komodo_interest_args(int32_t *txheightp,uint32_t *tiptimep,uint64_t *va
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)
{
uint64_t value; uint32_t tiptime;
if ( (*locktimep= komodo_interest_args(txheightp,&tiptime,&value,hash,n)) != 0 )
uint64_t value; uint32_t tiptime,txheighttimep;
if ( (*locktimep= komodo_interest_args(&txheighttimep,txheightp,&tiptime,&value,hash,n)) != 0 )
{
if ( (checkvalue == 0 || value == checkvalue) && (checkheight == 0 || *txheightp == checkheight) )
return(komodo_interest(*txheightp,value,*locktimep,tiptime));
Expand Down
Loading

0 comments on commit 9fe0c0c

Please sign in to comment.