Fix utxo selection bug
This commit is contained in:
@@ -81,11 +81,11 @@ int64_t NSPV_addinputs(struct NSPV_utxoresp *used,CMutableTransaction &mtx,int64
|
|||||||
else threshold = total;
|
else threshold = total;
|
||||||
for (i=0; i<num; i++)
|
for (i=0; i<num; i++)
|
||||||
{
|
{
|
||||||
if ( ptr[i].satoshis > threshold )
|
if ( num < NSPV_MAXVINS || ptr[i].satoshis > threshold )
|
||||||
utxos[n++] = ptr[i];
|
utxos[n++] = ptr[i];
|
||||||
}
|
}
|
||||||
remains = total;
|
remains = total;
|
||||||
fprintf(stderr,"threshold %.8f n.%d for total %.8f\n",(double)threshold/COIN,n,(double)total/COIN);
|
//fprintf(stderr,"threshold %.8f n.%d for total %.8f\n",(double)threshold/COIN,n,(double)total/COIN);
|
||||||
for (i=0; i<maxinputs && n>0; i++)
|
for (i=0; i<maxinputs && n>0; i++)
|
||||||
{
|
{
|
||||||
below = above = 0;
|
below = above = 0;
|
||||||
@@ -115,7 +115,7 @@ int64_t NSPV_addinputs(struct NSPV_utxoresp *used,CMutableTransaction &mtx,int64
|
|||||||
if ( totalinputs >= total || (i+1) >= maxinputs )
|
if ( totalinputs >= total || (i+1) >= maxinputs )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fprintf(stderr,"totalinputs %.8f vs total %.8f\n",(double)totalinputs/COIN,(double)total/COIN);
|
//fprintf(stderr,"totalinputs %.8f vs total %.8f\n",(double)totalinputs/COIN,(double)total/COIN);
|
||||||
if ( totalinputs >= total )
|
if ( totalinputs >= total )
|
||||||
return(totalinputs);
|
return(totalinputs);
|
||||||
return(0);
|
return(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user