From 7255df320a3100a5c7b1a2a6292ed7e0d3e54597 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 09:14:57 +0200 Subject: [PATCH 1/6] Test --- src/miner.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index e9ab80741..74e72aad6 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -426,10 +426,10 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) CValidationState state; if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false)) { - static uint32_t counter; - if ( counter++ < 100 ) + //static uint32_t counter; + //if ( counter++ < 100 ) fprintf(stderr,"warning: testblockvalidity failed\n"); - return(0); + //return(0); //throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); } } @@ -612,15 +612,15 @@ void static BitcoinMiner(CWallet *pwallet) Mining_height = pindexPrev->nHeight+1; Mining_start = (uint32_t)time(NULL); } - if ( ASSETCHAINS_SYMBOL[0] != 0 ) + //if ( ASSETCHAINS_SYMBOL[0] != 0 ) fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height); CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey); if ( ptr == 0 ) { - static uint32_t counter; - if ( counter++ < 100 ) + //static uint32_t counter; + //if ( counter++ < 100 ) fprintf(stderr,"created illegal block, retry\n"); - continue; + //continue; } unique_ptr pblocktemplate(ptr); if (!pblocktemplate.get()) From e2ab5cb17bfd117dd22a3df103529d2fb6ef4263 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 09:34:13 +0200 Subject: [PATCH 2/6] Test --- src/komodo_gateway.h | 12 ++++++------ src/miner.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 016309a86..d7127bdb6 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -661,7 +661,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above { if ( n == 2 && block.vtx[0].vout[1].nValue > COIN/10 ) { - //fprintf(stderr,">>>>>>>> <<<<<<<<<< ht.%d illegal nonz output %.8f n.%d\n",height,dstr(block.vtx[0].vout[1].nValue),n); +fprintf(stderr,">>>>>>>> <<<<<<<<<< ht.%d illegal nonz output %.8f n.%d\n",height,dstr(block.vtx[0].vout[1].nValue),n); if ( height >= 235300 ) return(-1); } @@ -701,9 +701,9 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above { if ( (sp= komodo_stateptrget(CURRENCIES[baseids[i-1]])) != 0 && (sp->RTmask & (1LL << baseids[i-1])) == 0 ) { - /*printf("skip checkdeposit.%s not RT %llx\n",CURRENCIES[baseids[i-1]],(long long)sp->RTmask); - matched++; - continue;*/ + printf("checkdeposit.%s not RT %llx\n",CURRENCIES[baseids[i-1]],(long long)sp->RTmask); + //matched++; + //continue; } if ( (pax= komodo_paxfinds(txids[i-1],vouts[i-1])) != 0 ) // finds... make sure right one { @@ -724,7 +724,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above } else { - if ( opcode == 'X' && strcmp(ASSETCHAINS_SYMBOL,CURRENCIES[baseids[i]]) == 0 ) + //if ( opcode == 'X' && strcmp(ASSETCHAINS_SYMBOL,CURRENCIES[baseids[i]]) == 0 ) printf("check deposit validates %s %.8f -> %.8f\n",CURRENCIES[baseids[i]],dstr(srcvalues[i]),dstr(values[i])); matched++; } @@ -756,7 +756,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above printf("REJECT: ht.%d (%c) matched.%d vs num.%d\n",height,opcode,matched,num); return(-1); } - } + } else printf("accept paxdeposit\n"); } else { diff --git a/src/miner.cpp b/src/miner.cpp index 74e72aad6..429d4b6d1 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -620,7 +620,7 @@ void static BitcoinMiner(CWallet *pwallet) //static uint32_t counter; //if ( counter++ < 100 ) fprintf(stderr,"created illegal block, retry\n"); - //continue; + continue; } unique_ptr pblocktemplate(ptr); if (!pblocktemplate.get()) From 4fb9b7064c74c996743a957af397af6b86e7b909 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 09:45:12 +0200 Subject: [PATCH 3/6] Revert "Test" This reverts commit e2ab5cb17bfd117dd22a3df103529d2fb6ef4263. --- src/komodo_gateway.h | 12 ++++++------ src/miner.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index d7127bdb6..016309a86 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -661,7 +661,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above { if ( n == 2 && block.vtx[0].vout[1].nValue > COIN/10 ) { -fprintf(stderr,">>>>>>>> <<<<<<<<<< ht.%d illegal nonz output %.8f n.%d\n",height,dstr(block.vtx[0].vout[1].nValue),n); + //fprintf(stderr,">>>>>>>> <<<<<<<<<< ht.%d illegal nonz output %.8f n.%d\n",height,dstr(block.vtx[0].vout[1].nValue),n); if ( height >= 235300 ) return(-1); } @@ -701,9 +701,9 @@ fprintf(stderr,">>>>>>>> <<<<<<<<<< ht.%d illegal nonz output %.8f n.%d\n",heigh { if ( (sp= komodo_stateptrget(CURRENCIES[baseids[i-1]])) != 0 && (sp->RTmask & (1LL << baseids[i-1])) == 0 ) { - printf("checkdeposit.%s not RT %llx\n",CURRENCIES[baseids[i-1]],(long long)sp->RTmask); - //matched++; - //continue; + /*printf("skip checkdeposit.%s not RT %llx\n",CURRENCIES[baseids[i-1]],(long long)sp->RTmask); + matched++; + continue;*/ } if ( (pax= komodo_paxfinds(txids[i-1],vouts[i-1])) != 0 ) // finds... make sure right one { @@ -724,7 +724,7 @@ fprintf(stderr,">>>>>>>> <<<<<<<<<< ht.%d illegal nonz output %.8f n.%d\n",heigh } else { - //if ( opcode == 'X' && strcmp(ASSETCHAINS_SYMBOL,CURRENCIES[baseids[i]]) == 0 ) + if ( opcode == 'X' && strcmp(ASSETCHAINS_SYMBOL,CURRENCIES[baseids[i]]) == 0 ) printf("check deposit validates %s %.8f -> %.8f\n",CURRENCIES[baseids[i]],dstr(srcvalues[i]),dstr(values[i])); matched++; } @@ -756,7 +756,7 @@ fprintf(stderr,">>>>>>>> <<<<<<<<<< ht.%d illegal nonz output %.8f n.%d\n",heigh printf("REJECT: ht.%d (%c) matched.%d vs num.%d\n",height,opcode,matched,num); return(-1); } - } else printf("accept paxdeposit\n"); + } } else { diff --git a/src/miner.cpp b/src/miner.cpp index 429d4b6d1..74e72aad6 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -620,7 +620,7 @@ void static BitcoinMiner(CWallet *pwallet) //static uint32_t counter; //if ( counter++ < 100 ) fprintf(stderr,"created illegal block, retry\n"); - continue; + //continue; } unique_ptr pblocktemplate(ptr); if (!pblocktemplate.get()) From d0f7ead0c488816f7591cb03acb59def332276a6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 09:45:22 +0200 Subject: [PATCH 4/6] Revert "Test" This reverts commit 7255df320a3100a5c7b1a2a6292ed7e0d3e54597. --- src/miner.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 74e72aad6..e9ab80741 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -426,10 +426,10 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) CValidationState state; if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false)) { - //static uint32_t counter; - //if ( counter++ < 100 ) + static uint32_t counter; + if ( counter++ < 100 ) fprintf(stderr,"warning: testblockvalidity failed\n"); - //return(0); + return(0); //throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); } } @@ -612,15 +612,15 @@ void static BitcoinMiner(CWallet *pwallet) Mining_height = pindexPrev->nHeight+1; Mining_start = (uint32_t)time(NULL); } - //if ( ASSETCHAINS_SYMBOL[0] != 0 ) + if ( ASSETCHAINS_SYMBOL[0] != 0 ) fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height); CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey); if ( ptr == 0 ) { - //static uint32_t counter; - //if ( counter++ < 100 ) + static uint32_t counter; + if ( counter++ < 100 ) fprintf(stderr,"created illegal block, retry\n"); - //continue; + continue; } unique_ptr pblocktemplate(ptr); if (!pblocktemplate.get()) From 6c8cc7ee1f05c333ed7d75f5bef98001bc7a26a6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 16:40:44 +0200 Subject: [PATCH 5/6] Sum outputs --- src/komodo_gateway.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 016309a86..e46ad39ee 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -630,7 +630,7 @@ void komodo_bannedset(uint256 *array,int32_t max) int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above block is valid pax pricing { static uint256 array[15]; - int32_t i,j,k,n,ht,txn_count,num,opretlen,offset=1,errs=0,matched=0,kmdheights[64],otherheights[64]; uint256 hash,txids[64]; char symbol[16],base[16]; uint16_t vouts[64]; int8_t baseids[64]; uint8_t *script,opcode,rmd160s[64*20]; uint64_t available,deposited,issued,withdrawn,approved,redeemed; int64_t values[64],srcvalues[64]; struct pax_transaction *pax; struct komodo_state *sp; + int32_t i,j,k,n,ht,txn_count,num,opretlen,offset=1,errs=0,matched=0,kmdheights[64],otherheights[64]; uint256 hash,txids[64]; char symbol[16],base[16]; uint16_t vouts[64]; int8_t baseids[64]; uint8_t *script,opcode,rmd160s[64*20]; uint64_t total,available,deposited,issued,withdrawn,approved,redeemed; int64_t values[64],srcvalues[64]; struct pax_transaction *pax; struct komodo_state *sp; if ( *(int32_t *)&array[0] == 0 ) komodo_bannedset(array,(int32_t)(sizeof(array)/sizeof(*array))); memset(baseids,0xff,sizeof(baseids)); @@ -659,7 +659,10 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above script = (uint8_t *)block.vtx[0].vout[n-1].scriptPubKey.data(); if ( n <= 2 || script[0] != 0x6a ) { - if ( n == 2 && block.vtx[0].vout[1].nValue > COIN/10 ) + total = 0; + for (i=1; i COIN/10 ) { //fprintf(stderr,">>>>>>>> <<<<<<<<<< ht.%d illegal nonz output %.8f n.%d\n",height,dstr(block.vtx[0].vout[1].nValue),n); if ( height >= 235300 ) From fa6b77c682799c68e08239b44be17bd033c50287 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Mar 2017 16:44:04 +0200 Subject: [PATCH 6/6] Test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index e46ad39ee..cf7d01201 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -661,7 +661,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above { total = 0; for (i=1; i COIN/10 ) { //fprintf(stderr,">>>>>>>> <<<<<<<<<< ht.%d illegal nonz output %.8f n.%d\n",height,dstr(block.vtx[0].vout[1].nValue),n);