Browse Source

Merge branch 'dev' of https://github.com/jl777/SuperNET into blackjok3r

fix
blackjok3r
blackjok3r 6 years ago
parent
commit
fc6a6a5105
  1. 3
      basilisk/basilisk_bitcoin.c
  2. 1
      iguana/dPoW.h
  3. 2
      iguana/dpow/dpow_fsm.c
  4. 28
      iguana/dpow/dpow_rpc.c
  5. 59
      iguana/exchanges/LP_transaction.c
  6. 2
      iguana/m_mm
  7. 1
      iguana/m_notary_run
  8. 2
      iguana/m_unix

3
basilisk/basilisk_bitcoin.c

@ -591,9 +591,6 @@ char *iguana_utxoduplicates(struct supernet_info *myinfo,struct iguana_info *coi
bitcoin_address(changeaddr, coin->chain->pubtype, myinfo->persistent_pubkey33, 33); bitcoin_address(changeaddr, coin->chain->pubtype, myinfo->persistent_pubkey33, 33);
txfee = (coin->txfee + duplicates*coin->txfee/10); txfee = (coin->txfee + duplicates*coin->txfee/10);
if (strcmp(coin->symbol, "GAME") == 0 || strcmp(coin->symbol, "EMC2") == 0)
printf("%s txfee %.8f\n", coin->symbol, dstr(txfee));
uint32_t txversion = 1; // txversion = 1 for non-overwintered and non-sapling coins uint32_t txversion = 1; // txversion = 1 for non-overwintered and non-sapling coins
if (coin->sapling != 0) if (coin->sapling != 0)
txversion = 4; txversion = 4;

1
iguana/dPoW.h

@ -172,6 +172,7 @@ 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,char *srccoin); int32_t dpow_haveutxo(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,char *coinaddr,char *srccoin);
void komodo_assetcoins(int32_t fullnode,uint64_t mask); void komodo_assetcoins(int32_t fullnode,uint64_t mask);
int32_t iguana_isnotarychain(char *symbol); int32_t iguana_isnotarychain(char *symbol);
int32_t dpow_smallopreturn(char *symbol);
cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin); cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin);
cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid); cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid);

2
iguana/dpow/dpow_fsm.c

