Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
add12fb915
  1. 4
      crypto777/OS_portable.h
  2. 10
      crypto777/iguana_serdes.c
  3. 2
      iguana/iguana_msg.c
  4. 133
      iguana/iguana_rpc.c
  5. 7
      iguana/main.c

4
crypto777/OS_portable.h

@ -149,7 +149,6 @@ void *OS_portable_mapfile(char *fname,long *filesizep,int32_t enablewrite);
int32_t OS_portable_syncmap(struct OS_mappedptr *mp,long len);
void *OS_portable_tmpalloc(char *dirname,char *name,struct OS_memspace *mem,long origsize);
int32_t is_DST(int32_t datenum);
int32_t extract_datenum(int32_t *yearp,int32_t *monthp,int32_t *dayp,int32_t datenum);
int32_t expand_datenum(char *date,int32_t datenum);
@ -206,7 +205,6 @@ void *iguana_meminit(struct OS_memspace *mem,char *name,void *ptr,int64_t totals
void *iguana_memalloc(struct OS_memspace *mem,long size,int32_t clearflag);
int64_t iguana_memfree(struct OS_memspace *mem,void *ptr,int32_t size);
// generic functions
int32_t unhex(char c);
void touppercase(char *str);
@ -313,5 +311,7 @@ bits256 bits256_from_compact(uint32_t c);
int32_t btc_priv2pub(uint8_t pubkey[33],uint8_t privkey[32]);
extern char *Iguana_validcommands[];
#endif

10
crypto777/iguana_serdes.c

@ -54,13 +54,9 @@ int32_t iguana_rwnum(int32_t rwflag,uint8_t *serialized,int32_t len,void *endian
int32_t iguana_validatehdr(struct iguana_msghdr *H)
{
int32_t i,len; char *validcommands[] =
{
"SuperNET", "version", "verack", "getaddr", "addr", "inv", "getdata", "notfound", "getblocks", "getheaders",
"headers", "tx", "block", "mempool", "ping", "pong", "reject", "filterload", "filteradd", "filterclear", "merkleblock", "alert"
};
for (i=0; i<sizeof(validcommands)/sizeof(*validcommands); i++)
if ( strcmp(H->command,validcommands[i]) == 0 )
int32_t i,len;
for (i=0; Iguana_validcommands[i]!=0&&Iguana_validcommands[i][0]!=0; i++)
if ( strcmp(H->command,Iguana_validcommands[i]) == 0 )
{
iguana_rwnum(0,H->serdatalen,sizeof(H->serdatalen),(uint32_t *)&len);
if ( len > IGUANA_MAXPACKETSIZE )

2
iguana/iguana_msg.c

@ -429,7 +429,7 @@ int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struc
strcpy(addr->lastcommand,H->command);
}
retval = 0;
//printf("iguana_msgparser %s parse.(%s)\n",addr->ipaddr,H->command);
printf("iguana_msgparser %s parse.(%s)\n",addr->ipaddr,H->command);
if ( strncmp(H->command,"SuperNET",strlen("SuperNET")) == 0 )
{
addr->supernet = 1;

133
iguana/iguana_rpc.c

@ -471,72 +471,73 @@ static char *getrawchangeaddress(RPCARGS)
#define false 0
struct RPC_info { char *name; char *(*rpcfunc)(RPCARGS); int32_t flag0,remoteflag; } RPCcalls[] =
{
{ "help", &help, true, false },
{ "stop", &stop, true, true },
{ "getbestblockhash", &getbestblockhash, true, true },
{ "getblockcount", &getblockcount, true, true },
{ "getconnectioncount", &getconnectioncount, true, true },
{ "getpeerinfo", &getpeerinfo, true, true },
{ "getinfo", &getinfo, true, true },
{ "getnewaddress", &getnewaddress, true, false },
{ "getnewpubkey", &makekeypair, true, false },
{ "getaccountaddress", &getaccountaddress, true, false },
{ "setaccount", &setaccount, true, false },
{ "getaccount", &getaccount, false, false },
{ "getaddressesbyaccount", &getaddressesbyaccount, true, false },
{ "sendtoaddress", &sendtoaddress, false, false },
{ "getreceivedbyaddress", &getreceivedbyaddress, false, false },
{ "getreceivedbyaccount", &getreceivedbyaccount, false, false },
{ "listreceivedbyaddress", &listreceivedbyaddress, false, false },
{ "listreceivedbyaccount", &listreceivedbyaccount, false, false },
{ "backupwallet", &backupwallet, true, false },
{ "walletpassphrase", &walletpassphrase, true, false },
{ "walletpassphrasechange", &walletpassphrasechange, false, false },
{ "walletlock", &walletlock, true, false },
{ "encryptwallet", &encryptwallet, false, false },
{ "validateaddress", &validateaddress, true, true },
{ "validatepubkey", &validatepubkey, true, true },
{ "getbalance", &getbalance, false, false },
{ "move", &movecmd, false, false },
{ "sendfrom", &sendfrom, false, false },
{ "sendmany", &sendmany, false, false },
{ "addmultisigaddress", &addmultisigaddress, false, false },
{ "getblock", &getblock, false, true },
{ "getblockhash", &getblockhash, false, true },
{ "gettransaction", &gettransaction, false, true },
{ "listtransactions", &listtransactions, false, false },
{ "listaddressgroupings", &listaddressgroupings, false, false },
{ "signmessage", &signmessage, false, false },
{ "verifymessage", &verifymessage, false, false },
{ "listaccounts", &listaccounts, false, false },
{ "settxfee", &settxfee, false, false },
{ "listsinceblock", &listsinceblock, false, false },
{ "dumpprivkey", &dumpprivkey, false, false },
{ "SuperNET", &SuperNET, false, true },
{ "dumpwallet", &dumpwallet, true, false },
{ "importwallet", &importwallet, false, false },
{ "importprivkey", &importprivkey, false, false },
{ "listunspent", &listunspent, false, false },
{ "getrawtransaction", &getrawtransaction, false, false },
{ "createrawtransaction", &createrawtransaction, false, false },
{ "decoderawtransaction", &decoderawtransaction, false, true },
{ "decodescript", &decodescript, false, true },
{ "signrawtransaction", &signrawtransaction, false, false },
{ "sendrawtransaction", &sendrawtransaction, false, true },
{ "checkwallet", &checkwallet, false, false },
{ "repairwallet", &repairwallet, false, false },
{ "makekeypair", &makekeypair, false, false },
{ "sendalert", &sendalert, false, false },
//
{ "createmultisig", &createmultisig, false, false },
{ "addnode", &addnode, false, false },
{ "getrawmempool", &getrawmempool, false, true },
{ "getrawchangeaddress", &getrawchangeaddress, false, false },
{ "listlockunspent", &listlockunspent, false, false },
{ "lockunspent", &lockunspent, false, false },
{ "gettxout", &gettxout, false, true },
{ "gettxoutsetinfo", &gettxoutsetinfo, false, true },
{ "vanitygen", &vanitygen, false, false }
{ "SuperNET", &SuperNET, false, true },
//{ "SuperNETb", &SuperNET, false, true },
{ "help", &help, true, false },
{ "stop", &stop, true, true },
{ "getbestblockhash", &getbestblockhash, true, true },
{ "getblockcount", &getblockcount, true, true },
{ "getconnectioncount", &getconnectioncount, true, true },
{ "getpeerinfo", &getpeerinfo, true, true },
{ "getinfo", &getinfo, true, true },
{ "getnewaddress", &getnewaddress, true, false },
{ "getnewpubkey", &makekeypair, true, false },
{ "getaccountaddress", &getaccountaddress, true, false },
{ "setaccount", &setaccount, true, false },
{ "getaccount", &getaccount, false, false },
{ "getaddressesbyaccount", &getaddressesbyaccount, true, false },
{ "sendtoaddress", &sendtoaddress, false, false },
{ "getreceivedbyaddress", &getreceivedbyaddress, false, false },
{ "getreceivedbyaccount", &getreceivedbyaccount, false, false },
{ "listreceivedbyaddress", &listreceivedbyaddress, false, false },
{ "listreceivedbyaccount", &listreceivedbyaccount, false, false },
{ "backupwallet", &backupwallet, true, false },
{ "walletpassphrase", &walletpassphrase, true, false },
{ "walletpassphrasechange", &walletpassphrasechange, false, false },
{ "walletlock", &walletlock, true, false },
{ "encryptwallet", &encryptwallet, false, false },
{ "validateaddress", &validateaddress, true, true },
{ "validatepubkey", &validatepubkey, true, true },
{ "getbalance", &getbalance, false, false },
{ "move", &movecmd, false, false },
{ "sendfrom", &sendfrom, false, false },
{ "sendmany", &sendmany, false, false },
{ "addmultisigaddress", &addmultisigaddress, false, false },
{ "getblock", &getblock, false, true },
{ "getblockhash", &getblockhash, false, true },
{ "gettransaction", &gettransaction, false, true },
{ "listtransactions", &listtransactions, false, false },
{ "listaddressgroupings", &listaddressgroupings, false, false },
{ "signmessage", &signmessage, false, false },
{ "verifymessage", &verifymessage, false, false },
{ "listaccounts", &listaccounts, false, false },
{ "settxfee", &settxfee, false, false },
{ "listsinceblock", &listsinceblock, false, false },
{ "dumpprivkey", &dumpprivkey, false, false },
{ "dumpwallet", &dumpwallet, true, false },
{ "importwallet", &importwallet, false, false },
{ "importprivkey", &importprivkey, false, false },
{ "listunspent", &listunspent, false, false },
{ "getrawtransaction", &getrawtransaction, false, false },
{ "createrawtransaction", &createrawtransaction, false, false },
{ "decoderawtransaction", &decoderawtransaction, false, true },
{ "decodescript", &decodescript, false, true },
{ "signrawtransaction", &signrawtransaction, false, false },
{ "sendrawtransaction", &sendrawtransaction, false, true },
{ "checkwallet", &checkwallet, false, false },
{ "repairwallet", &repairwallet, false, false },
{ "makekeypair", &makekeypair, false, false },
{ "sendalert", &sendalert, false, false },
//
{ "createmultisig", &createmultisig, false, false },
{ "addnode", &addnode, false, false },
{ "getrawmempool", &getrawmempool, false, true },
{ "getrawchangeaddress", &getrawchangeaddress, false, false },
{ "listlockunspent", &listlockunspent, false, false },
{ "lockunspent", &lockunspent, false, false },
{ "gettxout", &gettxout, false, true },
{ "gettxoutsetinfo", &gettxoutsetinfo, false, true },
{ "vanitygen", &vanitygen, false, false }
#ifdef PEGGY
//{ "peggytx", &peggytx, true, false },
//{ "peggypayments", &peggypayments, true, false },

7
iguana/main.c

@ -25,6 +25,13 @@
#include "SuperNET.h"
// ALL globals must be here!
char *Iguana_validcommands[] =
{
"SuperNET", "SuperNETb",
"version", "verack", "getaddr", "addr", "inv", "getdata", "notfound", "getblocks", "getheaders", "headers", "tx", "block", "mempool", "ping", "pong",
"reject", "filterload", "filteradd", "filterclear", "merkleblock", "alert", ""
};
struct iguana_info *Coins[IGUANA_MAXCOINS];
int32_t USE_JAY,FIRST_EXTERNAL,IGUANA_disableNXT,Debuglevel;
uint32_t prices777_NXTBLOCK,MAX_DEPTH = 100;

Loading…
Cancel
Save