jl777 8 years ago
parent
commit
5d51c6176d
  1. 22
      iguana/dpow/dpow_rpc.c
  2. 10
      iguana/dpow/dpow_tx.c

22
iguana/dpow/dpow_rpc.c

@ -86,6 +86,28 @@ bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *c
return(blockhash);
}
int32_t dpow_paxpending(uint8_t *hex)
{
struct iguana_info *coin; char *retstr,*hexstr; cJSON *retjson; int32_t n=0;
if ( (coin= iguana_coinfind("KMD")) != 0 )
{
if ( coin->FULLNODE < 0 )
{
if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"paxwithdraw","")) != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
if ( (hexstr= jstr(retjson,"withdraws")) != 0 && (n= is_hexstr(hexstr,0)) > 0 )
decode_hex(hex,n,hexstr);
free_json(retjson);
}
free(retstr);
}
}
}
return(n);
}
bits256 dpow_getblockhash(struct supernet_info *myinfo,struct iguana_info *coin,int32_t height)
{
char buf[128],*retstr=0; bits256 blockhash;

10
iguana/dpow/dpow_tx.c

@ -165,7 +165,7 @@ struct dpow_block *dpow_heightfind(struct supernet_info *myinfo,struct dpow_info
int32_t dpow_voutstandard(struct dpow_block *bp,uint8_t *serialized,int32_t m,int32_t src_or_dest,uint8_t pubkeys[][33],int32_t numratified)
{
uint32_t locktime=0,numvouts; uint64_t satoshis,satoshisB; int32_t i,opretlen,len=0; uint8_t opret[1024],data[4096];
uint32_t locktime=0,numvouts; uint64_t satoshis,satoshisB; int32_t i,n,opretlen,len=0; uint8_t opret[1024],data[4096];
numvouts = 2;
if ( pubkeys == 0 || numratified <= 0 )
{
@ -208,7 +208,13 @@ int32_t dpow_voutstandard(struct dpow_block *bp,uint8_t *serialized,int32_t m,in
return(-1);
}
opretlen = dpow_opreturnscript(data,opret,opretlen);
// insert 'A' values
if ( (n= dpow_paxpending(&opret[opretlen])) > 0 )
{
for (i=0; i<n; i++)
printf("%02x",opret[opretlen+i]);
printf(" <- withdraw.%d\n",n);
opretlen += n;
}
if ( opretlen < 0xfd )
serialized[len++] = opretlen;
else

Loading…
Cancel
Save