Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta #302

Merged
merged 141 commits into from
Mar 17, 2017
Merged

Beta #302

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
d03fbd9
disable 100000
jl777 Dec 5, 2016
b039abf
Revert "disable 100000"
jl777 Jan 3, 2017
76d0581
Merge pull request #107 from jl777/dPoW
jl777 Jan 3, 2017
4344332
Merge pull request #112 from jl777/dPoW
jl777 Jan 13, 2017
e484d09
Merge pull request #116 from jl777/dPoW
jl777 Jan 16, 2017
b471f5a
Merge pull request #128 from jl777/dPoW
jl777 Jan 23, 2017
cd8ff23
Merge pull request #133 from jl777/dPoW
jl777 Jan 25, 2017
c8d05ff
Merge pull request #137 from jl777/dPoW
jl777 Jan 30, 2017
1fc74db
Merge pull request #141 from jl777/dPoW
jl777 Jan 30, 2017
4fd39c6
Merge pull request #145 from jl777/dPoW
jl777 Feb 2, 2017
06913e0
Merge pull request #148 from jl777/dPoW
jl777 Feb 2, 2017
5339d22
Merge pull request #151 from jl777/dPoW
jl777 Feb 2, 2017
46317e8
Merge pull request #155 from jl777/dPoW
jl777 Feb 2, 2017
e712f09
Merge pull request #159 from jl777/dPoW
jl777 Feb 3, 2017
14d8a52
Merge pull request #164 from jl777/dPoW
jl777 Feb 3, 2017
9fd1d73
Merge pull request #167 from jl777/dPoW
jl777 Feb 4, 2017
d289bc1
Merge pull request #172 from jl777/dPoW
jl777 Feb 6, 2017
43a0502
Merge pull request #176 from jl777/dPoW
jl777 Feb 7, 2017
356125d
Merge pull request #180 from jl777/dPoW
jl777 Feb 7, 2017
20ce141
Merge pull request #190 from jl777/dPoW
jl777 Feb 19, 2017
451cc49
Merge pull request #193 from jl777/dPoW
jl777 Feb 19, 2017
d74b39f
Merge pull request #197 from jl777/dPoW
jl777 Feb 19, 2017
0f98f3f
Merge pull request #201 from jl777/dPoW
jl777 Feb 21, 2017
44109c1
Merge pull request #204 from jl777/dPoW
jl777 Feb 21, 2017
e9e04d7
Merge pull request #207 from jl777/dPoW
jl777 Feb 21, 2017
703fee7
Merge pull request #220 from jl777/dPoW
jl777 Feb 27, 2017
79d11ab
Merge pull request #227 from jl777/dPoW
jl777 Mar 12, 2017
e8bf7d5
Merge pull request #230 from jl777/dPoW
jl777 Mar 12, 2017
2263ffd
Merge pull request #233 from jl777/dPoW
jl777 Mar 12, 2017
8498556
Merge pull request #236 from jl777/dPoW
jl777 Mar 12, 2017
037dd6d
Merge pull request #242 from jl777/dPoW
jl777 Mar 13, 2017
c4ca615
Merge pull request #245 from jl777/dPoW
jl777 Mar 13, 2017
1664106
Merge pull request #249 from jl777/dPoW
jl777 Mar 13, 2017
3a94bcc
Merge pull request #254 from jl777/dPoW
jl777 Mar 13, 2017
5d72480
Typo
Mar 13, 2017
6aa97d1
Merge pull request #259 from jl777/dPoW
jl777 Mar 14, 2017
3b333f2
Merge pull request #262 from jl777/dPoW
jl777 Mar 14, 2017
68f495d
Merge pull request #265 from jl777/dPoW
jl777 Mar 14, 2017
d1775ce
Syntax
Mar 14, 2017
dbc9ad1
Resolve
Mar 14, 2017
018174c
Merge pull request #272 from jl777/dPoW
jl777 Mar 15, 2017
f365813
Merge pull request #275 from jl777/dPoW
jl777 Mar 16, 2017
d6ab51d
Merge pull request #280 from jl777/dPoW
jl777 Mar 16, 2017
3899eed
Test
Mar 16, 2017
87ce550
Test
Mar 16, 2017
c73a117
Test
Mar 16, 2017
7f2e458
Test
Mar 16, 2017
ea457f2
Merge pull request #283 from jl777/dev
jl777 Mar 16, 2017
dd28509
Revert "Test"
Mar 16, 2017
2fa533e
Test
Mar 16, 2017
9b82df6
Test
Mar 16, 2017
9896fea
Merge pull request #284 from jl777/dev
jl777 Mar 16, 2017
8f68a6a
Test
Mar 16, 2017
cfa255d
Test
Mar 16, 2017
b61ed43
Test
Mar 16, 2017
9b445a1
Test
Mar 16, 2017
4c9da8c
Test
Mar 16, 2017
05d8048
Test
Mar 16, 2017
134c49d
Test
Mar 16, 2017
9f22a39
Test
Mar 16, 2017
f06a202
Test
Mar 16, 2017
6ada6d9
Test
Mar 16, 2017
7658f5b
Test
Mar 16, 2017
d922915
Test
Mar 16, 2017
5618b77
Test
Mar 16, 2017
9ae3d21
Test
Mar 16, 2017
d4ab9b5
Test
Mar 16, 2017
4502c41
Test
Mar 16, 2017
4445eea
Test
Mar 16, 2017
cfee5e7
Merge pull request #285 from jl777/dev
jl777 Mar 16, 2017
8dfdb3d
Test
Mar 16, 2017
157080b
Merge pull request #286 from jl777/dev
jl777 Mar 16, 2017
e7b74d6
Test
Mar 17, 2017
8b64937
Test
Mar 17, 2017
f3b1dad
Test
Mar 17, 2017
4dfd322
Merge pull request #287 from jl777/dev
jl777 Mar 17, 2017
d92731b
Test
Mar 17, 2017
caa197e
Tighten paxdeposit limits
Mar 17, 2017
bf1f6b3
Syntax fix
Mar 17, 2017
82ecec2
Syntax
Mar 17, 2017
c6bd7b1
test
Mar 17, 2017
634aefe
Test
Mar 17, 2017
37d2dcf
Test
Mar 17, 2017
76b9b8b
Test
Mar 17, 2017
2cb18e4
Test
Mar 17, 2017
e827f4d
Test
Mar 17, 2017
9493368
Test
Mar 17, 2017
3c89218
Test
Mar 17, 2017
56b38b8
Test
Mar 17, 2017
5e8e89d
Test
Mar 17, 2017
ea6bdd9
Test
Mar 17, 2017
572f12e
Test
Mar 17, 2017
a13467f
Test
Mar 17, 2017
a17692d
Test
Mar 17, 2017
2c70b58
Test
Mar 17, 2017
dd67ab0
Test
Mar 17, 2017
f3159f7
Test
Mar 17, 2017
47609f6
Test
Mar 17, 2017
8c782a5
Test
Mar 17, 2017
6fd0ae1
Test
Mar 17, 2017
196ed32
Merge pull request #290 from jl777/dev
jl777 Mar 17, 2017
05ca2ff
disable redeems
Mar 17, 2017
317558d
Merge pull request #291 from jl777/dev
jl777 Mar 17, 2017
ad4559b
Test
Mar 17, 2017
0ce8ef2
Merge pull request #292 from jl777/dev
jl777 Mar 17, 2017
72460f0
Test
Mar 17, 2017
628e0bf
Merge pull request #293 from jl777/dev
jl777 Mar 17, 2017
7f44a3a
Test
Mar 17, 2017
93722bf
Test
Mar 17, 2017
6a23558
Test
Mar 17, 2017
d82233d
Test
Mar 17, 2017
8aed578
Test
Mar 17, 2017
d19a983
Test
Mar 17, 2017
c0addba
Merge branch 'master' into dev
Mar 17, 2017
c2070e5
Revert "Merge branch 'master' into dev"
Mar 17, 2017
16cd9f2
Revert to main
Mar 17, 2017
16c7bf6
Merge back most changes
Mar 17, 2017
74d67d4
Prevent 'A' and 'X' events
Mar 17, 2017
b24e2ba
Touch
Mar 17, 2017
fbe307f
Test
Mar 17, 2017
83c54f3
Test
Mar 17, 2017
d6cc943
Test
Mar 17, 2017
5e9f447
Test
Mar 17, 2017
1ecb854
Test
Mar 17, 2017
8577cb2
Test
Mar 17, 2017
7bf32ee
Test
Mar 17, 2017
82fd193
Test
Mar 17, 2017
ea73ef0
Test
Mar 17, 2017
f79f75b
Test
Mar 17, 2017
25a3e25
Merge pull request #296 from jl777/dev
jl777 Mar 17, 2017
68025c1
Remove print
Mar 17, 2017
98b0f4c
Merge pull request #297 from jl777/dev
jl777 Mar 17, 2017
8f3aa74
Touch
Mar 17, 2017
72475d0
Test
Mar 17, 2017
8c0fcef
Merge pull request #298 from jl777/dev
jl777 Mar 17, 2017
6ef472f
Merge branch 'beta' into dev
jl777 Mar 17, 2017
e33f01a
Merge pull request #299 from jl777/dev
jl777 Mar 17, 2017
d1ceb5c
Test
Mar 17, 2017
f72ce93
Merge pull request #300 from jl777/dev
jl777 Mar 17, 2017
4dabad2
Test
Mar 17, 2017
f9f1ce1
Merge pull request #301 from jl777/dev
jl777 Mar 17, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/assetchains
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash
set -x
source pubkey.txt
echo $pubkey
Expand Down
3 changes: 2 additions & 1 deletion src/komodo.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
printf("ISRATIFICATION (%s)\n",(char *)&scriptbuf[len+32*2+4]);
}
}
if ( *isratificationp == 0 )

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
54 changes: 40 additions & 14 deletions src/komodo_gateway.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued,uint64_t *withdrawn,uint64_t *approved,uint64_t *redeemed,char *base)
{
int32_t baseid; struct komodo_state *sp; int64_t netliability,maxallowed;
int32_t baseid; struct komodo_state *sp; int64_t netliability,maxallowed,maxval;
*available = *deposited = *issued = *withdrawn = *approved = *redeemed = 0;
if ( (baseid= komodo_baseid(base)) >= 0 )
{
Expand All @@ -28,11 +28,14 @@ int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued,
*withdrawn = sp->withdrawn;
*approved = sp->approved;
*redeemed = sp->redeemed;
netliability = (sp->deposited - sp->withdrawn) - sp->shorted;
maxval = sp->approved;
if ( sp->withdrawn > maxval )
maxval = sp->withdrawn;
netliability = (sp->issued - maxval) - sp->shorted;
maxallowed = komodo_maxallowed(baseid);
if ( netliability < maxallowed )
*available = (maxallowed - netliability);
//printf("%p %s %.8f %.8f %.8f %.8f %.8f\n",sp,base,dstr(*deposited),dstr(*issued),dstr(*withdrawn),dstr(*approved),dstr(*redeemed));
//printf("%llu - %llu %s %.8f %.8f %.8f %.8f %.8f\n",(long long)maxallowed,(long long)netliability,base,dstr(*deposited),dstr(*issued),dstr(*withdrawn),dstr(*approved),dstr(*redeemed));
return(0);
} else printf("pax_fiatstatus cant get basesp.%s\n",base);
} // else printf("pax_fiatstatus illegal base.%s\n",base);
Expand Down Expand Up @@ -265,7 +268,7 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che
if ( seed == 0 && checkvalue != 0 )
{
ratio = ((value << 6) / checkvalue);
if ( ratio >= 63 && ratio <= 65 )
if ( ratio >= 62 && ratio <= 66 )
return(0);
else
{
Expand Down Expand Up @@ -486,7 +489,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
else
{
opcode = 'X';
if ( komodo_paxtotal() == 0 )
if ( 1 || komodo_paxtotal() == 0 )
return(0);
}
HASH_ITER(hh,PAX,pax,tmp)
Expand Down Expand Up @@ -528,6 +531,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
{
if ( strcmp(pax->symbol,ASSETCHAINS_SYMBOL) == 0 )
printf("pax->symbol.%s != %s or null pax->validated %.8f ready.%d ht.(%d %d)\n",pax->symbol,symbol,dstr(pax->validated),pax->ready,kmdsp->CURRENT_HEIGHT,pax->height);
pax->marked = pax->fiatoshis;
continue;
}
if ( pax->ready == 0 )
Expand Down Expand Up @@ -571,7 +575,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
PENDING_KOMODO_TX += pax->komodoshis;
printf(" len.%d vout.%u DEPOSIT %.8f <- pax.%s pending ht %d %d %.8f | ",len,pax->vout,(double)txNew->vout[numvouts].nValue/COIN,symbol,pax->height,pax->otherheight,dstr(PENDING_KOMODO_TX));
}
if ( numvouts++ >= 64 )
if ( numvouts++ >= 1 )
break;
}
if ( numvouts > 1 )
Expand Down Expand Up @@ -659,17 +663,32 @@ 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 )
{
int64_t val,prevtotal = 0; int32_t overflow = 0;
total = 0;
for (i=1; i<n; i++)
total += block.vtx[0].vout[i].nValue;
if ( total > COIN/10 )
{
if ( (val= block.vtx[0].vout[i].nValue) < 0 || val >= MAX_MONEY )
{
overflow = 1;
break;
}
total += val;
if ( total < prevtotal || (val != 0 && total == prevtotal) )
{
overflow = 1;
break;
}
prevtotal = total;
}
if ( overflow != 0 || total > 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 )
return(-1);
}
return(0);
}

