Browse Source

Merge pull request #709 from jl777/beta

Beta
beta_season3
jl777 7 years ago
committed by GitHub
parent
commit
58d47bed5b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      CMakeLists.txt
  2. 7
      Dockerfile
  3. 3
      crypto777/CMakeLists.txt
  4. 18
      iguana/dpow/dpow_fsm.c
  5. 2
      iguana/dpow/dpow_network.c
  6. 26
      iguana/dpow/dpow_rpc.c
  7. 2
      iguana/dpow/dpow_tx.c
  8. 2
      iguana/exchanges/CMakeLists.txt
  9. 20
      iguana/exchanges/LP_etomic.c
  10. 2
      iguana/exchanges/coins
  11. 10
      iguana/exchanges/etomicswap/bob.c
  12. 2
      iguana/exchanges/etomicswap/etomiclib.cpp
  13. 1
      iguana/exchanges/etomicswap/etomiclib.h
  14. 2
      iguana/iguana777.h
  15. 16
      iguana/iguana_notary.c
  16. 2
      iguana/keccak.c

2
CMakeLists.txt

@ -19,7 +19,7 @@ download_project(PROJ nanomsg
GIT_TAG 1.1.2
GIT_SHALLOW 1
GIT_PROGRESS 1
CMAKE_ARGS "-DNN_STATIC_LIB=ON -DNN_ENABLE_DOC=OFF -DNN_TESTS=OFF -DNN_TOOLS=OFF -DNN_ENABLE_NANOCAT=OFF -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_PREFIX}"
CMAKE_ARGS "-DNN_STATIC_LIB=ON -DNN_ENABLE_GETADDRINFO_A=OFF -DNN_ENABLE_DOC=OFF -DNN_TESTS=OFF -DNN_TOOLS=OFF -DNN_ENABLE_NANOCAT=OFF -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_PREFIX}"
UPDATE_DISCONNECTED 1
)

7
Dockerfile

@ -0,0 +1,7 @@
FROM ubuntu:17.10
RUN apt-get update && apt-get install -y git libcurl4-openssl-dev build-essential wget pax libleveldb-dev && apt-get clean
RUN wget https://cmake.org/files/v3.10/cmake-3.10.3-Linux-x86_64.sh && \
chmod +x cmake-3.10.3-Linux-x86_64.sh && \
./cmake-3.10.3-Linux-x86_64.sh --skip-license --exclude-subdir --prefix=/usr && \
rm -rf cmake-3.10.3-Linux-x86_64.sh
CMD rm -rf build && mkdir build && cd build && cmake .. && cmake --build . --target marketmaker-testnet

3
crypto777/CMakeLists.txt

@ -1,4 +1,5 @@
file(GLOB sources "*.c")
file(GLOB headers "*.h")
add_library(libcrypto777 ${sources} ${headers})
target_link_libraries(libcrypto777 PUBLIC curl)
target_compile_definitions(libcrypto777 PRIVATE USE_STATIC_NANOMSG)
target_link_libraries(libcrypto777 PUBLIC curl ${NANOMSG_LIBRARY})

18
iguana/dpow/dpow_fsm.c

