Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
99451493e3
  1. 36
      iguana/confs/BTCD_hdrs.txt
  2. 9
      iguana/confs/BTC_hdrs.txt
  3. 82
      iguana/iguana_realtime.c
  4. 25
      includes/iguana_structs.h

36
iguana/confs/BTCD_hdrs.txt

@ -1,4 +1,4 @@
1235503
1251510
0 0000044966f40703b516c5af180582d53f783bfd319bb045e2dc3e05ea695d46 a5d211145f8e6ba0920b2893d307c5d7c207ae0800a80955299678d1706ea8ac 000000000c4682089c916de89eb080a877566494d4009c0089baf35fe94de22f
500 000000000680a9a697eb71155b18a5827e0889fca28afb81fcbb46469ed7877e 79f80a8f54c6762d6408347c6dd7dfd2f8b8c191077c1d7881dfc5b7ec6a408e 0000000002b868fe717dc60b8d146de4d9aecf779b7314224908566e01847769
1000 0000000000000cf908c887020f8970b7fe952f8b81164d83a87621dfdb581d08 3356ec4296ff2f04281492b0dedbaed80edeb6dd9170b87230ff79f6b0daade7 0000000000001e7c6d28962a03b3d75ffa1355ecc6d3021893b2727a1ccfc669
@ -2470,4 +2470,36 @@
1234000 cb6e218e6b06db72e9ebd1a779c6fbda5c8967d527731d8e5ab48676aa9a1d97 27d02fde617293d42a4de35098f148deefd85340bb2b038a2ba17602eb26fa41 db87890c8ffa7bbf7c093729078598d598ad11b73a393bae34836641a393ba5b
1234500 5b0df15f60febb52c49aba4936bf83f9bdd2654d4ff883ae326c081fa7b3fa8c 802c5a78bd41f37f08ed7c395023a4661d743d59f98c6b7afeb231716fad6829 3b035a4d24d0cbdf71c38dfd81423d32d8cbfcea642da34d64aed0855044824d
1235000 48f8a254d98836c4d8559df0ff42f13c8b62ea04052381bf411cf47b99900884 d59adf1c51d0d1f8b261320e990593686f75c1f8f2f405758179b058946873a2 d83461b796e705769281bb9e53d7b7c951f9073a399cde0c567aa9916456a534
1235500 eb8ac12b006d0cfc692173d0a970260435c7c7ac1e67bc54807345a13f7557fe
1235500 eb8ac12b006d0cfc692173d0a970260435c7c7ac1e67bc54807345a13f7557fe 1e716e5508018cddde941f3079be2608509a9e319684ef8144245f613ff46713 6db77cbcf3e70b684552735f0ba034057ca13ad7cfcb8d698eb9e4f5a188060c
1236000 524ce04d135aa08543baa6052549f6736395eda2ab3b5d8fe5fab430c014562a f1ad0c14cb9cdea0f4cd5847d1c256cae712d24621a29afec0f54677c1510706 d2371119849dec5a03d380b18a65b43981676db7a59ab13f989991317cc0ec12
1236500 88275a75fc986491ce9dd6d2cb83243060e61d6c4e81ebe7e7c7643fb8bab0f1 2a73a779cade5defd59863657468f9985adabf08572a23192060672b14e2de75 4e2f3e795940126c02e8a0479561df998e82ae5ac4839f07f28d130e9a32adbf
1237000 4b99f3d475c781dc2caac67ffab7c53d84dbeff79678922694955a9854590018 554600aac19287681afe0e9765da07a02f1a1aa493dfd43addd9f31edb78e875 e60302e3377c7fc2b9109912f015bbe23b4b2ac8ad628c7d6e3837ac71f7b1a5
1237500 73c09a49ed9f47f700d4554cd0a94c1b01b802a3cb3c61946c74d40a443540ff 1775952f2d8dc63bcc08ea478fd4714838a31f7f683a8b83d5d26435b8b3b6c3 59f24ceb689173661dfaa9bf80b396831d5e7dcde15bf806ed7160f75a988274
1238000 29489c531b3419cea99dddefb9b19111f5baa184f287ebddb3e760a2663014d1 dce39dcb5a1a2d072fc999d3f662bcfb16685cb8922386cccba187b68b6d5947 32dcdcfc9c0d815a79435b769a35954dc71df347a2ac1a810929f765c39218bc
1238500 c0555685b80e5d5d0f53434a8ae44eadc953dced274ceadc80de36c44078283f 16dbb1b2bbd5d13aee22743ed27c7dc4dbf1dbb221cb45325d188889d6101dd8 c44cb9916bdb7e6c7dfa417da3be72bd5987cf345024ebfa68402bf3f3994189
1239000 a3f94a2821165fb910806ff75928c5255a4358b5062288571e00e6646abc5203 175a8f872f777325f2444b94ccd55602b3bd8204733f86af40713fb0a0474106 c637a21fdda667d21d172bdeedd54fe7f09095a015229dc6854eb37d917da596
1239500 f0bd39a43ab257a944d14fe21c055e28b4bf85e32795aef2df130ebb1469fd29 d550e50d0236841193db7689afd67e5c127c115dd776caeef23f44f52c24eb65 37a0103ad87b07e99794b77907c10c398e404dcf02858b5f33e990c54815f489
1240000 b67c1f025f7220f11d05c5b74ed716a09052a39ae5c9c0d81f959bde2412df21 7dedc1388bc5241148978f52fea051ebbd5e53bb1c6b4c1b6b08859d0aad4b2e 4d83919d062a0ff402a61cfcb2ae65f5e821a51a10da6f1b8663f15827757347
1240500 80ca7f4b0190576ff892ba63370d8c90c8f1574b68eef75d1bb9548f4d697376 3f8b9364517f8b827560a267f8745d0a806d99e681c62a29eb40c7d111fc983b 8f484667e640bb16315af1b338afcfa136eb57e1a31ccc9fb860adcf1556563b
1241000 5cd717cb334be09de942f4047874ec8c688ee393f5dc13f68c253c628810672a 8d05f82f6117d614c90a34bbbd6da0a5245ebbf2b2834fef6388d6ab651e3ca7 ee5f33765c74cc445bfd39a54232159f4bf473881187f1ae94589fa3159d4a4f
1241500 4bd53ea06156b6ecc8a0070ea632740d300d6151528de74b398c4f409fdd1ba8 9ef6c928f41fb210bc7ebcb5be662d72d7d948cade0b351028cdd78162501d14 eb751a66f7169b70a75897c6d081aac3c73ce976088d52fa3db8a30d2b4f5ad4
1242000 f6295866a6038a9c371c5b6e52a07048c81ad8ab72f640c958fef811c2ffbdfd 756f74642fe42be36c16ab56489bbafe9ccf2371e42cc4a5f4cb630458f1b643 46a699b7f76280ce6eb0e7a806d0137497c244d0434f466fc7e55bd0a82758cd
1242500 3e8a274212a5fedb87e2418a0371405cb81c862e031ef973006b451a22c7b675 1790d1bad665ba26d5f736c53dd47da21215c5f0c683c9812275bbf133c5408d ad3d79038c8f93772dc3b5572bf0451a3283f5c2699de24cbf94e8775bca0b1a
1243000 3756bde16fbf4ff5515c43a0000e3ca2de2e6b07e577f3c4dc1da8e12ac7fbcb a95d67a204c1ebc44542f1d37e33f9793d52a1a65139767be6286cc878e0c115 e24d3bb6b9974c05936502b8cbf1a3767a034ab46cccf08277f1e43dccf568a0
1243500 940cae25d2eec6a8861d9251472286c8a9f39f2b71b2a29fd3c9ea6f1abe492e a5f95df00408129542423b39e2a84e712404bf0ee4385c552a86cabf31701ffb b4a8fe46c8f3478ef6f39f28cd19e87279baa2e4dbba4ac9ed4231604cc8d97e
1244000 d361b001439ebc3a1119a25e8c6c07de4e8bbb5319a5934ff8a204a5d20e7ab4 423470d98066acba4a0a1bc5d6b0e593d86013581c23064aa812a14412522925 cd7d391b8691837f0fd613a16c4be66204df9d9c6f1d2c5e3665062dfe410308
1244500 352c6570c4e0dc0d45567f5328f464e77d08a08ca264bb5c2d390ac164bb1ea5 cd1b268988aaa946914020431f90b3b0fdb04cb68f51ad4ae51f2d584d9a5e80 2ed18bee66f75a782a11f536e317b9f215e4910c1a0a3d006d8939f323718261
1245000 8e6877ac8dd351b54f372db8edccff5ed28a56dd0196100f6b460c8147d26852 d8675c2f64d6b783610322ba2f7f4adb1fe7d73735d564207f6b3d05f4027cf2 76a3be64b31a57a9c12fe53f8ff6fb96a08f0538ef7e036eb194b34d3e2034bc
1245500 311eb3483c9afe64f8e08b22fdb61f64f2a03b00af63b149d2d1204dcb1c4606 137d75b32adebcc920a1788ca0dfc6d973c63f534d79fe82837ee8e886d8ba4e d0bba748e4021300262433f2f88879e03056b96edd06fdcb4c2d38194d1c8e65
1246000 5509b7ea30bfe33c501747d1830cb8f446067a775ecfc8b96d22573d345af12c 3699f1e168c6144f9006bfe7f5f6873bf11cdc13abd24bbee12c0b22220f1091 2e220129558c543cdb78d3d05c5c3de4e52220dbc185985f738cf792c2eb2f41
1246500 243eeac7144a8a164bc11ff86125c615e2b878a70f9083c93935ed4a54c8d3a8 332b707161165a53d71255777700bdb9353cfa4ddba816e7e0bc621d27c83fae d266d2b937563694108338f8c9273c14d5842310e18fbe68a4ea05c6d5ad205e
1247000 043654128e4e21603e9df5a5215bc06f01366271ed51ddb230950d5417b53a8a 0ecbfd16d1139ffb326979ebd7507ef4736dbe9986d390247adfb77e3e7db8a7 7e73896fbe8dd0ce540401bb6e2053f8908dd690c6616e32dc28843be1a0a235
1247500 ffecd3df8dababd8bd3db48e30f034341293cd141e7f5eb2cfd3383e83717261 435268905ce4ad84beddad2fb00aea84a0019cb391ab43c98801ece328bfa3d7 27ac8fbe9c00697d9f8a73c23705f6f6dedcbd5dc6835bf9625370a0d621a118
1248000 a83cf72b2c589f475d70120ba553f1fda2fb58c80790498df9a5e7d3e65ba98a aeb9dfaf149790d172d3250604ae939ea0ad7d87e546b6bd8f19a4135a533738 4667a1d7f3b0124e63bce7a56f4a4a3106be81ee934153d30f4c600789dcc69e
1248500 84cc34f5d56d431bc44c537f09573cbfc332cecde35e2210b83288d44503ec7c a338c370b445a3cfb9c37d064663765caa41c015bb8695338df876426dce6a70 6c0a435b32c133032291c0a6fa92934a6301fd057e394a8ea65588b6462534f6
1249000 d296d197045790f4cc6cd4e701589c8bf96e087240e5cd3aa47bb75d47face58 12981ee84a2aac6119210a2a460804cc8cf047e63ade62c6a4c0d72db36cec9d f58a8a0337779f01926284a056b3c9721a2e5463cec8fd5e87f67446b8440d96
1249500 be1e29d4530cb278d1266acccdffd6adfdb6ebb990582ac12ef3b9306fc7be59 2fe0458f1f910fe8dec95796083bac90af2b52a317e812a2280fbf973c6d6890 ec51dd3af87089a3ac9ca8026d4a860aaf4a7f366bd7b00b74d57fc796dc1527
1250000 ff909ef870867e5408ec24ec40a290802f79bea220c8f4a92db22965fcd4f626 03e5b1fcdc2862ced4fbac3aaa81d1e0085c14d6f6d06c6ae592f74afaa16f34 c4f52d30fd52f73e6c5a8e27d3727b17887edddc5400dfb9ca1cce4703e3809a
1250500 8f0c2debaa498a5f78b8b247d1867ef6ade586bdfa823596d09f72abb489a91c ebbc2c14544a97d0bd12993dde913e52f2ef78450c1ce0fa2ca17274b6850836 de78b1c377adec4d78d5e4875569e052cc1d4eb959149a28783d3a14e05a365e
1251000 e484a8dae7eb5135538bf13009824a60f2e01446f7eccd39d7b6ba4ab7c02f6e 832e2c77cc85a51df16361177033632ca54768944daf778522cfec04a1968805 9d3db1d547f74210714713bf27f88dded8e2ac50a618afe41220ac606fecbf7a
1251500 d39df71c033cc3435949073db5f0dfdcc0665a7cb4f948704c30a36198d4354f