@ -235,7 +235,7 @@ bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct igu
bits256 MoM; cJSON *MoMjson,*infojson; int32_t prevMoMheight; bits256 MoM; cJSON *MoMjson,*infojson; int32_t prevMoMheight;
*MoMdepthp = 0; *MoMdepthp = 0;
memset(MoM.bytes,0,sizeof(MoM)); memset(MoM.bytes,0,sizeof(MoM));
if ( strcmp(coin->symbol,"GAME") == 0 || strcmp(coin->symbol,"HUSH") == 0 || strcmp(coin->symbol,"EMC2") == 0 ) // 80 byte OP_RETURN limit if ( dpow_smallopreturn(coin->symbol) != 0 ) // 80 byte OP_RETURN limit
return(MoM); return(MoM);
if ( (infojson= dpow_getinfo(myinfo,coin)) != 0 ) if ( (infojson= dpow_getinfo(myinfo,coin)) != 0 )
{ {

28
iguana/dpow/dpow_rpc.c

@ -22,6 +22,20 @@ uint64_t dpow_utxosize(char *symbol)
else return(10000); else return(10000);
} }
int32_t dpow_smallopreturn(char *symbol)
{
if ( strcmp(symbol,"GAME") == 0 || strcmp(symbol,"EMC2") == 0 || strcmp(symbol,"HUSH") == 0 )
return(1);
else return(0);
}
int32_t dpow_is015(char *symbol)
{
if ( strcmp("CHIPS",symbol) == 0 || strcmp("GAME",symbol) == 0 || strcmp("EMC2",symbol) == 0 ) //strcmp("BTC",symbol) == 0 ||
return(1);
else return(0);
}
char *bitcoind_getinfo(char *symbol,char *serverport,char *userpass,char *getinfostr) char *bitcoind_getinfo(char *symbol,char *serverport,char *userpass,char *getinfostr)
{ {
char buf[1],*retstr; cJSON *retjson; char buf[1],*retstr; cJSON *retjson;
@ -279,16 +293,17 @@ cJSON *dpow_MoMoMdata(struct iguana_info *coin,char *symbol,int32_t kmdheight,ui
return(retjson); return(retjson);
} }
int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,uint16_t CCid,int32_t src_or_dest,struct dpow_block *bp) int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,uint16_t CCid,int32_t src_or_dest,struct dpow_block *bp)
{ {
struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson,*infojson; int32_t kmdheight=0,hexlen=0,n=0; uint32_t paxwdcrc; struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson,*infojson; int32_t kmdheight=0,hexlen=0,n=0; uint32_t paxwdcrc;
paxwdcrc = 0; paxwdcrc = 0;
if ( strcmp(bp->srccoin->symbol,"GAME") != 0 || strcmp(bp->srccoin->symbol,"EMC2") != 0 || src_or_dest != 0 ) if ( dpow_smallopreturn(bp->srccoin->symbol) == 0 || src_or_dest != 0 )
{ {
n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes); n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes);
MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16);
n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth);
if ( strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) if ( src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) //strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 &&
{ {
kmdcoin = bp->destcoin; kmdcoin = bp->destcoin;
if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 )
@ -301,7 +316,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz
if ( (hexstr= jstr(retjson,"data")) != 0 && (hexlen= (int32_t)strlen(hexstr)) > 0 && n+hexlen/2 <= hexsize ) if ( (hexstr= jstr(retjson,"data")) != 0 && (hexlen= (int32_t)strlen(hexstr)) > 0 && n+hexlen/2 <= hexsize )
{ {
hexlen >>= 1; hexlen >>= 1;
printf("add MoMoMdata.(%s)\n",hexstr); //printf("add MoMoMdata.(%s)\n",hexstr);
decode_hex(&hex[n],hexlen,hexstr), n += hexlen; decode_hex(&hex[n],hexlen,hexstr), n += hexlen;
} }
free_json(retjson); free_json(retjson);
@ -430,13 +445,6 @@ cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits2
return(json); return(json);
} }
int32_t dpow_is015(char *symbol)
{
if ( strcmp("CHIPS",symbol) == 0 || strcmp("GAME",symbol) == 0 || strcmp("EMC2",symbol) == 0 ) //strcmp("BTC",symbol) == 0 ||
return(1);
else return(0);
}
char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address) char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address)
{ {
char buf[128],*retstr=0; cJSON *retjson; char buf[128],*retstr=0; cJSON *retjson;

59
iguana/exchanges/LP_transaction.c

@ -1660,6 +1660,65 @@ char *LP_createblasttransaction(uint64_t *changep,int32_t *changeoutp,cJSON **tx
txobj = bitcoin_txoutput(txobj,script,scriptlen,change); txobj = bitcoin_txoutput(txobj,script,scriptlen,change);
*changeoutp = numvouts; *changeoutp = numvouts;
} }
int32_t origspendlen; char *passphrase = 0,*opretstr = "deadbeef";
if ( opretstr != 0 )
{
spendlen = (int32_t)strlen(opretstr) >> 1;
if ( spendlen < sizeof(script)-60 )
{
if ( passphrase != 0 && passphrase[0] != 0 )
{
decode_hex(data,spendlen,opretstr);
offset = 2 + (spendlen >= 16);
origspendlen = spendlen;
crc32 = calc_crc32(0,data,spendlen);
spendlen = LP_opreturn_encrypt(&script[offset],(int32_t)sizeof(script)-offset,data,spendlen,passphrase,crc32&0xffff);
if ( spendlen < 0 )
{
printf("error encrpting opreturn data\n");
free_json(txobj);
return(0);
}
} else offset = crc32 = 0;
len = 0;
script[len++] = SCRIPT_OP_RETURN;
if ( spendlen < 76 )
script[len++] = spendlen;
else if ( spendlen <= 0xff )
{
script[len++] = 0x4c;
script[len++] = spendlen;
}
else if ( spendlen <= 0xffff )
{
script[len++] = 0x4d;
script[len++] = (spendlen & 0xff);
script[len++] = ((spendlen >> 8) & 0xff);
}
if ( passphrase != 0 && passphrase[0] != 0 )
{
if ( offset != len )
{
printf("offset.%d vs len.%d, reencrypt\n",offset,len);
spendlen = LP_opreturn_encrypt(&script[len],(int32_t)sizeof(script)-len,data,origspendlen,passphrase,crc32&0xffff);
if ( spendlen < 0 )
{
printf("error encrpting opreturn data\n");
free_json(txobj);
return(0);
}
} //else printf("offset.%d already in right place\n",offset);
} else decode_hex(&script[len],spendlen,opretstr);
txobj = bitcoin_txoutput(txobj,script,len + spendlen,0);
//printf("OP_RETURN.[%d, %d] script.(%s)\n",len,spendlen,opretstr);
}
else
{
printf("custom script.%d too long %d\n",i,spendlen);
free_json(txobj);
return(0);
}
}
if ( (rawtxbytes= bitcoin_json2hex(coin->symbol,coin->isPoS,&txid,txobj,V)) == 0 ) if ( (rawtxbytes= bitcoin_json2hex(coin->symbol,coin->isPoS,&txid,txobj,V)) == 0 )
fprintf(stderr,"LP_createblasttransaction: error making rawtx suppress.%d\n",suppress_pubkeys); fprintf(stderr,"LP_createblasttransaction: error making rawtx suppress.%d\n",suppress_pubkeys);
*txobjp = txobj; *txobjp = txobj;

2
iguana/m_mm

@ -11,4 +11,4 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
fi fi
rm marketmaker rm marketmaker
gcc -g -o marketmaker -DNOTETOMIC -I../crypto777 exchanges/mm.c ../crypto777/cJSON.c mini-gmp.c keccak.c groestl.c segwit_addr.c secp256k1.o ../agents/libcrypto777.a $nanomsg_lib -lcurl -lpthread -lm gcc -g -o marketmaker -DNOTETOMIC -I../crypto777 exchanges/mm.c ../crypto777/cJSON.c mini-gmp.c keccak.c groestl.c segwit_addr.c secp256k1.o ../agents/libcrypto777.a $nanomsg_lib -lcurl -lpthread -lm -lsodium

1
iguana/m_notary_run

@ -103,6 +103,7 @@ coins/mgnx_7776
coins/pgt_7776 coins/pgt_7776
coins/kmdice_7776 coins/kmdice_7776
coins/dion_7776 coins/dion_7776
coins/zex_7776
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"passthru\",\"method\":\"paxfiats\",\"timeout\":900000}" #curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"passthru\",\"method\":\"paxfiats\",\"timeout\":900000}"

2
iguana/m_unix

@ -9,4 +9,4 @@ cd secp256k1; ./m_unix; cd ..
cd ../crypto777; ./m_unix; cd ../iguana cd ../crypto777; ./m_unix; cd ../iguana
gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c
gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c
gcc -g -o ../agents/iguana *.o ../agents/libcrypto777.a -lpthread -lm -lnanomsg -lcurl gcc -g -o ../agents/iguana *.o ../agents/libcrypto777.a -lpthread -lm -lnanomsg -lcurl -lsodium

Loading…
Cancel
Save