up->txid = txid;
up->nValue = out.tx->vout[out.i].nValue;
up->vout = vout;
- fprintf(stderr,"add %.8f to vins array.%d of %d\n",(double)up->nValue/COIN,n,maxutxos);
+ //fprintf(stderr,"add %.8f to vins array.%d of %d\n",(double)up->nValue/COIN,n,maxutxos);
if ( n >= maxutxos )
break;
}
}
free(utxos);
if ( totalinputs >= total )
+ {
+ fprintf(stderr,"return totalinputs %.8f\n",(double)totalinputs/COIN);
return(totalinputs);
+ }
#endif
return(0);
}
int64_t IsOraclesvout(struct CCcontract_info *cp,const CTransaction& tx,int32_t v)
{
- char destaddr[64];
+ //char destaddr[64];
if ( tx.vout[v].scriptPubKey.IsPayToCryptoCondition() != 0 )
{
- if ( Getscriptaddress(destaddr,tx.vout[v].scriptPubKey) > 0 )// && strcmp(destaddr,cp->unspendableCCaddr) == 0 )
+ //if ( Getscriptaddress(destaddr,tx.vout[v].scriptPubKey) > 0 && strcmp(destaddr,cp->unspendableCCaddr) == 0 )
return(tx.vout[v].nValue);
}
return(0);
{
txid = it->first.txhash;
vout = (int32_t)it->first.index;
+ char str[65]; fprintf(stderr,"oracle check %s/v%d\n",uint256_str(str,txid),vout);
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
{
// get valid CC payments
n++;
if ( (total > 0 && totalinputs >= total) || (maxinputs > 0 && n >= maxinputs) )
break;
- }
- }
+ } else fprintf(stderr,"nValue %.8f or utxo memspent\n",(double)nValue/COIN);
+ } else fprintf(stderr,"couldnt find transaction\n");
}
return(totalinputs);
}
if ( batontxid != zeroid ) // not impossible to fail, but hopefully a very rare event
mtx.vin.push_back(CTxIn(batontxid,1,CScript()));
else fprintf(stderr,"warning: couldnt find baton utxo %s\n",batonaddr);
- if ( (inputs= AddOracleInputs(cp,mtx,mypk,datafee,40)) > 0 )
+ if ( (inputs= AddOracleInputs(cp,mtx,mypk,datafee,60)) > 0 )
{
if ( inputs > datafee )
CCchange = (inputs - datafee);
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,batonpk));
mtx.vout.push_back(CTxOut(datafee,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesData('D',oracletxid,batontxid,mypk,data)));
- } else fprintf(stderr,"couldnt add normal inputs\n");
+ } else fprintf(stderr,"couldnt add oracle inputs\n");
} else fprintf(stderr,"couldnt add normal inputs\n");
return("");
}