@ -263,9 +263,9 @@ int32_t dpow_txhasnotarization(uint64_t *signedmaskp,int32_t *nothtp,struct supe
*nothtp = height - 10;
if ( (vouts= jarray(&numvouts,txobj,"vout")) != 0 )
{
bits256 blockhash,txid,MoM; uint32_t MoMdepth; char symbol[65],str[65],str2[65],str3[65];
bits256 blockhash,txid,MoM; uint32_t MoMdepth; char symbol[65];//,str[65],str2[65],str3[65];
vout = jitem(vouts,numvouts-1);
if ( (sobj= jobj(vout,"scriptPubKey")) != 0 && (hexstr= jstr(sobj,"hex")) != 0 && (len= is_hexstr(hexstr,0)) > 36 && len < sizeof(script) )
if ( (sobj= jobj(vout,"scriptPubKey")) != 0 && (hexstr= jstr(sobj,"hex")) != 0 && (len= is_hexstr(hexstr,0)) > 35*2 && len < sizeof(script)*2 )
{
len >>= 1;
decode_hex(script,len,hexstr);
@ -273,7 +273,7 @@ int32_t dpow_txhasnotarization(uint64_t *signedmaskp,int32_t *nothtp,struct supe
{
if ( bits256_nonz(MoM) == 0 || MoMdepth == 0 || *nothtp >= height || *nothtp < 0 )
*nothtp = 0;
printf("%s.%d notarizationht.%d %s -> %s MoM.%s [%d]\n",symbol,height,*nothtp,bits256_str(str,blockhash),bits256_str(str2,txid),bits256_str(str3,MoM),MoMdepth);
//printf("%s.%d notarizationht.%d %s -> %s MoM.%s [%d]\n",symbol,height,*nothtp,bits256_str(str,blockhash),bits256_str(str2,txid),bits256_str(str3,MoM),MoMdepth);
}
}
}
@ -316,7 +316,7 @@ bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct igu
free_json(blockjson);
if ( bits256_nonz(merkle) != 0 )
{
merkles = calloc(3*maxdepth+1,sizeof(*merkles));
merkles = calloc(4*maxdepth+1,sizeof(*merkles));
merkles[MoMdepth++] = merkle;
ht = height - MoMdepth;
while ( MoMdepth < maxdepth && ht > breakht && ht > 0 )
@ -401,6 +401,7 @@ void dpow_statemachinestart(void *ptr)
{
kmdheight = dest->longestchain;
//portable_mutex_lock(&myinfo->MoM_mutex);
//if ( Notaries_port != DPOW_SOCKPORT )
MoM = dpow_calcMoM(&MoMdepth,myinfo,src,checkpoint.blockhash.height);
//portable_mutex_unlock(&myinfo->MoM_mutex);
}
@ -604,7 +605,7 @@ void dpow_statemachinestart(void *ptr)
{
if ( (checkpoint.blockhash.height % 100) != 0 && dp->checkpoint.blockhash.height > checkpoint.blockhash.height )
{
printf("abort %s ht.%d due to new checkpoint.%d\n",dp->symbol,checkpoint.blockhash.height,dp->checkpoint.blockhash.height);
//printf("abort %s ht.%d due to new checkpoint.%d\n",dp->symbol,checkpoint.blockhash.height,dp->checkpoint.blockhash.height);
dp->ratifying -= bp->isratify;
free(ptr);
return;
@ -637,12 +638,11 @@ void dpow_statemachinestart(void *ptr)
extralen = dpow_paxpending(extras,&bp->paxwdcrc,bp->MoM,bp->MoMdepth);
bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc;
}
sleep(13);
if ( dp->checkpoint.blockhash.height > checkpoint.blockhash.height )
if ( (checkpoint.blockhash.height % 100) != 0 && dp->checkpoint.blockhash.height > checkpoint.blockhash.height )
{
if ( bp->isratify == 0 )
{
printf("abort %s ht.%d due to new checkpoint.%d\n",dp->symbol,checkpoint.blockhash.height,dp->checkpoint.blockhash.height);
//printf("abort %s ht.%d due to new checkpoint.%d\n",dp->symbol,checkpoint.blockhash.height,dp->checkpoint.blockhash.height);
break;
}
}
@ -659,6 +659,7 @@ void dpow_statemachinestart(void *ptr)
{
printf("%s ht.%d %s got reorged to %s, abort notarization\n",bp->srccoin->symbol,bp->height,bits256_str(str,bp->hashmsg),bits256_str(str2,checkhash));
bp->state = 0xffffffff;
break;
}
}
if ( bp->state != 0xffffffff )
@ -676,6 +677,7 @@ void dpow_statemachinestart(void *ptr)
printf("abort pending ratify\n");
break;
}
sleep(30);
}
printf("[%d] END isratify.%d:%d bestk.%d %llx sigs.%llx state.%x machine ht.%d completed state.%x %s.%s %s.%s recvmask.%llx paxwdcrc.%x %p %p\n",Numallocated,bp->isratify,dp->ratifying,bp->bestk,(long long)bp->bestmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),bp->state,bp->height,bp->state,dp->dest,bits256_str(str,bp->desttxid),dp->symbol,bits256_str(str2,bp->srctxid),(long long)bp->recvmask,bp->paxwdcrc,src,dest);
dp->lastrecvmask = bp->recvmask;