9
iguana/confs/BTC_hdrs.txt

@ -204,4 +204,11 @@
404000 000000000000000004f9f0d6320d54c1f108130998e5bfb911f521ddf34da82c 65638c1d27075ca7bddf5f5bf7e6a1bc53b1ee60aa678c629091e3da60fe59a8 000000000000000001da1eeb6fa89a81b7534309e3dafa425db27e4e4e3bb972
406000 000000000000000003b3efcefc5eaaef3b21671228233be52db1a080022462c1 9f141ccc21d86aa7ae67a18f7b405d6c4a24a367e4fe5c3bcaea08cfb20de64e 0000000000000000031c610eb5a810af32b531569c5fe681d0c2ddb7ae56be80
408000 000000000000000003cc3d3e5b5d9b577b83c2b8d6f4257398c8f4aa8b2be649 0859f04d6ff78a9a631d5747e29d40e72defc3b4bcb58b046f73bc8bbd7aa50f 000000000000000004f62eeb625ddf5604eb9c3d9e5f214b643d23be2b83a99c
410000 0000000000000000060d7ea100ecb75c0a4dc482d05ff19ddaa8046b4b80a458
410000 0000000000000000060d7ea100ecb75c0a4dc482d05ff19ddaa8046b4b80a458 7ee23e1efb47a4744cf2f72c6f863e932ec1f38a31697f166faeb4571b946b0c 0000000000000000031a8a4a11a1680a6c78193bd0e6af2d5ca006d6f2b07757
412000 0000000000000000014dcd1377afd27d3cf2320d32e4dcdaf21c39d293b9bf23 61b2e015dd0aeb282744932dc4f188f5171b792b75e4aed516fb74ae2dd7d08a 00000000000000000323da2be6bfa14499c93b99aa5e8edd1a4f7b6b32921aae
414000 000000000000000003727e589ce68495058c0bffb20d98656a7d875ea1ae7796 49b7d50215a343b145750cbf4cd95ec629019bcfe35e850d38b8f54bd507b127 000000000000000005814969a2106f7c16c37f82bfaab565c9493529df162a62
416000 0000000000000000057799a23ee01dab5d6124c3bf89bbe8751cf792e88f0102 c1d62b1ab2d9f8263fb0fcbf76a681083c1b305283af470f59a3fdaf89830523 000000000000000003c46614727cc27b46b6175e1a1cf8569a031a3350e47cbc
418000 00000000000000000013592fb504656c5edbe56a8fcbb79801ba561acb07419c 2692a62175409231e65ef28d634821c405e74021adec8b81a6a58a78ae9c30b8 00000000000000000145d4625d38d58a32afdd3aa3467bb610d1e1209b5a9b1e
420000 000000000000000002cce816c0ab2c5c269cb081896b7dcb34b8422d6b74ffa1 93b26e63916ca443378d78cbb09455f56b3c919aba32a0c85db3fc3dfacb3bcf 000000000000000004db7eebf333b81f2529835102f7f7e86eca889287148885
422000 000000000000000000bc63425c27548213256efed6f40685ebf4d3da10562794 d271b6990bad34a6db18349ee75efe9d84a196f9f6d1105bba99f2487625b91c 000000000000000001db165a3ac56a2188b8bbb8e0574de42aae0256d7f06b44
424000 0000000000000000014f564a76d9e3efa7940f0584c24084e8c5dc15a8836d27

