From 157f0a58a7c0813ccc819f12f0b85c219cee96f8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 29 Nov 2016 10:29:40 -0300 Subject: [PATCH] test --- iguana/dpow/dpow_tx.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 80f289e1c..4db379017 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -387,7 +387,7 @@ cJSON *dpow_vins(struct iguana_info *coin,struct dpow_block *bp,int8_t bestk,uin void dpow_rawtxsign(struct supernet_info *myinfo,struct dpow_info *dp,struct iguana_info *coin,struct dpow_block *bp,char *rawtx,cJSON *vins,int8_t bestk,uint64_t bestmask,int32_t myind,int32_t src_or_dest) { - int32_t j,m=0,retval=-1; char *jsonstr,*signedtx,*rawtx2,*sigstr,*pubstr; cJSON *signobj,*vinitem,*sobj,*txobj2,*item,*vin; uint8_t pubkey33[33]; bits256 srchash; struct dpow_entry *ep; struct dpow_coinentry *cp; + int32_t j,m=0,valid,retval=-1; char *jsonstr,*signedtx,*rawtx2,*sigstr,*pubstr; cJSON *signobj,*vinitem,*sobj,*txobj2,*item,*vin; uint8_t pubkey33[33]; bits256 srchash; struct dpow_entry *ep; struct dpow_coinentry *cp; if ( bestk < 0 ) return; for (j=0; j 32 ) { - if ( (pubstr= jstr(vinitem,"scriptPubkey")) != 0 && is_hexstr(pubstr,0) == 66 ) + valid = 0; + if ( dp->ratifying != 0 && j == 0 ) + valid = 1; + else if ( (pubstr= jstr(vinitem,"scriptPubkey")) != 0 && is_hexstr(pubstr,0) == 66 ) { decode_hex(pubkey33,33,&pubstr[1]); if ( memcmp(pubkey33,dp->minerkey33,33) == 0 ) - { - printf("bestk.%d %llx %s height.%d mod.%d VINI.%d myind.%d MINE.(%s) j.%d\n",bestk,(long long)bestmask,(src_or_dest != 0) ? bp->destcoin->symbol : bp->srccoin->symbol,bp->height,DPOW_MODIND(bp,0),j,myind,jprint(item,0),j); - cp->siglens[bestk] = (int32_t)strlen(sigstr) >> 1; - if ( src_or_dest != 0 ) - bp->destsigsmasks[bestk] |= (1LL << myind); - else bp->srcsigsmasks[bestk] |= (1LL << myind); - decode_hex(cp->sigs[bestk],cp->siglens[bestk],sigstr); - ep->masks[src_or_dest][bestk] = bestmask; - ep->beacon = bp->beacon; - dpow_sigsend(myinfo,dp,bp,myind,bestk,bestmask,srchash,src_or_dest != 0 ? DPOW_SIGBTCCHANNEL : DPOW_SIGCHANNEL); - retval = 0; - break; - } else printf("sig didnt match pubkey? (%s)\n",jprint(vinitem,0)); - } else printf("no scriptPubkey.(%s)\n",jprint(vinitem,0)); + valid = 1; + } + if ( valid != 0 ) + { + printf("bestk.%d %llx %s height.%d mod.%d VINI.%d myind.%d MINE.(%s) j.%d\n",bestk,(long long)bestmask,(src_or_dest != 0) ? bp->destcoin->symbol : bp->srccoin->symbol,bp->height,DPOW_MODIND(bp,0),j,myind,jprint(item,0),j); + cp->siglens[bestk] = (int32_t)strlen(sigstr) >> 1; + if ( src_or_dest != 0 ) + bp->destsigsmasks[bestk] |= (1LL << myind); + else bp->srcsigsmasks[bestk] |= (1LL << myind); + decode_hex(cp->sigs[bestk],cp->siglens[bestk],sigstr); + ep->masks[src_or_dest][bestk] = bestmask; + ep->beacon = bp->beacon; + dpow_sigsend(myinfo,dp,bp,myind,bestk,bestmask,srchash,src_or_dest != 0 ? DPOW_SIGBTCCHANNEL : DPOW_SIGCHANNEL); + retval = 0; + break; + } else printf("sig didnt match pubkey? (%s)\n",jprint(vinitem,0)); } // else printf("notmine.(%s)\n",jprint(item,0)); } } else printf("no vin[] (%s)\n",jprint(txobj2,0));