2
iguana/dpow/dpow_network.c

@ -1901,7 +1901,7 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru
printf("mypaxcrc.%x\n",bp->paxwdcrc);
}
char str[65];
if ( (rand() % 130) == 0 )//|| strcmp(dp->symbol,"CHIPS") == 0 )
if ( (rand() % 130) == 0 || strcmp(dp->symbol,"CHIPS") == 0 )
printf("%p ht.%d [%d] ips.%d %s NOTARIZE.%d matches.%d paxmatches.%d bestmatches.%d bestk.%d %llx recv.%llx sigmasks.(%llx %llx) senderind.%d state.%x (%x %x %x) MoM.%s [%d]\n",bp,bp->height,bp->myind,dp->numipbits,dp->symbol,bp->minsigs,matches,paxmatches,bestmatches,bp->bestk,(long long)bp->bestmask,(long long)bp->recvmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),(long long)(bp->bestk>=0?bp->srcsigsmasks[bp->bestk]:0),senderind,bp->state,bp->hashmsg.uints[0],bp->desttxid.uints[0],bp->srctxid.uints[0],bits256_str(str,bp->MoM),bp->MoMdepth);
}
}

26
iguana/dpow/dpow_rpc.c

@ -43,7 +43,7 @@ cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin)
{
buf[0] = 0;
retstr = bitcoind_getinfo(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->getinfostr);
usleep(1000);
usleep(10000);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
{
@ -71,11 +71,11 @@ cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin)
return(json);
}
char *Notaries_elected[64][2];
char *Notaries_elected[65][2];
char *seeds[] = { "78.47.196.146", "5.9.102.210", "149.56.29.163", "191.235.80.138", "88.198.65.74", "94.102.63.226", "129.232.225.202", "104.255.64.3", "52.72.135.200", "149.56.28.84", "103.18.58.150", "221.121.144.140", "123.249.79.12", "103.18.58.146", "27.50.93.252", "176.9.0.233", "94.102.63.227", "167.114.227.223", "27.50.68.219", "192.99.233.217", "94.102.63.217", "45.64.168.216" };
int32_t Notaries_numseeds = (int32_t)(sizeof(seeds)/sizeof(*seeds)),Notaries_num,Notaries_BTCminsigs = DPOW_MINSIGS,Notaries_minsigs = DPOW_MIN_ASSETCHAIN_SIGS;
uint16_t Notaries_port = DPOW_SOCKPORT;
char *Notaries_seeds[64];
char *Notaries_seeds[65];
int32_t komodo_initjson(char *fname)
{
@ -94,7 +94,7 @@ int32_t komodo_initjson(char *fname)
Notaries_minsigs = num;
if ( (array= jarray(&n,argjson,"seeds")) != 0 && n <= 64 )
{
for (i=0; i<n; i++)
for (i=0; i<n&&i<64; i++)
{
Notaries_seeds[i] = clonestr(jstri(array,i));
printf("%s ",Notaries_seeds[i]);
@ -103,7 +103,7 @@ int32_t komodo_initjson(char *fname)
}
if ( (array= jarray(&n,argjson,"notaries")) != 0 && n <= 64 )
{
for (i=0; i<n; i++)
for (i=0; i<n&&i<64; i++)
{
item = jitem(array,i);
field = jfieldname(item);
@ -275,7 +275,7 @@ bits256 dpow_getblockhash(struct supernet_info *myinfo,struct iguana_info *coin,
sprintf(buf,"%d",height);
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getblockhash",buf);
//printf("%s ht.%d -> getblockhash.(%s)\n",coin->symbol,height,retstr);
usleep(1000);
usleep(10000);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
{
@ -304,7 +304,7 @@ cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits2
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getblock",buf);
if ( 0 && strcmp(coin->symbol,"USD") == 0 )
printf("%s getblock.(%s)\n",coin->symbol,retstr);
usleep(1000);
usleep(10000);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
{
@ -329,7 +329,7 @@ char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin
{
sprintf(buf,"\"%s\"",address);
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"validateaddress",buf);
usleep(1000);
usleep(10000);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
{
@ -349,7 +349,7 @@ cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits2
if ( coin->FULLNODE < 0 )
{
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"gettxout",buf);
usleep(1000);
usleep(10000);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
{
@ -380,7 +380,7 @@ char *dpow_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"decoderawtransaction",paramstr);
//printf("%s decoderawtransaction.(%s) <- (%s)\n",coin->symbol,retstr,paramstr);
free(paramstr);
usleep(1000);
usleep(10000);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
{
@ -402,7 +402,7 @@ cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin
if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getrawtransaction",buf)) != 0 )
{
}
usleep(1000);
usleep(10000);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
{
@ -509,7 +509,7 @@ char *dpow_signrawtransaction(struct supernet_info *myinfo,struct iguana_info *c
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"signrawtransaction",paramstr);
//printf("%s signrawtransaction.(%s) params.(%s)\n",coin->symbol,retstr,paramstr);
free(paramstr);
usleep(1000);
usleep(10000);
return(retstr);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
@ -1298,7 +1298,7 @@ int32_t dpow_issuer_iteration(struct dpow_info *dp,struct iguana_info *coin,int3
printf("error height %d\n",height);
break;
}
usleep(1000);
usleep(10000);
}
if ( height >= currentheight )
*isrealtimep = (uint32_t)time(NULL);

2
iguana/dpow/dpow_tx.c

@ -169,6 +169,8 @@ struct dpow_block *dpow_heightfind(struct supernet_info *myinfo,struct dpow_info
int32_t r,h,incr = 100000; struct dpow_block *bp = 0;
if ( height > dp->maxblocks )
{
if ( dp->maxblocks+incr < height+10000 )
incr = (height+10000) - dp->maxblocks;
dp->blocks = realloc(dp->blocks,sizeof(*dp->blocks) * (dp->maxblocks + incr));
memset(&dp->blocks[dp->maxblocks],0,sizeof(*dp->blocks) * incr);
dp->maxblocks += incr;

2
iguana/exchanges/CMakeLists.txt

@ -1,6 +1,6 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(MM_SOURCES mm.c ../mini-gmp.c ../groestl.c ../segwit_addr.c ../keccak.c LP_etomic.c)
set(MM_LIBS ${NANOMSG_LIBRARY} curl pthread libcrypto777 libjpeg libsecp256k1)
set(MM_LIBS curl pthread libcrypto777 libjpeg libsecp256k1)
add_executable(marketmaker-testnet ${MM_SOURCES})
add_executable(marketmaker-mainnet ${MM_SOURCES})
include_directories(../../crypto777)

20
iguana/exchanges/LP_etomic.c

@ -28,15 +28,23 @@ int32_t LP_etomic_wait_for_confirmation(char *txId)
return(waitForConfirmation(txId));
}
void LP_etomic_pubkeystr_to_addr(char *pubkey, char *output)
{
char *address = pubKey2Addr(pubkey);
strcpy(output, address);
free(address);
}
char *LP_etomicalice_send_fee(struct basilisk_swap *swap)
{
char amount[100], secretKey[70];
char amount[100], secretKey[70], dexaddr[50];
satoshisToWei(amount, swap->myfee.I.amount);
uint8arrayToHex(secretKey, swap->persistent_privkey.bytes, 32);
LP_etomic_pubkeystr_to_addr(INSTANTDEX_PUBKEY, dexaddr);
if (strcmp(swap->I.alicestr,"ETH") == 0 ) {
return(sendEth(ETH_FEE_ACCEPTOR, amount, secretKey, 1));
return(sendEth(dexaddr, amount, secretKey, 1));
} else {
return(sendErc20(swap->I.alicetomic, ETH_FEE_ACCEPTOR, amount, secretKey, 1));
return(sendErc20(swap->I.alicetomic, dexaddr, amount, secretKey, 1));
}
}
@ -52,8 +60,10 @@ uint8_t LP_etomic_verify_alice_fee(struct basilisk_swap *swap)
return(0);
}
char dexaddr[50];
LP_etomic_pubkeystr_to_addr(INSTANTDEX_PUBKEY, dexaddr);
if ( strcmp(swap->I.alicestr,"ETH") == 0 ) {
if (strcmp(data.to, ETH_FEE_ACCEPTOR) != 0) {
if (strcmp(data.to, dexaddr) != 0) {
printf("Alice fee %s was sent to wrong address %s\n", swap->otherfee.I.ethTxid, data.to);
return(0);
}
@ -70,7 +80,7 @@ uint8_t LP_etomic_verify_alice_fee(struct basilisk_swap *swap)
}
char weiAmount[70];
satoshisToWei(weiAmount, swap->otherfee.I.amount);
return(verifyAliceErc20FeeData(swap->I.alicetomic, ETH_FEE_ACCEPTOR, weiAmount, data.input));
return(verifyAliceErc20FeeData(swap->I.alicetomic, dexaddr, weiAmount, data.input));
}
}

2
iguana/exchanges/coins

File diff suppressed because one or more lines are too long

10
iguana/exchanges/etomicswap/bob.c

@ -330,11 +330,14 @@ int main(int argc, char** argv)
default:
return 1;
}
/*
char *pubkey = getPubKeyFromPriv(getenv("BOB_PK"));
printf("pubkey: %s\n", pubkey);
free(pubkey);
char *address = pubKey2Addr("03bc2c7ba671bae4a6fc835244c9762b41647b9827d4780a89a949b984a8ddcc06");
printf("address: %s\n", address);
free(address);
uint64_t satoshis = 100000000;
char weiBuffer[100];
satoshisToWei(weiBuffer, satoshis);
@ -346,16 +349,15 @@ int main(int argc, char** argv)
uint64_t tokenAllowance = getErc20Allowance(bobAddress, bobContractAddress, tokenAddress);
printf("allowance: %" PRIu64 "\n", tokenAllowance);
char *sendEthTx = sendEth(bobAddress, "100000000000000", getenv("BOB_PK"));
char *sendEthTx = sendEth(bobAddress, "100000000000000", getenv("BOB_PK"), 0);
printf("sent ETH: %s\n", sendEthTx);
free(sendEthTx);
char *sendErc20Tx = sendErc20(tokenAddress, bobAddress, "100000000000000", getenv("BOB_PK"));
char *sendErc20Tx = sendErc20(tokenAddress, bobAddress, "100000000000000", getenv("BOB_PK"), 0);
printf("sent Erc20: %s\n", sendErc20Tx);
free(sendErc20Tx);
uint64_t gasPrice = getGasPriceFromStation();
printf("gasPrice: %" PRIu64 "\n", gasPrice);
*/
return 0;
}

2
iguana/exchanges/etomicswap/etomiclib.cpp

@ -26,7 +26,7 @@ TransactionSkeleton txDataToSkeleton(BasicTxData txData)
tx.from = jsToAddress(txData.from);
tx.to = jsToAddress(txData.to);
tx.value = jsToU256(txData.amount);
tx.gas = 100000;
tx.gas = 200000;
tx.gasPrice = getGasPriceFromStation() * boost::multiprecision::pow(u256(10), 9);
tx.nonce = getNonce(txData.from);
return tx;

1
iguana/exchanges/etomicswap/etomiclib.h

@ -16,7 +16,6 @@ extern "C" {
#endif
#define EMPTY_ETH_TX_ID "0x0000000000000000000000000000000000000000000000000000000000000000"
#define ETH_FEE_ACCEPTOR "0x485d2cc2d13a9e12e4b53d606db1c8adc884fb8a"
typedef struct {
char from[65];

2
iguana/iguana777.h

@ -167,7 +167,7 @@ struct supernet_info
uint8_t *pingbuf;
struct basilisk_request DEXaccept;
FILE *dexfp;
struct dpow_info DPOWS[128]; int32_t numdpows,dpowsock,dexsock,pubsock,repsock,subsock,reqsock;
struct dpow_info DPOWS[1024]; int32_t numdpows,dpowsock,dexsock,pubsock,repsock,subsock,reqsock;
struct delayedPoW_info dPoW;
struct basilisk_spend *spends; int32_t numspends;
char bindaddr[64];

16
iguana/iguana_notary.c

@ -95,7 +95,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
if ( height > 0 && blocktime > 0 )
{
dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime);
if ( (0) &&strcmp("BEER",dp->symbol) == 0 )
if ( (0) && strcmp("CHIPS",dp->symbol) == 0 )
printf("dynamic set %s/%s %s <- height.%d\n",dp->symbol,dp->dest,bits256_str(str,hash),height);
checkpoint = dp->last;
} else return;
@ -109,7 +109,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
printf("lastnotarized.(%s) is current checkpoint, skip\n",bits256_str(str,dp->lastnotarized));
return;
}
if ( (0) && strcmp("BEER",dp->symbol) == 0 )
if ( (0) && strcmp("CHIPS",dp->symbol) == 0 )
printf("checkpoint.(%s) is not active and not lastnotarized\n",bits256_str(str,checkpoint.blockhash.hash));
} else return;
} else return;
@ -118,14 +118,14 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
}
if ( bits256_nonz(checkpoint.blockhash.hash) != 0 && (checkpoint.blockhash.height % freq) == 0 )
{
if ( (0) && strcmp("BEER",dp->symbol) == 0 )
if ( (0) && strcmp("CHIPS",dp->symbol) == 0 )
printf("%s/%s src ht.%d dest.%u nonz.%d %s minsigs.%d\n",dp->symbol,dp->dest,checkpoint.blockhash.height,dp->destupdated,bits256_nonz(checkpoint.blockhash.hash),bits256_str(str,dp->last.blockhash.hash),minsigs);
dpow_heightfind(myinfo,dp,checkpoint.blockhash.height + 1000);
ptrs = calloc(1,sizeof(void *)*5 + sizeof(struct dpow_checkpoint) + sizeof(pthread_t));
ptrs[0] = (void *)myinfo;
ptrs[1] = (void *)dp;
ptrs[2] = (void *)(uint64_t)minsigs;
if ( strcmp(dp->dest,"KMD") != 0 && strcmp(dp->dest,"CHAIN") != 0 )
if ( strcmp(dp->dest,"KMD") != 0 )
ptrs[3] = (void *)DPOW_DURATION;
else ptrs[3] = (void *)(DPOW_DURATION * 60); // essentially try forever for assetchains
ptrs[4] = 0;
@ -135,11 +135,13 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
if ( OS_thread_create((void *)((uint64_t)&ptrs[5] + sizeof(struct dpow_checkpoint)),NULL,(void *)dpow_statemachinestart,(void *)ptrs) != 0 )
{
}
if ( ht > 100 )
if ( ht > 500 )
{
for (i=ht-100; i>=0; i--)
if ( (0) && strcmp("CHIPS",dp->symbol) == 0 )
printf("ht.%d maxblocks.%d\n",ht,dp->maxblocks);
for (i=ht-500; i>ht-10000; i--)
{
if ( (bp= dp->blocks[i]) != 0 && bp->state == 0xffffffff )
if ( (i % 100) != 0 && (bp= dp->blocks[i]) != 0 && bp->state == 0xffffffff )
{
dp->blocks[i] = 0;
Numallocated--;

2
iguana/keccak.c

@ -39,9 +39,7 @@
extern "C"{
#endif
#if defined(WIN32)
#include <stdint.h>
#endif
/*
* Parameters:

Loading…
Cancel
Save