jl777 8 years ago
parent
commit
b95b16d9ca
  1. 2
      iguana/dPoW.h
  2. 4
      iguana/dpow/dpow_fsm.c
  3. 2
      iguana/dpow/dpow_network.c
  4. 10
      iguana/dpow/dpow_tx.c
  5. 28
      iguana/iguana_notary.c
  6. 13
      iguana/notaries.h

2
iguana/dPoW.h

@ -19,7 +19,7 @@
#define DPOW_CHECKPOINTFREQ 10
#define DPOW_MINSIGS 7
#define DPOW_M(bp) ((bp)->minsigs) // (((bp)->numnotaries >> 1) + 1)
#define DPOW_MODSTART(bp) (((bp)->height / DPOW_CHECKPOINTFREQ) % (bp)->numnotaries)
#define DPOW_MODIND(bp,offset) (((((bp)->height / DPOW_CHECKPOINTFREQ) % (bp)->numnotaries) + (offset)) % (bp)->numnotaries)
#define DPOW_VERSION 0x0206
#define DPOW_UTXOSIZE 10000
#define DPOW_MINOUTPUT 6000

4
iguana/dpow/dpow_fsm.c

@ -81,7 +81,7 @@ void dpow_utxosync(struct supernet_info *myinfo,struct dpow_block *bp,uint64_t r
r = (rand() % bp->numnotaries);
for (j=0; j<DPOW_M(bp); j++)
{
i = ((bp->height % bp->numnotaries) + j + r) % bp->numnotaries;
i = DPOW_MODIND(bp,j+r);//((bp->height % bp->numnotaries) + j + r) % bp->numnotaries;
if ( ((1LL << i) & bp->recvmask) != 0 && ((1LL << i) & recvmask) == 0 )
break;
}
@ -268,7 +268,7 @@ int32_t dpow_update(struct supernet_info *myinfo,struct dpow_block *bp,uint32_t
sendutxo = 0;
for (i=0; i<bp->numnotaries; i++)
{
k = ((bp->height % bp->numnotaries) + i) % bp->numnotaries;
k = DPOW_MODIND(bp,i);//((bp->height % bp->numnotaries) + i) % bp->numnotaries;
if ( k == myind )
continue;
if ( ((1LL << k) & bp->recvmask) != 0 && (bp->notaries[k].recvmask & (1LL << myind)) == 0 )

2
iguana/dpow/dpow_network.c

@ -240,7 +240,7 @@ int32_t dpow_rwutxobuf(int32_t rwflag,uint8_t *data,struct dpow_utxoentry *up,st
for (i=0; i<33; i++)
up->pubkey[i] = data[len++];
numnotaries = data[len++];
if ( numnotaries == bp->numnotaries )
if ( numnotaries <= bp->numnotaries )
{
for (i=0; i<numnotaries; i++)
{

10
iguana/dpow/dpow_tx.c

@ -19,7 +19,7 @@ uint64_t dpow_lastk_mask(struct dpow_block *bp,int8_t *lastkp)
*lastkp = -1;
for (j=m=0; j<bp->numnotaries; j++)
{
k = ((bp->height % bp->numnotaries) + j) % bp->numnotaries;
k = DPOW_MODIND(bp,j);//((bp->height % bp->numnotaries) + j) % bp->numnotaries;
if ( bits256_nonz(bp->notaries[k].src.prev_hash) != 0 && bits256_nonz(bp->notaries[k].dest.prev_hash) != 0 )
{
bp->recvmask |= (1LL << k);
@ -50,7 +50,7 @@ uint64_t dpow_maskmin(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp)
int32_t j,m,k; uint64_t mask = 0;
for (j=m=0; j<bp->numnotaries; j++)
{
k = ((bp->height % bp->numnotaries) + j) % bp->numnotaries;
k = DPOW_MODIND(bp,j);//((bp->height % bp->numnotaries) + j) % bp->numnotaries;
if ( bits256_nonz(bp->notaries[k].src.prev_hash) != 0 && bits256_nonz(bp->notaries[k].dest.prev_hash) != 0 )
{
mask |= (1LL << k);
@ -142,7 +142,7 @@ bits256 dpow_notarytx(char *signedtx,int32_t *numsigsp,int32_t isPoS,struct dpow
len += iguana_rwvarint32(1,&serialized[len],(uint32_t *)&m);
for (j=m=0; j<bp->numnotaries; j++)
{
k = ((bp->height % bp->numnotaries) + j) % bp->numnotaries;
k = DPOW_MODIND(bp,j);//((bp->height % bp->numnotaries) + j) % bp->numnotaries;
if ( ((1LL << k) & bestmask) != 0 )
{
ep = &bp->notaries[k];
@ -193,7 +193,7 @@ cJSON *dpow_vins(struct iguana_info *coin,struct dpow_block *bp,int8_t bestk,uin
vins = cJSON_CreateArray();
for (j=0; j<bp->numnotaries; j++)
{
k = ((bp->height % bp->numnotaries) + j) % bp->numnotaries;
k = DPOW_MODIND(bp,j);//((bp->height % bp->numnotaries) + j) % bp->numnotaries;
if ( ((1LL << k) & bestmask) != 0 )
{
ep = &bp->notaries[k];
@ -245,7 +245,7 @@ void dpow_rawtxsign(struct supernet_info *myinfo,struct iguana_info *coin,struct
item = jitem(vin,j);
if ( (sobj= jobj(item,"scriptSig")) != 0 && (sigstr= jstr(sobj,"hex")) != 0 && strlen(sigstr) > 32 )
{
printf("%s height.%d mod.%d VINI.%d myind.%d MINE.(%s) j.%d\n",(src_or_dest != 0) ? bp->destcoin->symbol : bp->srccoin->symbol,bp->height,bp->height%bp->numnotaries,j,myind,jprint(item,0),j);
printf("%s height.%d mod.%d VINI.%d myind.%d MINE.(%s) j.%d\n",(src_or_dest != 0) ? bp->destcoin->symbol : bp->srccoin->symbol,bp->height,DPOW_MODIND(bp,0),j,myind,jprint(item,0),j);
cp->siglens[bestk] = (int32_t)strlen(sigstr) >> 1;
if ( src_or_dest != 0 )
bp->destsigsmasks[bestk] |= (1LL << myind);

28
iguana/iguana_notary.c

@ -15,13 +15,13 @@
// Todo list:
// a) detection of special transactions to update list of current notaries
// a) update list of current notaries
// b) use HDD storage of data
// b) award 5% APR for utxo older than a week when they are spent
// c) round robin mining difficulty
// d) investigate if rebroadcast reorged local chain notary tx and scanning mempool is needed
// c) award 5% APR for utxo older than a week when they are spent
// d) round robin mining difficulty
//>>>>>>>> decode_hex n.71 hex[0] (d) -> 13 hex.(d968f6be7b5f0ac7882728291deebb956198aecf126cc353c3b98507791a3203f0780000b23a68302f44979405dc281f2f659536c60ccf95b602ab9991a8f8c966d70e624b4d44?) [n*2+1: 0] [n*2: -64 ?] len.143
// q) investigate if rebroadcast reorged local chain notary tx and scanning mempool is needed
#define CHECKSIG 0xac
@ -169,6 +169,18 @@ void iguana_dPoWupdate(struct supernet_info *myinfo)
} else printf("iguana_dPoWupdate missing src.(%s) %p or dest.(%s) %p\n",dp->symbol,src,dp->dest,dest);
}
void dpow_addresses()
{
int32_t i; char coinaddr[64]; uint8_t pubkey[33];
for (i=0; i<sizeof(Notaries)/sizeof(*Notaries); i++)
{
decode_hex(pubkey,33,Notaries[i][1]);
bitcoin_address(coinaddr,60,pubkey,33);
printf("%s ",coinaddr);
}
printf("Numnotaries.%d\n",i);
}
#include "../includes/iguana_apidefs.h"
TWO_STRINGS(iguana,dpow,symbol,pubkey)
@ -247,6 +259,12 @@ TWO_STRINGS(komodo,passthru,function,hex)
STRING_ARG(iguana,addnotary,ipaddr)
{
static int32_t didinit;
if ( didinit == 0 )
{
dpow_addresses();
didinit = 1;
}
printf("addnotary (%s) -> (%s)\n",ipaddr,myinfo->ipaddr);
dpow_nanomsginit(myinfo,ipaddr);
return(clonestr("{\"result\":\"notary node added\"}"));

13
iguana/notaries.h

@ -37,10 +37,11 @@ char *Notaries[][2] =
{ "titomane_EU", "03517fcac101fed480ae4f2caf775560065957930d8c1facc83e30077e45bdd199" },
{ "supernet_AE", "029d93ef78197dc93892d2a30e5a54865f41e0ca3ab7eb8e3dcbc59c8756b6e355" },
{ "supernet_EU", "02061c6278b91fd4ac5cab4401100ffa3b2d5a277e8f71db23401cc071b3665546" },
{ "supernet_NA", "033c073366152b6b01535e15dd966a3a8039169584d06e27d92a69889b720d44e1" },
{ "yassin_EU", "033fb7231bb66484081952890d9a03f91164fb27d392d9152ec41336b71b15fbd0" },
{ "durerus_EU", "02bcbd287670bdca2c31e5d50130adb5dea1b53198f18abeec7211825f47485d57" },
{ "badass_SH", "026b49dd3923b78a592c1b475f208e23698d3f085c4c3b4906a59faf659fd9530b" },
{ "baddass_NA" "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" },
{ "baddass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" },
{ "pondsea_NA", "031bcfdbb62268e2ff8dfffeb9ddff7fe95fca46778c77eebff9c3829dfa1bb411" },
{ "rnr_EU", "0287aa4b73988ba26cf6565d815786caf0d2c4af704d7883d163ee89cd9977edec" },
{ "crackers_SH", "02313d72f9a16055737e14cfc528dcd5d0ef094cfce23d0348fe974b6b1a32e5f0" },
@ -82,4 +83,14 @@ char *Notaries[][2] =
{ "Server30","022ab58e8ee541952f9f992890335097fa18479b5f66ad5f1f4a0e8f60959f3d19"},*/
};
// RNJmgYaFF5DbnrNUX6pMYz9rcnDKC2tuAc RDhEGYScNQYetCyG75Kf8Fg61UWPdwc1C5 RVKtRKozg8RKvEYCumMD43fCU6f212M5RD RDW8EDkCkzQ1LA4xbVUoAERsBVhhYRLXCr RREc88bQzxHCvzqErPDnTQH2Qg5yUtjbyp RJKWU7f77YVUHBgrfcTGHje26k7pfkkU3t RLVwuTM5TitV4Gk79Rja731RwYkAzz7GWn RNZKqUgoAPwWd7wNtuSKP7k1HSJAyPeH4N RVxtoUT9CXbC1LdhztNAf9yR5ySnFnSPQh RAxQTHdsy89tfSXwoce2sHeWrYXmDsMXQq RLNJ873AQ8Cnr8UfhRm9SXiVDaphoa4JTo RCA8H1npFPW5pnJRzycF8tFEJmn6XZhD4j RP4FSezvuXsBpfxj5sByJDneFB3XC9yNe5 RXqdRmv7n9hygf9C7f7vj4VQyNR9RvzXss RGosMyyAo573NrBdqUiQYQDsnV6kyY2oiq RDYsrWBZkYSWhRDupGRrfGqrVnFtK9hJGC RTw3vi3dGa9n8LLbKvk7jDAwLdt3A5ET7a RDY9LJZTEJ9FsvugUuD69gceA98uqan5XL R9tjkpdNbzw6mNfxorb5bvTPmsuon5aLrC R9Wtb6jReE9GrePGkCHzuyxD3hTTrnMcGY RRvaVyKS59NJWhPp8Pn7mVPGhMuhJJXrdh RSHdRnHHGdPtVej7fiehHBQ6dyTbEM1GHi RD6GgnrMpPaTSMn8vai6yiGA7mN4QGPVMY RJ9wAk3ZNrFwdso1RVbwASiqqQaDNyKjd2 RHPGxpiwRHP4dKZXjYPdpon1nCto7qVE8s RT2k2voy9n8jwppeTTJMQAhvaqA9pc9jHh RPJjzoKPb8idoUCT9XLBkNojNgysjJ5qrE RE3P8D8rcWZBeKmT8DURPdezW87MU5Ho3F RQeuhk4KcPM3F5hefwTBWezDdcktSGQQSq RFHRWQ5pAXNfmudHfxdxw3Wo8yFGoeDn6z RHASfhhM6bvDFakRDqkzA2wc3V4R4oNmXi RFssbc211PJdVy1bvcvAG5X2N4ovPAoy5o Numnotaries.32
/*RHASfhhM6bvDFakRDqkzA2wc3V4R4oNmXi c3a2395a3bb498ff684fd6730c205c691056364edaa71e70b1d74203bc52b57d
RDhEGYScNQYetCyG75Kf8Fg61UWPdwc1C5 ae2af56ca7f6cd178379a3c552c3681c99eba797b01f535ff1a743ca09485dea
RVKtRKozg8RKvEYCumMD43fCU6f212M5RD ade9979549cf703c6e997934f6116debe0ea2d5dd4f51665d9dfbef1fcc7d08a
RREc88bQzxHCvzqErPDnTQH2Qg5yUtjbyp b1269e90a052b3d3b5a2fc35cb7385e72bb36b2633ca824eb45291bc10d96795
RCA8H1npFPW5pnJRzycF8tFEJmn6XZhD4j aec351cea264ff7411a32554edbd75df76bb47dbbf038fdc150284e325b319a7
RJ9wAk3ZNrFwdso1RVbwASiqqQaDNyKjd2 a075c4800c538000be07eb25b4b521caa54c807385b932b790feba410c74b2aa
RHPGxpiwRHP4dKZXjYPdpon1nCto7qVE8s a036d9a442cb3275ca2f017fea4330c89619ea113820aff720d5f5ad0c9755e9*/
#endif

Loading…
Cancel
Save