From b8187617dc391c42564f5f54f9969a2d8241e6f1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 6 Dec 2018 10:37:37 -1100 Subject: [PATCH] Make function for small opreturn coins --- basilisk/basilisk_bitcoin.c | 3 --- iguana/dPoW.h | 1 + iguana/dpow/dpow_fsm.c | 2 +- iguana/dpow/dpow_rpc.c | 24 ++++++++++++++++-------- iguana/dpow/dpow_tx.c | 2 -- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index 3ddb69d24..cda0bf52c 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/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); 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 if (coin->sapling != 0) txversion = 4; diff --git a/iguana/dPoW.h b/iguana/dPoW.h index e121d24e6..81812c3a9 100755 --- a/iguana/dPoW.h +++ b/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); void komodo_assetcoins(int32_t fullnode,uint64_t mask); 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_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid); diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 3e71cb498..97640b59a 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/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; *MoMdepthp = 0; 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); if ( (infojson= dpow_getinfo(myinfo,coin)) != 0 ) { diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 0b70837f8..d9b0868aa 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -22,6 +22,20 @@ uint64_t dpow_utxosize(char *symbol) 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 buf[1],*retstr; cJSON *retjson; @@ -279,11 +293,12 @@ cJSON *dpow_MoMoMdata(struct iguana_info *coin,char *symbol,int32_t kmdheight,ui 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) { 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; - 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); 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); } -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 buf[128],*retstr=0; cJSON *retjson; diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 0bf6dfcd9..1e72dabae 100755 --- a/iguana/dpow/dpow_tx.c +++ b/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 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; if ( bits256_nonz(signedtxid) != 0 && numsigs == bp->minsigs ) {