Test
This commit is contained in:
@@ -612,24 +612,24 @@ UniValue PaymentsInfo(struct CCcontract_info *cp,char *jsonstr)
|
|||||||
fprintf(stderr,"i%d of %d\n",i,(int32_t)txidoprets.size());
|
fprintf(stderr,"i%d of %d\n",i,(int32_t)txidoprets.size());
|
||||||
if ( myGetTransaction(txidoprets[i],txO,hashBlock) != 0 && txO.vout.size() > 1 && DecodePaymentsTxidOpRet(txO.vout[txO.vout.size()-1].scriptPubKey,allocation,scriptPubKey,opret) == 'T' )
|
if ( myGetTransaction(txidoprets[i],txO,hashBlock) != 0 && txO.vout.size() > 1 && DecodePaymentsTxidOpRet(txO.vout[txO.vout.size()-1].scriptPubKey,allocation,scriptPubKey,opret) == 'T' )
|
||||||
{
|
{
|
||||||
outstr = (char *)malloc(scriptPubKey.size() + opret.size() + 1);
|
outstr = (char *)malloc(2*(scriptPubKey.size() + opret.size()) + 1);
|
||||||
for (j=0; j<scriptPubKey.size(); j++)
|
for (j=0; j<scriptPubKey.size(); j++)
|
||||||
outstr[j] = scriptPubKey[j];
|
sprintf(&outstr[j<<1],"%02x",scriptPubKey[j]);
|
||||||
outstr[j] = 0;
|
outstr[j<<1] = 0;
|
||||||
fprintf(stderr,"scriptPubKey.(%s)\n",outstr);
|
fprintf(stderr,"scriptPubKey.(%s)\n",outstr);
|
||||||
obj.push_back(Pair("scriptPubKey",outstr));
|
obj.push_back(Pair("scriptPubKey",outstr));
|
||||||
if ( opret.size() != 0 )
|
if ( opret.size() != 0 )
|
||||||
{
|
{
|
||||||
for (j=0; j<opret.size(); j++)
|
for (j=0; j<opret.size(); j++)
|
||||||
outstr[j] = opret[j];
|
sprintf(&outstr[j<<1],"%02x",opret[j]);
|
||||||
outstr[j] = 0;
|
outstr[j<<1] = 0;
|
||||||
fprintf(stderr,"opret.(%s)\n",outstr);
|
fprintf(stderr,"opret.(%s)\n",outstr);
|
||||||
obj.push_back(Pair("opreturn",outstr));
|
obj.push_back(Pair("opreturn",outstr));
|
||||||
numoprets++;
|
numoprets++;
|
||||||
}
|
}
|
||||||
free(outstr);
|
free(outstr);
|
||||||
} else fprintf(stderr,"error decoding voutsize.%d\n",(int32_t)txO.vout.size());
|
} else fprintf(stderr,"error decoding voutsize.%d\n",(int32_t)txO.vout.size());
|
||||||
result.push_back(obj);
|
a.push_back(obj);
|
||||||
}
|
}
|
||||||
flag++;
|
flag++;
|
||||||
if ( numoprets > 1 )
|
if ( numoprets > 1 )
|
||||||
@@ -646,7 +646,7 @@ UniValue PaymentsInfo(struct CCcontract_info *cp,char *jsonstr)
|
|||||||
result.push_back(Pair(fundsaddr,ValueFromAmount(funds)));
|
result.push_back(Pair(fundsaddr,ValueFromAmount(funds)));
|
||||||
GetCCaddress(cp,fundsopretaddr,Paymentspk);
|
GetCCaddress(cp,fundsopretaddr,Paymentspk);
|
||||||
fundsopret = CCaddress_balance(fundsopretaddr);
|
fundsopret = CCaddress_balance(fundsopretaddr);
|
||||||
//result.push_back(Pair("txidoprets",a));
|
result.push_back(Pair("txidoprets",a));
|
||||||
result.push_back(Pair(fundsopretaddr,ValueFromAmount(fundsopret)));
|
result.push_back(Pair(fundsopretaddr,ValueFromAmount(fundsopret)));
|
||||||
result.push_back(Pair("totalfunds",ValueFromAmount(funds+fundsopret)));
|
result.push_back(Pair("totalfunds",ValueFromAmount(funds+fundsopret)));
|
||||||
result.push_back(Pair("result","success"));
|
result.push_back(Pair("result","success"));
|
||||||
|
|||||||
Reference in New Issue
Block a user