From a230743ccc8e45d576e94fdb57a3373ca1853041 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 17 Nov 2016 12:08:33 -0300 Subject: [PATCH] test --- iguana/dpow/dpow_network.c | 11 +++++++++++ iguana/dpow/dpow_rpc.c | 26 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 36ace8186..6b9091dce 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -272,6 +272,17 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct memset(&bp->notaries[i].ratifydestutxo,0,sizeof(bp->notaries[i].ratifydestutxo)); bp->notaries[i].ratifybestmask = bp->notaries[i].ratifyrecvmask = 0; } + else + { + if ( dpow_checkutxo(myinfo,dp,bp,bp->destcoin,&bp->notaries[i].dest.prev_hash,&bp->notaries[i].dest.prev_vout,destaddr) < 0 ) + { + printf("dont have %s %s utxo, please send funds\n",dp->dest,destaddr); + } + if ( dpow_checkutxo(myinfo,dp,bp,bp->srccoin,&bp->notaries[i].src.prev_hash,&bp->notaries[i].src.prev_vout,srcaddr) < 0 ) + { + printf("dont have %s %s utxo, please send funds\n",dp->symbol,srcaddr); + } + } } } } diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 3e7343f29..500202359 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -112,6 +112,32 @@ cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits2 return(json); } +cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout) +{ + char buf[128],str[65],*retstr=0; cJSON *json = 0; + sprintf(buf,"\"%s\", %d",bits256_str(str,txid),vout); + if ( coin->FULLNODE < 0 ) + { + retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"gettxout",buf); + usleep(10000); + } + else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) + { + printf("need to test following call\n"); + retstr = bitcoinrpc_gettxout(myinfo,coin,0,buf,txid,1,0); // untested + } + else + { + return(0); + } + if ( retstr != 0 ) + { + json = cJSON_Parse(retstr); + free(retstr); + } + return(json); +} + char *dpow_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx) { char *retstr,*paramstr; cJSON *array;