From 6862e81a7ace5055dd897c087ed4c0e90a29c4b4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 23 Feb 2018 22:21:03 +0200 Subject: [PATCH] Kolo's request --- iguana/dPoW.h | 2 +- iguana/dpow/dpow_fsm.c | 8 ++++---- iguana/dpow/dpow_rpc.c | 4 ++-- iguana/iguana_notary.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/iguana/dPoW.h b/iguana/dPoW.h index ba9e5c00e..9c2f22208 100755 --- a/iguana/dPoW.h +++ b/iguana/dPoW.h @@ -149,7 +149,7 @@ char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int3 int32_t dpow_getchaintip(struct supernet_info *myinfo,bits256 *blockhashp,uint32_t *blocktimep,bits256 *txs,uint32_t *numtxp,struct iguana_info *coin); void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,bits256 srchash,bits256 desthash,uint32_t channel,uint32_t msgbits,uint8_t *data,int32_t datalen); 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); +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); diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 7933c35c2..45509ef8f 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -121,7 +121,7 @@ int32_t dpow_datahandler(struct supernet_info *myinfo,struct dpow_info *dp,struc return(0); } -int32_t dpow_checkutxo(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,char *coinaddr) +int32_t dpow_checkutxo(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,char *coinaddr,char *srccoin) { int32_t haveutxo,completed,minutxo,n; bits256 signedtxid; cJSON *addresses; char *rawtx,*sendtx; if ( strcmp("BTC",coin->symbol) == 0 ) @@ -134,7 +134,7 @@ int32_t dpow_checkutxo(struct supernet_info *myinfo,struct dpow_info *dp,struct minutxo = 49; n = 10; } - if ( (haveutxo= dpow_haveutxo(myinfo,coin,txidp,voutp,coinaddr)) <= minutxo && time(NULL) > dp->lastsplit+bp->duration && (bp->myind != 0 || dp->ratifying == 0) ) + if ( (haveutxo= dpow_haveutxo(myinfo,coin,txidp,voutp,coinaddr,srccoin)) <= minutxo && time(NULL) > dp->lastsplit+bp->duration && (bp->myind != 0 || dp->ratifying == 0) ) { addresses = cJSON_CreateArray(); jaddistr(addresses,coinaddr); @@ -350,14 +350,14 @@ void dpow_statemachinestart(void *ptr) } else { - if ( dpow_checkutxo(myinfo,dp,bp,bp->destcoin,&ep->dest.prev_hash,&ep->dest.prev_vout,destaddr) < 0 ) + if ( dpow_checkutxo(myinfo,dp,bp,bp->destcoin,&ep->dest.prev_hash,&ep->dest.prev_vout,destaddr,src->symbol) < 0 ) { printf("dont have %s %s utxo, please send funds\n",dp->dest,destaddr); dp->ratifying -= bp->isratify; free(ptr); return; } - if ( dpow_checkutxo(myinfo,dp,bp,bp->srccoin,&ep->src.prev_hash,&ep->src.prev_vout,srcaddr) < 0 ) + if ( dpow_checkutxo(myinfo,dp,bp,bp->srccoin,&ep->src.prev_hash,&ep->src.prev_vout,srcaddr,"") < 0 ) { printf("dont have %s %s utxo, please send funds\n",dp->symbol,srcaddr); dp->ratifying -= bp->isratify; diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index ec271e5a8..f3e729a89 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -770,7 +770,7 @@ int32_t dpow_vini_ismine(struct supernet_info *myinfo,struct dpow_info *dp,cJSON return(-1); } -int32_t dpow_haveutxo(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,char *coinaddr) +int32_t dpow_haveutxo(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,char *coinaddr,char *srccoin) { int32_t vout,haveutxo = 0; uint32_t i,j,n,r; bits256 txid; cJSON *unspents,*item; uint64_t satoshis; char *str,*address; uint8_t script[35]; memset(txidp,0,sizeof(*txidp)); @@ -820,7 +820,7 @@ int32_t dpow_haveutxo(struct supernet_info *myinfo,struct iguana_info *coin,bits } } if ( haveutxo == 0 ) - printf("no %s utxo: need to fund address.(%s) or wait for splitfund to confirm\n",coin->symbol,coinaddr); + printf("no (%s -> %s) utxo: need to fund address.(%s) or wait for splitfund to confirm\n",srccoin,coin->symbol,coinaddr); } //else printf("null utxo array size\n"); free_json(unspents); } else printf("null return from dpow_listunspent\n"); diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index cac141dd2..e14d5721d 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -24,7 +24,7 @@ int32_t dpow_datahandler(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,uint8_t nn_senderind,uint32_t channel,uint32_t height,uint8_t *data,int32_t datalen); uint64_t dpow_maskmin(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp); -int32_t dpow_checkutxo(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,char *coinaddr); +int32_t dpow_checkutxo(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,char *coinaddr,char *srccoin); #include "dpow/dpow_network.c" #include "dpow/dpow_rpc.c"