From d4a420a3126d93d791cc212fd9b9266453a9d9c4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Jan 2017 06:48:36 +0200 Subject: [PATCH 1/7] test --- src/komodo_interest.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/komodo_interest.h b/src/komodo_interest.h index 0cdab11eb..798dd7e02 100644 --- a/src/komodo_interest.h +++ b/src/komodo_interest.h @@ -75,10 +75,23 @@ 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); + if ( txheight <= 155949 ) + { + printf(">>>>>>>>>>>> txheight.%d %.8f locktime %u vs tiptime %u <<<<<<<<<\n",txheight,(double)nValue/COIN,nLockTime,tiptime); + exception = 0; + } + if ( exception == 0 ) + { + numerator = (nValue / 20); // assumes 5%! + interest = (numerator / denominator); + } + else + { + numerator = (nValue * KOMODO_INTEREST); + interest = (numerator / denominator) / COIN; + } } else { From 59d42bc87132e3c34c5aafc0190dfdc57e2fc3ac Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Jan 2017 07:07:06 +0200 Subject: [PATCH 2/7] test --- src/komodo_interest.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_interest.h b/src/komodo_interest.h index 798dd7e02..1bf595ed1 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 ) @@ -77,10 +77,10 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin denominator = 1; // max KOMODO_INTEREST per transfer, do it at least annually! if ( nValue > 25000LL*COIN ) { + exception = 0; if ( txheight <= 155949 ) { printf(">>>>>>>>>>>> txheight.%d %.8f locktime %u vs tiptime %u <<<<<<<<<\n",txheight,(double)nValue/COIN,nLockTime,tiptime); - exception = 0; } if ( exception == 0 ) { From bbc4bbc0b1156c7d16cd44d67bfb7c66bbb4cf0a Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Jan 2017 07:46:08 +0200 Subject: [PATCH 3/7] 40000 fix --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index ed90ffccd..7579e2363 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -554,7 +554,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 ) From 80b356d92b93262e32c1a30a3877c9a0856b9747 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Jan 2017 07:55:51 +0200 Subject: [PATCH 4/7] test --- src/komodo_interest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_interest.h b/src/komodo_interest.h index 1bf595ed1..70bc9a772 100644 --- a/src/komodo_interest.h +++ b/src/komodo_interest.h @@ -78,7 +78,7 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin if ( nValue > 25000LL*COIN ) { exception = 0; - if ( txheight <= 155949 ) + //if ( txheight <= 155949 ) { printf(">>>>>>>>>>>> txheight.%d %.8f locktime %u vs tiptime %u <<<<<<<<<\n",txheight,(double)nValue/COIN,nLockTime,tiptime); } From cd586654a5bda9a2c9bb17406c03aaac89a42fb6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Jan 2017 08:44:22 +0200 Subject: [PATCH 5/7] test --- src/komodo.h | 9 +++++---- src/komodo_bitcoind.h | 2 +- src/komodo_interest.h | 16 ++++++++++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 7579e2363..4d4604c28 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++) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 5af538d9b..1fe1a24e8 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 >= KOMODO_MAINNET_START ) 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_interest.h b/src/komodo_interest.h index 70bc9a772..3e2ae7fa1 100644 --- a/src/komodo_interest.h +++ b/src/komodo_interest.h @@ -78,9 +78,21 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin if ( nValue > 25000LL*COIN ) { exception = 0; - //if ( txheight <= 155949 ) + if ( txheight <= 155949 ) { - printf(">>>>>>>>>>>> txheight.%d %.8f locktime %u vs tiptime %u <<<<<<<<<\n",txheight,(double)nValue/COIN,nLockTime,tiptime); + 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 ) { From e0086592b154210d8e04da4c74563ebd07528276 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Jan 2017 08:45:16 +0200 Subject: [PATCH 6/7] test --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 1fe1a24e8..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 && notarized_height >= KOMODO_MAINNET_START ) + } 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); } From 174cae4128162cb81e0625d5fde78bcfa6e99757 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Jan 2017 08:48:36 +0200 Subject: [PATCH 7/7] test --- src/komodo.h | 3 ++- src/komodo_gateway.h | 2 +- src/komodo_kv.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 4d4604c28..0e8f8891c 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -496,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); } 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_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]); }