Browse Source

Make function for small opreturn coins

blackjok3r
jl777 6 years ago
parent
commit
b8187617dc
  1. 3
      basilisk/basilisk_bitcoin.c
  2. 1
      iguana/dPoW.h
  3. 2
      iguana/dpow/dpow_fsm.c
  4. 24
      iguana/dpow/dpow_rpc.c
  5. 2
      iguana/dpow/dpow_tx.c

3
basilisk/basilisk_bitcoin.c

@ -591,9 +591,6 @@ char *iguana_utxoduplicates(struct supernet_info *myinfo,struct iguana_info *coi
bitcoin_address(changeaddr, coin->chain->pubtype, myinfo->persistent_pubkey33, 33); bitcoin_address(changeaddr, coin->chain->pubtype, myinfo->persistent_pubkey33, 33);
txfee = (coin->txfee + duplicates*coin->txfee/10); txfee = (coin->txfee + duplicates*coin->txfee/10);
if (strcmp(coin->symbol, "GAME") == 0 || strcmp(coin->symbol, "EMC2") == 0)
printf("%s txfee %.8f\n", coin->symbol, dstr(txfee));
uint32_t txversion = 1; // txversion = 1 for non-overwintered and non-sapling coins uint32_t txversion = 1; // txversion = 1 for non-overwintered and non-sapling coins
if (coin->sapling != 0) if (coin->sapling != 0)
txversion = 4; txversion = 4;

1
iguana/dPoW.h

@ -172,6 +172,7 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo);
int32_t dpow_haveutxo(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,char *coinaddr,char *srccoin); int32_t dpow_haveutxo(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,char *coinaddr,char *srccoin);
void komodo_assetcoins(int32_t fullnode,uint64_t mask); void komodo_assetcoins(int32_t fullnode,uint64_t mask);
int32_t iguana_isnotarychain(char *symbol); int32_t iguana_isnotarychain(char *symbol);
int32_t dpow_smallopreturn(char *symbol);
cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin); cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin);
cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid); cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid);

2
iguana/dpow/dpow_fsm.c

@ -235,7 +235,7 @@ bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct igu
bits256 MoM; cJSON *MoMjson,*infojson; int32_t prevMoMheight; bits256 MoM; cJSON *MoMjson,*infojson; int32_t prevMoMheight;
*MoMdepthp = 0; *MoMdepthp = 0;
memset(MoM.bytes,0,sizeof(MoM)); memset(MoM.bytes,0,sizeof(MoM));
if ( strcmp(coin->symbol,"GAME") == 0 || strcmp(coin->symbol,"HUSH") == 0 || strcmp(coin->symbol,"EMC2") == 0 ) // 80 byte OP_RETURN limit if ( dpow_smallopreturn(coin->symbol) != 0 ) // 80 byte OP_RETURN limit
return(MoM); return(MoM);
if ( (infojson= dpow_getinfo(myinfo,coin)) != 0 ) if ( (infojson= dpow_getinfo(myinfo,coin)) != 0 )
{ {

24
iguana/dpow/dpow_rpc.c

@ -22,6 +22,20 @@ uint64_t dpow_utxosize(char *symbol)
else return(10000); else return(10000);
} }
int32_t dpow_smallopreturn(char *symbol)
{
if ( strcmp(symbol,"GAME") == 0 || strcmp(symbol,"EMC2") == 0 || strcmp(symbol,"HUSH") == 0 )
return(1);
else return(0);
}
int32_t dpow_is015(char *symbol)
{
if ( strcmp("CHIPS",symbol) == 0 || strcmp("GAME",symbol) == 0 || strcmp("EMC2",symbol) == 0 ) //strcmp("BTC",symbol) == 0 ||
return(1);
else return(0);
}
char *bitcoind_getinfo(char *symbol,char *serverport,char *userpass,char *getinfostr) char *bitcoind_getinfo(char *symbol,char *serverport,char *userpass,char *getinfostr)
{ {
char buf[1],*retstr; cJSON *retjson; char buf[1],*retstr; cJSON *retjson;
@ -279,11 +293,12 @@ cJSON *dpow_MoMoMdata(struct iguana_info *coin,char *symbol,int32_t kmdheight,ui
return(retjson); return(retjson);
} }
int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,uint16_t CCid,int32_t src_or_dest,struct dpow_block *bp) int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,uint16_t CCid,int32_t src_or_dest,struct dpow_block *bp)
{ {
struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson,*infojson; int32_t kmdheight=0,hexlen=0,n=0; uint32_t paxwdcrc; struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson,*infojson; int32_t kmdheight=0,hexlen=0,n=0; uint32_t paxwdcrc;
paxwdcrc = 0; paxwdcrc = 0;
if ( strcmp(bp->srccoin->symbol,"GAME") != 0 || strcmp(bp->srccoin->symbol,"EMC2") != 0 || src_or_dest != 0 ) if ( dpow_smallopreturn(bp->srccoin->symbol) == 0 || src_or_dest != 0 )
{ {
n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes); n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes);
MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16);
@ -430,13 +445,6 @@ cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits2
return(json); return(json);
} }
int32_t dpow_is015(char *symbol)
{
if ( strcmp("CHIPS",symbol) == 0 || strcmp("GAME",symbol) == 0 || strcmp("EMC2",symbol) == 0 ) //strcmp("BTC",symbol) == 0 ||
return(1);
else return(0);
}
char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address) char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address)
{ {
char buf[128],*retstr=0; cJSON *retjson; char buf[128],*retstr=0; cJSON *retjson;

2
iguana/dpow/dpow_tx.c

@ -624,8 +624,6 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo
{ {
dpow_notarytx(myinfo,bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,pubkeys,numratified); // setcrcval dpow_notarytx(myinfo,bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,pubkeys,numratified); // setcrcval
signedtxid = dpow_notarytx(myinfo,bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,1,src_or_dest,pubkeys,numratified); signedtxid = dpow_notarytx(myinfo,bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,1,src_or_dest,pubkeys,numratified);
if ( strcmp("GAME",coin->symbol) == 0 || strcmp("EMC2",coin->symbol) == 0 )
printf("src_or_dest.%d bestk.%d %llx %s numsigs.%d signedtx.(%s)\n",src_or_dest,bestk,(long long)bestmask,bits256_str(str,signedtxid),numsigs,bp->signedtx);
bp->state = 1; bp->state = 1;
if ( bits256_nonz(signedtxid) != 0 && numsigs == bp->minsigs ) if ( bits256_nonz(signedtxid) != 0 && numsigs == bp->minsigs )
{ {

Loading…
Cancel
Save