Mini
This commit is contained in:
@@ -66,7 +66,7 @@ void prices_bardisp(struct prices_bar *bar)
|
|||||||
|
|
||||||
int64_t prices_blockinfo(int32_t height,char *acaddr)
|
int64_t prices_blockinfo(int32_t height,char *acaddr)
|
||||||
{
|
{
|
||||||
std::vector<uint8_t> vopret; CBlockIndex *pindex; CBlock block; CTransaction tx,vintx; uint64_t pricebits; char destaddr[64]; uint32_t aveprice=0,timestamp,uprice; uint256 hashBlock; int64_t prizefund = 0; int32_t i,n,vini,numvouts,iter; struct prices_bar refbar;
|
std::vector<uint8_t> vopret; CBlockIndex *pindex; CBlock block; CTransaction tx,vintx; uint64_t pricebits; char destaddr[64]; uint32_t aveprice=0,timestamp,uprice; uint256 hashBlock; int64_t dist,bestdist=0,prizefund = 0; int32_t mini=-1,i,n,vini,numvouts,iter; struct prices_bar refbar;
|
||||||
if ( (pindex= komodo_chainactive(height)) != 0 )
|
if ( (pindex= komodo_chainactive(height)) != 0 )
|
||||||
{
|
{
|
||||||
if ( komodo_blockload(block,pindex) == 0 )
|
if ( komodo_blockload(block,pindex) == 0 )
|
||||||
@@ -96,11 +96,20 @@ int64_t prices_blockinfo(int32_t height,char *acaddr)
|
|||||||
prizefund += tx.vout[0].nValue;
|
prizefund += tx.vout[0].nValue;
|
||||||
if ( strcmp(acaddr,destaddr) == 0 )
|
if ( strcmp(acaddr,destaddr) == 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"REF ");
|
//fprintf(stderr,"REF ");
|
||||||
prices_barupdate(&refbar,pricebits);
|
prices_barupdate(&refbar,pricebits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(stderr,"i.%d %.8f t%u %.4f v.%d %s lag.%d i.%d dist.%lld\n",i,(double)tx.vout[0].nValue/COIN,timestamp,(double)uprice/10000,numvouts,destaddr,(int32_t)(pindex->nTime-timestamp),iter,(long long)prices_bardist(&refbar,aveprice,pricebits));
|
else if ( strcmp(acaddr,destaddr) != 0 )
|
||||||
|
{
|
||||||
|
dist = prices_bardist(&refbar,aveprice,pricebits);
|
||||||
|
if ( dist == 0 || dist < mindist )
|
||||||
|
{
|
||||||
|
mindist = dist;
|
||||||
|
mini = i;
|
||||||
|
}
|
||||||
|
fprintf(stderr,"mini.%d i.%d %.8f t%u %.4f v.%d %s lag.%d i.%d dist.%lld\n",mini,i,(double)tx.vout[0].nValue/COIN,timestamp,(double)uprice/10000,numvouts,destaddr,(int32_t)(pindex->nTime-timestamp),iter,(long long)dist);
|
||||||
|
}
|
||||||
} else return(-3);
|
} else return(-3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user