//fprintf(stderr,"ht.%d n.%d nValue %.8f (%d %d %d)\n",height,n,dstr(block.vtx[0].vout[1].nValue),KOMODO_PAX,komodo_isrealtime(&ht),KOMODO_PASSPORT_INITDONE);
if ( komodo_isrealtime(&ht) == 0 || KOMODO_PASSPORT_INITDONE == 0 ) //KOMODO_PAX == 0 ||
return(0);
Expand All @@ -680,6 +699,8 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
// printf("%02x",script[i]);
//printf(" height.%d checkdeposit n.%d [%02x] [%c] %d vs %d\n",height,n,script[0],script[offset],script[offset],'X');
opcode = 'X';
if ( height >= 235300 )
return(-1);
strcpy(symbol,(char *)"KMD");
}
else
Expand Down Expand Up @@ -859,7 +880,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 )
printf("########### %p depositedB %s += %.8f/%.8f kmdheight.%d/%d %.8f/%.8f\n",basesp,base,dstr(fiatoshis),dstr(pax->fiatoshis),kmdheight,pax->height,dstr(value),dstr(pax->komodoshis));
}
}
} //
if ( didstats != 0 )
pax->didstats = 1;
if ( (pax2= komodo_paxfind(txid,vout,'I')) != 0 )
Expand All @@ -881,8 +902,13 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
}
}
}
else if ( kmdheight > 238000 && (kmdheight > 214700 || strcmp(base,ASSETCHAINS_SYMBOL) == 0) ) //seed != 0 &&
printf("pax %s deposit %.8f rejected kmdheight.%d %.8f KMD check %.8f seed.%llu\n",base,dstr(fiatoshis),kmdheight,dstr(value),dstr(checktoshis),(long long)seed);
else
{
if ( (pax= komodo_paxfind(txid,vout,'D')) != 0 )
pax->marked = checktoshis;
if ( kmdheight > 238000 && (kmdheight > 214700 || strcmp(base,ASSETCHAINS_SYMBOL) == 0) ) //seed != 0 &&
printf("pax %s deposit %.8f rejected kmdheight.%d %.8f KMD check %.8f seed.%llu\n",base,dstr(fiatoshis),kmdheight,dstr(value),dstr(checktoshis),(long long)seed);
}
} //else printf("paxdeposit height.%d vs kmdheight.%d\n",height,kmdheight);
}
}
Expand Down Expand Up @@ -935,7 +961,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
} //else printf("opreturn none issued?\n");
}
}
else if ( opretbuf[0] == 'W' )//&& opretlen >= 38 )
else if ( height < 236000 && opretbuf[0] == 'W' )//&& opretlen >= 38 )
{
if ( komodo_baseid((char *)&opretbuf[opretlen-4]) >= 0 && strcmp(ASSETCHAINS_SYMBOL,(char *)&opretbuf[opretlen-4]) == 0 )
{
Expand Down Expand Up @@ -980,7 +1006,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
} // else printf("withdraw %s paxcmp ht.%d %d error value %.8f -> %.8f vs %.8f\n",base,kmdheight,height,dstr(value),dstr(komodoshis),dstr(checktoshis));
// need to allocate pax
}
else if ( tokomodo != 0 && opretbuf[0] == 'A' )
else if ( height < 236000 && tokomodo != 0 && opretbuf[0] == 'A' )
{
tokomodo = 1;
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
Expand Down Expand Up @@ -1059,7 +1085,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
} //else printf("n.%d from opreturns\n",n);
//printf("extra.[%d] after %.8f\n",n,dstr(komodo_paxtotal()));
}
else if ( opretbuf[0] == 'X' )
else if ( height < 236000 && opretbuf[0] == 'X' )
{
tokomodo = 1;
if ( (n= komodo_issued_opreturn(base,txids,vouts,values,srcvalues,kmdheights,otherheights,baseids,rmd160s,opretbuf,opretlen,1)) > 0 )
Expand Down
10 changes: 8 additions & 2 deletions src/komodo_interest.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin
{
if ( (minutes= (tiptime - nLockTime) / 60) >= 60 )
{
if ( minutes > 365 * 24 * 60 )
minutes = 365 * 24 * 60;
denominator = (((uint64_t)365 * 24 * 60) / minutes);
if ( denominator == 0 )
denominator = 1; // max KOMODO_INTEREST per transfer, do it at least annually!
Expand Down Expand Up @@ -102,7 +104,9 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin
if ( exception == 0 )
{
numerator = (nValue / 20); // assumes 5%!
interest = (numerator / denominator);
if ( txheight < 300000 )
interest = (numerator / denominator);
else interest = (numerator * minutes) / ((uint64_t)365 * 24 * 60);
}
else
{
Expand All @@ -113,7 +117,9 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin
else
{
numerator = (nValue * KOMODO_INTEREST);
interest = (numerator / denominator) / COIN;
if ( txheight < 300000 || numerator * minutes < 365 * 24 * 60 )
interest = (numerator / denominator) / COIN;
else interest = ((numerator * minutes) / ((uint64_t)365 * 24 * 60)) / COIN;
}
//fprintf(stderr,"komodo_interest %lld %.8f nLockTime.%u tiptime.%u minutes.%d interest %lld %.8f (%llu / %llu)\n",(long long)nValue,(double)nValue/COIN,nLockTime,tiptime,minutes,(long long)interest,(double)interest/COIN,(long long)numerator,(long long)denominator);
}
Expand Down
1 change: 0 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3258,7 +3258,6 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
else if ( komodo_checkpoint(&notarized_height,nHeight,hash) < 0 )
return state.DoS(100, error("%s: forked chain %d older than last notarized (height %d) vs %d", __func__,nHeight, notarized_height));
}

// Reject block.nVersion < 4 blocks
if (block.nVersion < 4)
return state.Invalid(error("%s : rejected nVersion<4 block", __func__),
Expand Down
24 changes: 18 additions & 6 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams,
#define ASSETCHAINS_MINHEIGHT 100
#define KOMODO_ELECTION_GAP 2000
#define ROUNDROBIN_DELAY 59
extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE;
extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE;
extern char ASSETCHAINS_SYMBOL[16];
extern std::string NOTARY_PUBKEY;
extern uint8_t NOTARY_PUBKEY33[33];
Expand Down Expand Up @@ -133,7 +133,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
while ( KOMODO_ON_DEMAND == 0 && deposits == 0 && (int32_t)mempool.GetTotalTxSize() == 0 )
{
deposits = komodo_paxtotal();
if ( KOMODO_INITDONE == 0 || (komodo_baseid(ASSETCHAINS_SYMBOL) >= 0 && (isrealtime= komodo_isrealtime(&kmdheight)) == 0) )
if ( KOMODO_PASSPORT_INITDONE == 0 || KOMODO_INITDONE == 0 || (komodo_baseid(ASSETCHAINS_SYMBOL) >= 0 && (isrealtime= komodo_isrealtime(&kmdheight)) == 0) )
{
//fprintf(stderr,"INITDONE.%d RT.%d deposits %.8f ht.%d\n",KOMODO_INITDONE,isrealtime,(double)deposits/COIN,kmdheight);
}
Expand Down Expand Up @@ -403,9 +403,10 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
else if ( komodo_is_issuer() != 0 )
{
komodo_gateway_deposits(&txNew,ASSETCHAINS_SYMBOL,0);
//if ( txNew.vout.size() > 1 )
if ( txNew.vout.size() > 1 )
fprintf(stderr,"%s txNew numvouts.%d\n",ASSETCHAINS_SYMBOL,(int32_t)txNew.vout.size());
}

pblock->vtx[0] = txNew;
pblocktemplate->vTxFees[0] = -nFees;
// Randomise nonce
Expand Down Expand Up @@ -612,7 +613,7 @@ void static BitcoinMiner(CWallet *pwallet)
Mining_height = pindexPrev->nHeight+1;
Mining_start = (uint32_t)time(NULL);
}
if ( ASSETCHAINS_SYMBOL[0] != 0 )
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height);
CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey);
if ( ptr == 0 )
Expand All @@ -629,6 +630,17 @@ void static BitcoinMiner(CWallet *pwallet)
return;
}
CBlock *pblock = &pblocktemplate->block;
if ( ASSETCHAINS_SYMBOL[0] != 0 )
{
if ( pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT )
{
static uint32_t counter;
if ( counter++ < 10 )
fprintf(stderr,"skip generating %s on-demand block, no tx avail\n",ASSETCHAINS_SYMBOL);
sleep(10);
continue;
} else fprintf(stderr,"vouts.%d mining.%d vs %d\n",(int32_t)pblock->vtx[0].vout.size(),Mining_height,ASSETCHAINS_MINHEIGHT);
}
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
LogPrintf("Running KomodoMiner.%s with %u transactions in block (%u bytes)\n",solver.c_str(),pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION));
//
Expand Down Expand Up @@ -685,12 +697,12 @@ void static BitcoinMiner(CWallet *pwallet)
} else Mining_start = 0;
while (true)
{
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 && pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT ) // skips when it shouldnt
/*if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 && pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT ) // skips when it shouldnt
{
fprintf(stderr,"skip generating %s on-demand block, no tx avail\n",ASSETCHAINS_SYMBOL);
sleep(10);
break;
}
}*/
// Hash state
KOMODO_CHOSEN_ONE = 0;
crypto_generichash_blake2b_state state;
Expand Down
4 changes: 4 additions & 0 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,10 @@ Value paxdeposit(const Array& params, bool fHelp)
std::string dest;
height = chainActive.Tip()->nHeight;
if ( pax_fiatstatus(&available,&deposited,&issued,&withdrawn,&approved,&redeemed,(char *)base.c_str()) != 0 || available < fiatoshis )
{
fprintf(stderr,"available %llu vs fiatoshis %llu\n",(long long)available,(long long)fiatoshis);
throw runtime_error("paxdeposit not enough available inventory");
}
komodoshis = PAX_fiatdest(&seed,0,destaddr,pubkey37,(char *)params[0].get_str().c_str(),height,(char *)base.c_str(),fiatoshis);
dest.append(destaddr);
CBitcoinAddress destaddress(CRYPTO777_KMDADDR);
Expand All @@ -659,6 +662,7 @@ Value paxwithdraw(const Array& params, bool fHelp)
return(0);
if (!EnsureWalletIsAvailable(fHelp))
return 0;
throw runtime_error("paxwithdraw deprecated");
if (fHelp || params.size() != 2)
throw runtime_error("paxwithdraw address fiatamount");
if ( komodo_isrealtime(&kmdheight) == 0 )
Expand Down