82
iguana/iguana_realtime.c

@ -464,11 +464,17 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
return(flag);
}
void iguana_RTunspent(struct iguana_info *coin,struct iguana_RTdata *RTptr,struct iguana_block *block,int64_t polarity,char *coinaddr,uint8_t *rmd160,int32_t type,uint8_t *script,int32_t scriptlen,bits256 txid,int32_t vout,int64_t value)
void iguana_RTunspent(struct iguana_info *coin,struct iguana_RTtxid *RTptr,struct iguana_block *block,int64_t polarity,char *coinaddr,uint8_t *rmd160,int32_t type,uint8_t *script,int32_t scriptlen,bits256 txid,int32_t vout,int64_t value)
{
int32_t i;
// fill in array element and update counters
if ( 0 && strcmp("BTC",coin->symbol) != 0 )
if ( RTptr != 0 )
{
if ( bits256_cmp(RTptr->txid,txid) == 0 )
{
} else printf("iguana_RTunspent txid mismatch %llx != %llx\n",(long long)RTptr->txid.txid,(long long)txid.txid);
}
else
{
for (i=0; i<20; i++)
printf("%02x",rmd160[i]);
@ -476,21 +482,70 @@ void iguana_RTunspent(struct iguana_info *coin,struct iguana_RTdata *RTptr,struc
}
}
void iguana_RTspend(struct iguana_info *coin,struct iguana_RTdata *RTptr,struct iguana_block *block,int64_t polarity,uint8_t *script,int32_t scriptlen,bits256 txid,int32_t vini,bits256 prev_hash,int32_t prev_vout)
void iguana_RTspend(struct iguana_info *coin,struct iguana_RTtxid *RTptr,struct iguana_block *block,int64_t polarity,uint8_t *script,int32_t scriptlen,bits256 txid,int32_t vini,bits256 prev_hash,int32_t prev_vout)
{
struct iguana_RTspend *spend;
char str[65],str2[65];
// fill in array element and update counters
if ( 0 && strcmp("BTC",coin->symbol) != 0 )
printf("%s vini.%d spend.(%s/v%d) %lld\n",bits256_str(str,txid),vini,bits256_str(str2,prev_hash),prev_vout,(long long)polarity);
if ( RTptr != 0 )
{
if ( bits256_cmp(RTptr->txid,txid) == 0 )
{
if ( polarity > 0 )
{
}
} else printf("iguana_RTspend txid mismatch %llx != %llx\n",(long long)RTptr->txid.txid,(long long)txid.txid);
} else printf("null rtptr? %s vini.%d spend.(%s/v%d) %lld\n",bits256_str(str,txid),vini,bits256_str(str2,prev_hash),prev_vout,(long long)polarity);
}
struct iguana_RTdata *iguana_RTtxid(struct iguana_info *coin,struct iguana_block *block,int64_t polarity,int32_t txn_count,bits256 txid,int32_t numvouts,int32_t numvins,uint32_t locktime,uint32_t version,uint32_t timestamp)
void iguana_RTtxid_free(struct iguana_RTtxid *RTptr)
{
char str[65];
// add to hashtable block <-> txids[]
if ( 0 && strcmp("BTC",coin->symbol) != 0 )
printf("%s txid.(%s) vouts.%d vins.%d version.%d lock.%u t.%u %lld\n",coin->symbol,bits256_str(str,txid),numvouts,numvins,version,locktime,timestamp,(long long)polarity);
return(0);
int32_t i;
for (i=0; i<RTptr->numvouts; i++)
if ( RTptr->unspents[i] != 0 )
free(RTptr->unspents[i]);
for (i=0; i<RTptr->numvins; i++)
if ( RTptr->spends[i] != 0 )
free(RTptr->spends[i]);
free(RTptr);
}
void iguana_RTdataset_free(struct iguana_info *coin)
{
struct iguana_RTtxid *RTptr,*tmp;
HASH_ITER(hh,coin->RTdataset,RTptr,tmp)
{
HASH_DELETE(hh,coin->RTdataset,RTptr);
iguana_RTtxid_free(RTptr);
}
}
struct iguana_RTtxid *iguana_RTtxid(struct iguana_info *coin,struct iguana_block *block,int64_t polarity,int32_t txn_count,bits256 txid,int32_t numvouts,int32_t numvins,uint32_t locktime,uint32_t version,uint32_t timestamp)
{
struct iguana_RTtxid *RTptr; char str[65];
HASH_FIND(hh,coin->RTdataset,txid.bytes,sizeof(txid),RTptr);
if ( RTptr == 0 )
{
RTptr = calloc(1,sizeof(*RTptr) + sizeof(void *)*numvins + sizeof(void *)*numvouts);
RTptr->txid = txid;
RTptr->txn_count = txn_count;
RTptr->numvouts = numvouts;
RTptr->numvins = numvins;
RTptr->locktime = locktime;
RTptr->version = version;
RTptr->timestamp timestamp;
RTptr->unspents = (void *)&RTptr->spends[numvins];
HASH_ADD_KEYPTR(hh,coin->RTdataset,RTptr->txid.bytes,sizeof(RTptr->txid),RTptr);
// add to hashtable block <-> txids[]
if ( 0 && strcmp("BTC",coin->symbol) != 0 )
printf("%s txid.(%s) vouts.%d vins.%d version.%d lock.%u t.%u %lld\n",coin->symbol,bits256_str(str,txid),numvouts,numvins,version,locktime,timestamp,(long long)polarity);
}
else if ( RTptr->txn_count != txn_count || RTptr->numvouts != numvouts || RTptr->numvins != numvins )
{
printf("%s inconsistent counts.(%d %d %d) vs (%d %d %d)\n",bits256_str(str,txid),RTptr->txn_count,RTptr->numvouts,RTptr->numvins,txn_count,numvouts,numvins);
return(0);
}
return(RTptr);
}
void iguana_RTreset(struct iguana_info *coin)
@ -499,6 +554,7 @@ void iguana_RTreset(struct iguana_info *coin)
iguana_utxoupdate(coin,-1,0,0,0,0,-1,0); // free hashtables
coin->lastRTheight = 0;
coin->RTheight = coin->firstRTheight;
iguana_RTdataset_free(coin);
printf("%s RTreset %d\n",coin->symbol,coin->RTheight);
}

