test
This commit is contained in:
@@ -35,6 +35,7 @@ static bool fDaemon;
|
|||||||
extern char ASSETCHAINS_SYMBOL[16];
|
extern char ASSETCHAINS_SYMBOL[16];
|
||||||
void komodo_gateway_iteration(char *symbol);
|
void komodo_gateway_iteration(char *symbol);
|
||||||
void komodo_iteration(char *symbol);
|
void komodo_iteration(char *symbol);
|
||||||
|
int32_t komodo_is_issuer();
|
||||||
|
|
||||||
void WaitForShutdown(boost::thread_group* threadGroup)
|
void WaitForShutdown(boost::thread_group* threadGroup)
|
||||||
{
|
{
|
||||||
@@ -43,7 +44,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
|
|||||||
while (!fShutdown)
|
while (!fShutdown)
|
||||||
{
|
{
|
||||||
MilliSleep(2000);
|
MilliSleep(2000);
|
||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
if ( komodo_is_issuer() != 0 )
|
||||||
komodo_gateway_iteration(ASSETCHAINS_SYMBOL);
|
komodo_gateway_iteration(ASSETCHAINS_SYMBOL);
|
||||||
else komodo_iteration((char *)"EUR");
|
else komodo_iteration((char *)"EUR");
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
|
|||||||
//
|
//
|
||||||
extern int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,ASSETCHAIN_INIT;
|
extern int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,ASSETCHAIN_INIT;
|
||||||
extern std::string NOTARY_PUBKEY;
|
extern std::string NOTARY_PUBKEY;
|
||||||
|
int32_t komodo_is_issuer();
|
||||||
|
|
||||||
bool AppInit(int argc, char* argv[])
|
bool AppInit(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
@@ -104,7 +106,7 @@ bool AppInit(int argc, char* argv[])
|
|||||||
fprintf(stderr,"call komodo_args NOTARY_PUBKEY.(%s)\n",NOTARY_PUBKEY.c_str());
|
fprintf(stderr,"call komodo_args NOTARY_PUBKEY.(%s)\n",NOTARY_PUBKEY.c_str());
|
||||||
while ( ASSETCHAIN_INIT == 0 )
|
while ( ASSETCHAIN_INIT == 0 )
|
||||||
{
|
{
|
||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
if ( komodo_is_issuer() != 0 )
|
||||||
komodo_gateway_iteration(ASSETCHAINS_SYMBOL);
|
komodo_gateway_iteration(ASSETCHAINS_SYMBOL);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ uint64_t komodo_paxtotal()
|
|||||||
{
|
{
|
||||||
if ( pax->marked == 0 )
|
if ( pax->marked == 0 )
|
||||||
{
|
{
|
||||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
if ( komodo_is_issuer() != 0 )
|
||||||
total += pax->fiatoshis;
|
total += pax->fiatoshis;
|
||||||
else total += pax->komodoshis;
|
else total += pax->komodoshis;
|
||||||
}
|
}
|
||||||
@@ -80,9 +80,9 @@ struct pax_transaction *komodo_paxmark(struct pax_transaction *space,uint256 txi
|
|||||||
if ( pax != 0 )
|
if ( pax != 0 )
|
||||||
{
|
{
|
||||||
pax->marked = mark;
|
pax->marked = mark;
|
||||||
int32_t i; for (i=0; i<32; i++)
|
//int32_t i; for (i=0; i<32; i++)
|
||||||
printf("%02x",((uint8_t *)&txid)[i]);
|
// printf("%02x",((uint8_t *)&txid)[i]);
|
||||||
printf(" paxmark.ht %d vout%d\n",mark,vout);
|
//printf(" paxmark.ht %d vout%d\n",mark,vout);
|
||||||
memcpy(space,pax,sizeof(*pax));
|
memcpy(space,pax,sizeof(*pax));
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&komodo_mutex);
|
pthread_mutex_unlock(&komodo_mutex);
|
||||||
@@ -238,9 +238,9 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
hash = block.GetHash();
|
hash = block.GetHash();
|
||||||
for (j=0; j<32; j++)
|
//for (j=0; j<32; j++)
|
||||||
printf("%02x",((uint8_t *)&hash)[j]);
|
// printf("%02x",((uint8_t *)&hash)[j]);
|
||||||
printf(" ht.%d blockhash couldnt find vout.[%d]\n",height,i);
|
//printf(" ht.%d blockhash couldnt find vout.[%d]\n",height,i);
|
||||||
komodo_paxmark(&space,txids[i-1],vouts[i-1],height);
|
komodo_paxmark(&space,txids[i-1],vouts[i-1],height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -266,7 +266,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
|||||||
bitcoin_address(coinaddr,addrtype,rmd160,20);
|
bitcoin_address(coinaddr,addrtype,rmd160,20);
|
||||||
checktoshis = PAX_fiatdest(&seed,tokomodo,destaddr,pubkey33,coinaddr,kmdheight,base,fiatoshis);
|
checktoshis = PAX_fiatdest(&seed,tokomodo,destaddr,pubkey33,coinaddr,kmdheight,base,fiatoshis);
|
||||||
typestr = "deposit";
|
typestr = "deposit";
|
||||||
printf("kmdheight.%d vs height.%d check %.8f vs %.8f\n",kmdheight,height,dstr(checktoshis),dstr(value));
|
printf("kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d\n",kmdheight,height,dstr(checktoshis),dstr(value),tokomodo,strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0);
|
||||||
if ( kmdheight <= height )
|
if ( kmdheight <= height )
|
||||||
{
|
{
|
||||||
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
|
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
|
|||||||
@@ -802,7 +802,7 @@ int32_t komodo_baseid(char *origbase)
|
|||||||
|
|
||||||
int32_t komodo_is_issuer()
|
int32_t komodo_is_issuer()
|
||||||
{
|
{
|
||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 && COINBASE_MATURITY < 10 )
|
if ( ASSETCHAINS_SYMBOL[0] != 0 && komodo_baseid(ASSETCHAINS_SYMBOL) >= 0 )
|
||||||
return(1);
|
return(1);
|
||||||
else return(0);
|
else return(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams,
|
|||||||
#define ASSETCHAINS_MINHEIGHT 100
|
#define ASSETCHAINS_MINHEIGHT 100
|
||||||
int32_t komodo_pax_opreturn(uint8_t *opret,int32_t maxsize);
|
int32_t komodo_pax_opreturn(uint8_t *opret,int32_t maxsize);
|
||||||
uint64_t komodo_paxtotal();
|
uint64_t komodo_paxtotal();
|
||||||
|
int32_t komodo_is_issuer();
|
||||||
void komodo_gateway_deposits(CMutableTransaction *txNew,int32_t shortflag,char *symbol);
|
void komodo_gateway_deposits(CMutableTransaction *txNew,int32_t shortflag,char *symbol);
|
||||||
extern int32_t KOMODO_INITDONE,ASSETCHAINS_SHORTFLAG;
|
extern int32_t KOMODO_INITDONE,ASSETCHAINS_SHORTFLAG;
|
||||||
extern char ASSETCHAINS_SYMBOL[16];
|
extern char ASSETCHAINS_SYMBOL[16];
|
||||||
@@ -376,7 +377,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
}
|
}
|
||||||
komodo_gateway_deposits(&txNew,0,(char *)"EUR");
|
komodo_gateway_deposits(&txNew,0,(char *)"EUR");
|
||||||
}
|
}
|
||||||
else
|
else if ( komodo_is_issuer() != 0 )
|
||||||
{
|
{
|
||||||
komodo_gateway_deposits(&txNew,0,(char *)"KMD");
|
komodo_gateway_deposits(&txNew,0,(char *)"KMD");
|
||||||
fprintf(stderr,"txNew numvouts.%d\n",(int32_t)txNew.vout.size());
|
fprintf(stderr,"txNew numvouts.%d\n",(int32_t)txNew.vout.size());
|
||||||
|
|||||||
@@ -476,7 +476,7 @@ Value paxdeposit(const Array& params, bool fHelp)
|
|||||||
{
|
{
|
||||||
uint64_t seed,komodoshis = 0; int32_t height; char destaddr[64]; uint8_t i,pubkey37[33];
|
uint64_t seed,komodoshis = 0; int32_t height; char destaddr[64]; uint8_t i,pubkey37[33];
|
||||||
bool fSubtractFeeFromAmount = false;
|
bool fSubtractFeeFromAmount = false;
|
||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
if ( komodo_is_issuer() != 0 )
|
||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "paxdeposit only from KMD");
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "paxdeposit only from KMD");
|
||||||
if (!EnsureWalletIsAvailable(fHelp))
|
if (!EnsureWalletIsAvailable(fHelp))
|
||||||
return Value::null;
|
return Value::null;
|
||||||
|
|||||||
Reference in New Issue
Block a user