diff --git a/src/komodo.h b/src/komodo.h index ed90ffccd..0e8f8891c 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -416,7 +416,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr komodo_stateupdate(height,0,0,0,txhash,0,0,0,0,0,0,value,&scriptbuf[len],opretlen-len+4+3+(scriptbuf[1] == 0x4d),j); } } - } else printf("notarized.%d %llx reject ht.%d NOTARIZED.%d prev.%d %s.%s DESTTXID.%s (%s)\n",notarized,(long long)signedmask,height,*notarizedheightp,sp->NOTARIZED_HEIGHT,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,kmdtxid.ToString().c_str(),desttxid.ToString().c_str(),(char *)&scriptbuf[len]); + } else if ( height >= KOMODO_MAINNET_START ) + printf("notarized.%d %llx reject ht.%d NOTARIZED.%d prev.%d %s.%s DESTTXID.%s (%s)\n",notarized,(long long)signedmask,height,*notarizedheightp,sp->NOTARIZED_HEIGHT,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,kmdtxid.ToString().c_str(),desttxid.ToString().c_str(),(char *)&scriptbuf[len]); } else if ( i == 0 && j == 1 && opretlen == 149 ) { @@ -425,9 +426,9 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr } else { - int32_t k; for (k=0; k= 32*2+4 && strcmp(ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,(char *)&scriptbuf[len+32*2+4]) == 0 ) { for (k=0; k<32; k++) @@ -495,7 +496,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) hwmheight = pindex->nHeight; else { - printf("%s hwmheight.%d vs pindex->nHeight.%d t.%u reorg.%d\n",ASSETCHAINS_SYMBOL,hwmheight,pindex->nHeight,(uint32_t)pindex->nTime,hwmheight-pindex->nHeight); + if ( pindex->nHeight != hwmheight ) + printf("%s hwmheight.%d vs pindex->nHeight.%d t.%u reorg.%d\n",ASSETCHAINS_SYMBOL,hwmheight,pindex->nHeight,(uint32_t)pindex->nTime,hwmheight-pindex->nHeight); komodo_event_rewind(sp,symbol,pindex->nHeight); komodo_stateupdate(pindex->nHeight,0,0,0,zero,0,0,0,0,-pindex->nHeight,pindex->nTime,0,0,0,0); } @@ -554,7 +556,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) } } } - 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); + //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) ) { if ( isratification != 0 ) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 5af538d9b..dbcf721e0 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -683,7 +683,7 @@ int32_t komodo_checkpoint(int32_t *notarized_heightp,int32_t nHeight,uint256 has return(-1); } } else fprintf(stderr,"unexpected error notary_hash %s ht.%d at ht.%d\n",notarized_hash.ToString().c_str(),notarized_height,notary->nHeight); - } else if ( notarized_height > 0 && notarized_height != 73880 ) + } else if ( notarized_height > 0 && notarized_height != 73880 && notarized_height >= 170000 ) fprintf(stderr,"[%s] couldnt find notarized.(%s %d) ht.%d\n",ASSETCHAINS_SYMBOL,notarized_hash.ToString().c_str(),notarized_height,pindex->nHeight); return(0); } diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 4ec0b0f04..10b07cd46 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -818,7 +818,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 if ( (pax= komodo_paxmark(height,txids[i],vouts[i],'D',height)) != 0 ) komodo_paxdelete(pax); } - } else printf("opreturn none issued?\n"); + } //else printf("opreturn none issued?\n"); } } else if ( opretbuf[0] == 'W' )//&& opretlen >= 38 ) diff --git a/src/komodo_interest.h b/src/komodo_interest.h index 0cdab11eb..3e2ae7fa1 100644 --- a/src/komodo_interest.h +++ b/src/komodo_interest.h @@ -65,7 +65,7 @@ uint64_t komodo_moneysupply(int32_t height) uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime) { - int32_t minutes; uint64_t numerator,denominator,interest = 0; + int32_t minutes,exception; uint64_t numerator,denominator,interest = 0; if ( ASSETCHAINS_SYMBOL[0] != 0 ) return(0); if ( komodo_moneysupply(txheight) < MAX_MONEY && nLockTime >= LOCKTIME_THRESHOLD && tiptime != 0 && nLockTime < tiptime && nValue >= 10*COIN ) @@ -75,10 +75,35 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin denominator = (((uint64_t)365 * 24 * 60) / minutes); if ( denominator == 0 ) denominator = 1; // max KOMODO_INTEREST per transfer, do it at least annually! - if ( nValue > 25000LL*COIN && txheight > 155949 ) + if ( nValue > 25000LL*COIN ) { - numerator = (nValue / 20); // assumes 5%! - interest = (numerator / denominator); + exception = 0; + if ( txheight <= 155949 ) + { + if ( (txheight == 116607 && nValue == 2502721100000LL) || + (txheight == 126891 && nValue == 2879650000000) || + (txheight == 129510 && nValue == 3000000000000) || + (txheight == 141549 && nValue == 3500000000000) || + (txheight == 154473 && nValue == 3983399350000) || + (txheight == 154736 && nValue == 3983406748175) || + (txheight == 155013 && nValue == 3983414006565) || + (txheight == 155492 && nValue == 3983427592291) || + (txheight == 155613 && nValue == 9997409999999797) || + (txheight == 157927 && nValue == 9997410667451072) || + (txheight == 155613 && nValue == 2590000000000) ) + exception = 1; + printf(">>>>>>>>>>>> exception.%d txheight.%d %.8f locktime %u vs tiptime %u <<<<<<<<<\n",exception,txheight,(double)nValue/COIN,nLockTime,tiptime); + } + if ( exception == 0 ) + { + numerator = (nValue / 20); // assumes 5%! + interest = (numerator / denominator); + } + else + { + numerator = (nValue * KOMODO_INTEREST); + interest = (numerator / denominator) / COIN; + } } else { diff --git a/src/komodo_kv.h b/src/komodo_kv.h index 07adadf2b..1ed6e1347 100644 --- a/src/komodo_kv.h +++ b/src/komodo_kv.h @@ -177,7 +177,7 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value) ptr->height = height; ptr->flags = flags | 1; portable_mutex_unlock(&KOMODO_KV_mutex); - } else printf("size mismatch %d vs %d\n",opretlen,coresize); + } //else printf("size mismatch %d vs %d\n",opretlen,coresize); } else printf("insufficient fee %.8f vs %.8f flags.%d keylen.%d valuesize.%d height.%d (%02x %02x %02x) (%02x %02x %02x)\n",(double)fee/COIN,(double)value/COIN,flags,keylen,valuesize,height,key[0],key[1],key[2],valueptr[0],valueptr[1],valueptr[2]); }