25
includes/iguana_structs.h

@ -380,6 +380,30 @@ struct hhbits256 { UT_hash_handle hh; bits256 txid; int32_t height; uint16_t fir
struct iguana_monitorinfo { bits256 txid; int32_t numreported; uint8_t peerbits[IGUANA_MAXPEERS >> 3]; };
struct iguana_RTspend
{
bits256 prev_hash; int16_t prev_vout,scriptlen;
uint8_t vinscript[];
};
struct iguana_RTunspent
{
uint8_t rmd160[20];
int64_t value;
int16_t scriptlen;
uint8_t script[];
};
struct iguana_RTtxid
{
UT_hash_handle hh;
bits256 txid;
int32_t txn_count,numvouts,numvins;
uint32_t locktime,version,timestamp;
struct iguana_RTunspent *unspents;
struct iguana_RTspend spends[];
};
struct iguana_info
{
UT_hash_handle hh;
@ -429,6 +453,7 @@ struct iguana_info
void *utxoaddrfileptr; long utxoaddrfilesize;
uint32_t utxoaddrlastcount,*utxoaddroffsets; uint8_t *utxoaddrtable; bits256 utxoaddrhash;
struct iguana_block *RTblocks[65536]; uint8_t *RTrawdata[65536]; int32_t RTrecvlens[65536],RTnumtx[65536];
struct iguana_RTtxid *RTdataset;
};
struct vin_signer { bits256 privkey; char coinaddr[64]; uint8_t siglen,sig[80],rmd160[20],pubkey[66]; };

Loading…
Cancel
Save