This commit is contained in:
jl777
2016-10-26 19:55:03 -03:00
parent 2d6fb81efd
commit 420d7311e8
4 changed files with 12 additions and 11 deletions

View File

@@ -328,7 +328,7 @@ int32_t komodo_isratify(int32_t isspecial,int32_t numvalid)
// with more than 13 pay2pubkey outputs -> ratify // with more than 13 pay2pubkey outputs -> ratify
// if all outputs to notary -> notary utxo // if all outputs to notary -> notary utxo
// if txi == 0 && 2 outputs and 2nd OP_RETURN, len == 32*2+4 -> notarized, 1st byte 'P' -> pricefeed // if txi == 0 && 2 outputs and 2nd OP_RETURN, len == 32*2+4 -> notarized, 1st byte 'P' -> pricefeed
// OP_RETURN: 'D' -> deposit // OP_RETURN: 'D' -> deposit, 'W' -> withdraw
void komodo_connectblock(CBlockIndex *pindex,CBlock& block) void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
{ {

View File

@@ -13,20 +13,21 @@
* * * *
******************************************************************************/ ******************************************************************************/
// convert paxdeposit into new coins in the next block // create list of approved deposits, validate all deposits against this list, prevent double deposit
// need to tag deposits with OP_RETURN, ie link with originating txid/vout
// paxdeposit equivalent in reverse makes opreturn and KMD does the same in reverse // paxdeposit equivalent in reverse makes opreturn and KMD does the same in reverse
const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int32_t opretlen) const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int32_t opretlen)
{ {
uint8_t rmd160[20],addrtype,shortflag,pubkey33[33]; int32_t i,tokomodo=0; char base[4],coinaddr[64],destaddr[64]; int64_t fiatoshis,checktoshis; const char *typestr = "unknown"; uint8_t rmd160[20],addrtype,shortflag,pubkey33[33]; int32_t i,tokomodo=0; char base[4],coinaddr[64],destaddr[64]; int64_t fiatoshis,checktoshis; const char *typestr = "unknown";
//printf("komodo_opreturn[%c]: ht.%d %.8f opretlen.%d\n",opretbuf[0],height,dstr(value),opretlen); //printf("komodo_opreturn[%c]: ht.%d %.8f opretlen.%d\n",opretbuf[0],height,dstr(value),opretlen);
if ( opretbuf[0] == 'D' ) #ifdef KOMODO_ISSUER
tokomodo = 1;
#endif
if ( opretbuf[0] == ((tokomodo != 0) ? 'D' : 'W') )
{ {
if ( opretlen == 34 ) if ( opretlen == 34 )
{ {
#ifdef KOMODO_ISSUER
tokomodo = 1;
#endif
memset(base,0,sizeof(base)); memset(base,0,sizeof(base));
PAX_pubkey(0,&opretbuf[1],&addrtype,rmd160,base,&shortflag,&fiatoshis); PAX_pubkey(0,&opretbuf[1],&addrtype,rmd160,base,&shortflag,&fiatoshis);
if ( fiatoshis < 0 ) if ( fiatoshis < 0 )
@@ -42,9 +43,9 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
printf(" checkpubkey check %.8f v %.8f dest.(%s)\n",dstr(checktoshis),dstr(value),destaddr); printf(" checkpubkey check %.8f v %.8f dest.(%s)\n",dstr(checktoshis),dstr(value),destaddr);
typestr = "deposit"; typestr = "deposit";
#ifdef KOMODO_ISSUER #ifdef KOMODO_ISSUER
if ( strncmp(KOMODO_SOURCE,base,strlen(base)) == 0 && value >= checktoshis*.9999 ) if ( strncmp(KOMODO_SOURCE,base,strlen(base)) == 0 && ((tokomodo == 0 && value >= checktoshis*.9999) || (tokomodo != 0 && value <= checktoshis/.9999)) )
{ {
printf("START %s MINER!\n",KOMODO_SOURCE); printf("START %s MINER! %.8f\n",KOMODO_SOURCE,dstr(fiatoshis));
KOMODO_DEPOSIT = fiatoshis; KOMODO_DEPOSIT = fiatoshis;
KOMODO_SCRIPTPUBKEY[0] = 0x76; KOMODO_SCRIPTPUBKEY[0] = 0x76;
KOMODO_SCRIPTPUBKEY[1] = 0xa9; KOMODO_SCRIPTPUBKEY[1] = 0xa9;

View File

@@ -1415,8 +1415,8 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
CAmount nSubsidy = 3 * COIN; CAmount nSubsidy = 3 * COIN;
if ( nHeight == 1 ) if ( nHeight == 1 )
return(100000000 * COIN); // ICO allocation return(100000000 * COIN); // ICO allocation
else if ( komodo_moneysupply(nHeight) < MAX_MONEY ) //else if ( komodo_moneysupply(nHeight) < MAX_MONEY )
return(3 * COIN); // return(3 * COIN);
else return(0); else return(0);
/* /*
// Mining slow start // Mining slow start

View File

@@ -500,7 +500,7 @@ Value paxdeposit(const Array& params, bool fHelp)
if ( fee < 10000 ) if ( fee < 10000 )
fee = 10000; fee = 10000;
opretlen = komodo_opreturnscript(opretbuf,'D',pubkey33,33); opretlen = komodo_opreturnscript(opretbuf,'D',pubkey33,33);
SendMoney(destaddress.Get(),fee,fSubtractFeeFromAmount,wtx,opretbuf,opretlen,komodoshis); SendMoney(address.Get(),fee,fSubtractFeeFromAmount,wtx,opretbuf,opretlen,komodoshis);
return wtx.GetHash().GetHex(); return wtx.GetHash().GetHex();
} }