Test
This commit is contained in:
@@ -331,7 +331,6 @@ int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int3
|
||||
{
|
||||
txid = out.tx->GetHash();
|
||||
vout = out.i;
|
||||
char str[65]; fprintf(stderr,"check %s/v%d\n",uint256_str(str,txid),vout);
|
||||
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout.size() > 0 && vout < tx.vout.size() && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() == 0 )
|
||||
{
|
||||
if ( mtx.vin.size() > 0 )
|
||||
@@ -350,14 +349,13 @@ int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int3
|
||||
if ( i != n )
|
||||
continue;
|
||||
}
|
||||
fprintf(stderr,"check in mempool\n");
|
||||
if ( myIsutxo_spentinmempool(txid,vout) == 0 )
|
||||
{
|
||||
fprintf(stderr,"add to vins array.%d of %d\n",n,maxutxos);
|
||||
up = &utxos[n++];
|
||||
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);
|
||||
if ( n >= maxutxos )
|
||||
break;
|
||||
}
|
||||
@@ -390,6 +388,7 @@ int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int3
|
||||
remains -= up->nValue;
|
||||
utxos[ind] = utxos[--n];
|
||||
memset(&utxos[n],0,sizeof(utxos[n]));
|
||||
fprintf(stderr,"totalinputs %.8f vs total %.8f i.%d vs max.%d\n",(double)totalinputs/COIN,(double)total/COIN,i,maxinputs);
|
||||
if ( totalinputs >= total || (i+1) >= maxinputs )
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -787,14 +787,14 @@ std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector <uint8_t> da
|
||||
if ( txfee == 0 )
|
||||
txfee = 10000;
|
||||
GetCCaddress(cp,coinaddr,mypk);
|
||||
if ( AddNormalinputs(mtx,mypk,2*txfee,3) > 0 ) // have enough funds even if baton utxo not there
|
||||
if ( AddNormalinputs(mtx,mypk,2*txfee,16) > 0 ) // have enough funds even if baton utxo not there
|
||||
{
|
||||
batonpk = OracleBatonPk(batonaddr,cp);
|
||||
batontxid = OracleBatonUtxo(txfee,cp,oracletxid,batonaddr,mypk,prevdata);
|
||||
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,60)) > 0 )
|
||||
if ( (inputs= AddOracleInputs(cp,mtx,mypk,datafee,40)) > 0 )
|
||||
{
|
||||
if ( inputs > datafee )
|
||||
CCchange = (inputs - datafee);
|
||||
|
||||
Reference in New Issue
Block a user