Browse Source

mask support for parfaits

etomic
jl777 8 years ago
parent
commit
5394b87519
  1. 18
      basilisk/basilisk.c
  2. 2
      iguana/dPoW.h
  3. 4
      iguana/dpow/dpow_network.c
  4. 2
      iguana/tests/paxfiats
  5. 6
      includes/iguana_apideclares.h

18
basilisk/basilisk.c

@ -1044,21 +1044,27 @@ HASH_ARRAY_STRING(basilisk,history,hash,vals,hexstr)
return(jprint(retjson,1)); return(jprint(retjson,1));
} }
ZERO_ARGS(passthru,paxfiats) INT_ARG(passthru,paxfiats,mask)
{ {
komodo_assetcoins(-1); if ( mask == 0 )
mask = -1;
komodo_assetcoins(-1,mask);
return(clonestr("{\"result\":\"success\"}")); return(clonestr("{\"result\":\"success\"}"));
} }
ZERO_ARGS(basilisk,paxfiats) INT_ARG(basilisk,paxfiats,mask)
{ {
komodo_assetcoins(0); if ( mask == 0 )
mask = -1;
komodo_assetcoins(0,mask);
return(clonestr("{\"result\":\"success\"}")); return(clonestr("{\"result\":\"success\"}"));
} }
ZERO_ARGS(iguana,paxfiats) INT_ARG(iguana,paxfiats,mask)
{ {
komodo_assetcoins(1); if ( mask == 0 )
mask = -1;
komodo_assetcoins(1,mask);
return(clonestr("{\"result\":\"success\"}")); return(clonestr("{\"result\":\"success\"}"));
} }
#include "../includes/iguana_apiundefs.h" #include "../includes/iguana_apiundefs.h"

2
iguana/dPoW.h

@ -149,7 +149,7 @@ int32_t dpow_getchaintip(struct supernet_info *myinfo,bits256 *blockhashp,uint32
void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,bits256 srchash,bits256 desthash,uint32_t channel,uint32_t msgbits,uint8_t *data,int32_t datalen); void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,bits256 srchash,bits256 desthash,uint32_t channel,uint32_t msgbits,uint8_t *data,int32_t datalen);
int32_t dpow_nanomsg_update(struct supernet_info *myinfo); int32_t dpow_nanomsg_update(struct supernet_info *myinfo);
int32_t dpow_haveutxo(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,char *coinaddr); int32_t dpow_haveutxo(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,char *coinaddr);
void komodo_assetcoins(int32_t fullnode); void komodo_assetcoins(int32_t fullnode,uint64_t mask);
int32_t iguana_isnotarychain(char *symbol); int32_t iguana_isnotarychain(char *symbol);
cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin); cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin);

4
iguana/dpow/dpow_network.c

@ -1894,7 +1894,7 @@ uint16_t komodo_port(char *symbol,uint64_t supply,uint32_t *magicp)
#define MAX_CURRENCIES 32 #define MAX_CURRENCIES 32
extern char CURRENCIES[][8]; extern char CURRENCIES[][8];
void komodo_assetcoins(int32_t fullnode) void komodo_assetcoins(int32_t fullnode,uint64_t mask)
{ {
uint16_t extract_userpass(char *serverport,char *userpass,char *coinstr,char *userhome,char *coindir,char *confname); uint16_t extract_userpass(char *serverport,char *userpass,char *coinstr,char *userhome,char *coindir,char *confname);
int32_t i,j; uint32_t magic; cJSON *json; uint16_t port; long filesize; char *userhome,confstr[16],jsonstr[512],magicstr[9],path[512]; struct iguana_info *coin; int32_t i,j; uint32_t magic; cJSON *json; uint16_t port; long filesize; char *userhome,confstr[16],jsonstr[512],magicstr[9],path[512]; struct iguana_info *coin;
@ -1907,6 +1907,8 @@ void komodo_assetcoins(int32_t fullnode)
} }
for (i=0; i<MAX_CURRENCIES; i++) for (i=0; i<MAX_CURRENCIES; i++)
{ {
if ( ((1LL << i) & mask) == 0 )
continue;
port = komodo_port(CURRENCIES[i],10,&magic); port = komodo_port(CURRENCIES[i],10,&magic);
for (j=0; j<4; j++) for (j=0; j<4; j++)
sprintf(&magicstr[j*2],"%02x",((uint8_t *)&magic)[j]); sprintf(&magicstr[j*2],"%02x",((uint8_t *)&magic)[j]);

2
iguana/tests/paxfiats

@ -0,0 +1,2 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"basilisk\",\"method\":\"paxfiats\",\"mask\":$1}"

6
includes/iguana_apideclares.h

@ -22,9 +22,9 @@ THREE_STRINGS(iguana,passthru,asset,function,hex);
STRING_ARG(dpow,bindaddr,ipaddr); STRING_ARG(dpow,bindaddr,ipaddr);
STRING_AND_INT(dpow,fundnotaries,symbol,numblocks); STRING_AND_INT(dpow,fundnotaries,symbol,numblocks);
ZERO_ARGS(dpow,notarychains); ZERO_ARGS(dpow,notarychains);
ZERO_ARGS(passthru,paxfiats); INT_ARG(passthru,paxfiats,mask);
ZERO_ARGS(basilisk,paxfiats); INT_ARG(basilisk,paxfiats,mask);
ZERO_ARGS(iguana,paxfiats); INT_ARG(iguana,paxfiats,mask);
STRING_AND_INT(iguana,snapshot,symbol,height); STRING_AND_INT(iguana,snapshot,symbol,height);
INT_ARRAY_STRING(iguana,dividends,height,vals,symbol); INT_ARRAY_STRING(iguana,dividends,height,vals,symbol);

Loading…
Cancel
Save