Browse Source

Merge pull request #481 from jl777/spvdex

fix windows compiling, reduce memory usage, increase network capacity
etomic
jl777 7 years ago
committed by GitHub
parent
commit
957ee8d36d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      iguana/exchanges/LP_commands.c
  2. 4
      iguana/exchanges/LP_nativeDEX.c
  3. 2
      iguana/exchanges/LP_ordermatch.c
  4. 4
      iguana/exchanges/LP_prices.c
  5. 5
      iguana/exchanges/LP_signatures.c
  6. 2
      iguana/exchanges/stats.c
  7. 8
      marketmaker.vcxproj
  8. 35
      marketmaker_build_32_64.cmd

4
iguana/exchanges/LP_commands.c

@ -36,7 +36,9 @@ char *stats_JSON(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,char *r
{
char *method,*userpass,*base,*rel,*coin,*retstr = 0; int32_t changed,flag = 0; cJSON *retjson,*reqjson = 0; struct iguana_info *ptr;
method = jstr(argjson,"method");
//printf("stats_JSON %s\n",method);
if ( method != 0 && (strcmp(method,"addr_unspents") == 0 || strcmp(method,"uitem") == 0 || strcmp(method,"postutxos") == 0) )
return(0);
//printf("stats_JSON %s\n",method);
/*if ( (ipaddr= jstr(argjson,"ipaddr")) != 0 && (argport= juint(argjson,"port")) != 0 && (method == 0 || strcmp(method,"electrum") != 0) )
{
if ( strcmp(ipaddr,"127.0.0.1") != 0 && argport >= 1000 )

4
iguana/exchanges/LP_nativeDEX.c

@ -1043,7 +1043,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
printf("error launching LP_reserved_msgs for (%s)\n",myipaddr);
exit(-1);
}
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)utxosQ_loop,(void *)myipaddr) != 0 )
if ( 0 && OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)utxosQ_loop,(void *)myipaddr) != 0 )
{
printf("error launching utxosQ_loop for (%s)\n",myipaddr);
exit(-1);
@ -1237,7 +1237,7 @@ void LP_free(void *ptr)
static uint32_t lasttime,unknown; static int64_t lasttotal;
free(ptr); return;
uint32_t now; char str[65]; int32_t n,lagging; uint64_t total = 0; struct LP_memory_list *mp,*tmp;
if ( (now= (uint32_t)time(NULL)) > lasttime+6 )
if ( (now= (uint32_t)time(NULL)) > lasttime+1 )
{
n = lagging = 0;
DL_FOREACH_SAFE(LP_memory_list,mp,tmp)

2
iguana/exchanges/LP_ordermatch.c

@ -1046,7 +1046,7 @@ struct LP_utxoinfo *LP_buyutxo(double *ordermatchpricep,int64_t *bestsatoshisp,i
{
bitcoin_address(coinaddr,basecoin->taddr,basecoin->pubtype,pubp->rmd160,sizeof(pubp->rmd160));
asatoshis = autxo->S.satoshis;
LP_listunspent_query(base,coinaddr);
//LP_listunspent_query(base,coinaddr);
for (j=0; j<maxiters; j++)
{
if ( (bestutxo= LP_ordermatch_iter(utxos,max,ordermatchpricep,bestsatoshisp,bestdestsatoshisp,basecoin,coinaddr,asatoshis,maxprice*.999,txfee,desttxfee,pubp->pubkey,gui)) != 0 )

4
iguana/exchanges/LP_prices.c

@ -818,7 +818,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration)
{
//printf("bid ping %s %s\n",rel,bids[i]->coinaddr);
LP_address(relcoin,bids[i]->coinaddr);
if ( relcoin->electrum == 0 )
if ( 0 && relcoin->electrum == 0 )
{
LP_listunspent_issue(rel,bids[i]->coinaddr,0);
//else if ( (tmpjson= LP_listunspent(rel,bids[i]->coinaddr)) != 0 )
@ -842,7 +842,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration)
{
//printf("ask ping %s %s\n",base,asks[i]->coinaddr);
LP_address(basecoin,asks[i]->coinaddr);
if ( basecoin->electrum == 0 )
if ( 0 && basecoin->electrum == 0 )
{
LP_listunspent_issue(base,asks[i]->coinaddr,0);
//else if ( (tmpjson= LP_listunspent(base,asks[i]->coinaddr)) != 0 )

5
iguana/exchanges/LP_signatures.c

@ -330,6 +330,7 @@ int32_t LP_utxos_sigadd(cJSON *item,uint32_t timestamp,bits256 priv,uint8_t *pub
void LP_postutxos(char *symbol,char *coinaddr)
{
bits256 zero; uint32_t timestamp; bits256 utxoshash; char pubsecpstr[67]; struct iguana_info *coin; cJSON *array,*reqjson = cJSON_CreateObject();
return;
if ( (coin= LP_coinfind(symbol)) != 0 && (array= LP_address_utxos(coin,coinaddr,1)) != 0 )
{
//printf("LP_postutxos pubsock.%d %s %s\n",pubsock,symbol,coin->smartaddr);
@ -362,6 +363,7 @@ struct LP_utxos_qitem { struct queueitem DL; cJSON *argjson; };
char *LP_postutxos_recv(cJSON *argjson)
{
struct LP_utxos_qitem *uitem; struct iguana_info *coin; char *coinaddr,*symbol; bits256 utxoshash,pubkey; cJSON *obj; struct LP_pubkeyinfo *pubp;
printf("LP_postutxos_recv deprecated\n");
pubkey = jbits256(argjson,"pubkey");
pubp = LP_pubkeyfind(pubkey);
if ( pubp != 0 && pubp->numerrors > LP_MAXPUBKEY_ERRORS )
@ -616,7 +618,7 @@ char *LP_notify_recv(cJSON *argjson)
void LP_smartutxos_push(struct iguana_info *coin)
{
uint64_t value; bits256 zero,txid; int32_t i,vout,height,n; cJSON *array,*item,*req;
return;
return;
if ( coin->smartaddr[0] == 0 )
return;
//LP_notify_pubkeys(coin->ctx,LP_mypubsock);
@ -652,6 +654,7 @@ void LP_smartutxos_push(struct iguana_info *coin)
char *LP_uitem_recv(cJSON *argjson)
{
bits256 txid; int32_t vout,height; uint64_t value; struct iguana_info *coin; char *coinaddr,*symbol;
printf("LP_uitem_recv deprecated\n");
txid = jbits256(argjson,"txid");
vout = jint(argjson,"vout");
height = jint(argjson,"ht");

2
iguana/exchanges/stats.c

@ -32,7 +32,7 @@ char *stats_JSON(void *ctx,char *myipaddr,int32_t mypubsock,cJSON *argjson,char
char *stats_validmethods[] =
{
"psock", "getprices", "listunspent", "notify", "getpeers", "uitem", // from issue_
"psock", "getprices", "notify", "getpeers", // from issue_ "uitem", "listunspent",
"orderbook", "help", "getcoins", "pricearray", "balance", "tradestatus"
};

8
marketmaker.vcxproj

@ -87,7 +87,7 @@
<WarningLevel>Level2</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NATIVE_WINDOWS;WIN32;_DEBUG;_CONSOLE;IGUANA_LOG2PACKETSIZE=20;IGUANA_MAXPACKETSIZE=1572864;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<StructMemberAlignment>8Bytes</StructMemberAlignment>
<AdditionalIncludeDirectories>.\iguana;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@ -104,7 +104,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;NATIVE_WINDOWS;WIN32;IGUANA_LOG2PACKETSIZE=20;IGUANA_MAXPACKETSIZE=1572864;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<StructMemberAlignment>8Bytes</StructMemberAlignment>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -122,7 +122,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NATIVE_WINDOWS;WIN32;_CONSOLE;NDEBUG;IGUANA_LOG2PACKETSIZE=20;IGUANA_MAXPACKETSIZE=1572864;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<StructMemberAlignment>8Bytes</StructMemberAlignment>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
@ -142,7 +142,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN64;_WIN64;_CRT_SECURE_NO_WARNINGS;NATIVE_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;_CONSOLE;NDEBUG;IGUANA_LOG2PACKETSIZE=20;IGUANA_MAXPACKETSIZE=1572864;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<StructMemberAlignment>8Bytes</StructMemberAlignment>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>

35
marketmaker_build_32_64.cmd

@ -32,6 +32,39 @@ rem MSBuild /help
MSBuild marketmaker.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64
MSBuild marketmaker.sln /t:Rebuild /p:Configuration=Release /p:Platform=x86
rem Obtain version number and latest git commit number
FOR /F "tokens=* USEBACKQ" %%F IN (`find /i "LP_MAJOR_VERSION" "iguana\exchanges\LP_include.h"`) DO (
SET LP_MAJOR_VERSION_STR=%%F
)
FOR /F "tokens=* USEBACKQ" %%F IN (`find /i "LP_MINOR_VERSION" "iguana\exchanges\LP_include.h"`) DO (
SET LP_MINOR_VERSION_STR=%%F
)
FOR /F "tokens=* USEBACKQ" %%F IN (`find /i "LP_BUILD_NUMBER" "iguana\exchanges\LP_include.h"`) DO (
SET LP_BUILD_NUMBER_STR=%%F
)
for /f delims^=^"^ tokens^=2 %%a in ('echo %LP_MAJOR_VERSION_STR%') do (
set LP_MAJOR_VERSION=%%a
)
for /f delims^=^"^ tokens^=2 %%a in ('echo %LP_MINOR_VERSION_STR%') do (
set LP_MINOR_VERSION=%%a
)
for /f delims^=^"^ tokens^=2 %%a in ('echo %LP_BUILD_NUMBER_STR%') do (
set LP_BUILD_NUMBER=%%a
)
rem Check if git command exist and if does - receive latest GIT_COMMIT
git --version >nul 2>&1 && (
for /f "tokens=1" %%a in ('git rev-parse --short HEAD') do (
set GIT_COMMIT=_%%a
)
) || (
set GIT_COMMIT=
)
rem echo Marketmaker_%LP_MAJOR_VERSION%.%LP_MINOR_VERSION%_%LP_BUILD_NUMBER%%GIT_COMMIT%
rem Using to add in marketmaker_release.7z
set host=%COMPUTERNAME%
IF "%host%"=="VM-81" (
@ -39,9 +72,11 @@ IF "%host%"=="VM-81" (
mkdir package_content\win64
copy /y Release\marketmaker.exe package_content\win32
copy /y x64\Release\marketmaker.exe package_content\win64
echo Marketmaker_%LP_MAJOR_VERSION%.%LP_MINOR_VERSION%_%LP_BUILD_NUMBER%%GIT_COMMIT% > package_content\version.txt
cd package_content
"C:\Program Files\7-Zip\7z.exe" a C:\komodo\marketmaker_release\marketmaker_release.7z win32\marketmaker.exe
"C:\Program Files\7-Zip\7z.exe" a C:\komodo\marketmaker_release\marketmaker_release.7z win64\marketmaker.exe
"C:\Program Files\7-Zip\7z.exe" a C:\komodo\marketmaker_release\marketmaker_release.7z version.txt
cd ..
rd package_content /s /q
)

Loading…
Cancel
Save