]> Git Repo - VerusCoin.git/blame - src/komodo.h
test
[VerusCoin.git] / src / komodo.h
CommitLineData
fcd36118 1/******************************************************************************
2 * Copyright © 2014-2016 The SuperNET Developers. *
3 * *
4 * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
5 * the top-level directory of this distribution for the individual copyright *
6 * holder information and the developer policies on copyright and licensing. *
7 * *
8 * Unless otherwise agreed in a custom licensing agreement, no part of the *
9 * SuperNET software, including this file may be copied, modified, propagated *
10 * or distributed except according to the terms contained in the LICENSE file *
11 * *
12 * Removal or modification of this copyright notice is prohibited. *
13 * *
14 ******************************************************************************/
15
16#ifndef H_KOMODO_H
17#define H_KOMODO_H
18
93b5c955 19#include <stdint.h>
778ca57b 20#include <stdio.h>
93b5c955 21
44c4fbbd 22#define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9"
23
acb1f4f1 24const char *Notaries[64][2] =
df1620e2 25{
26 { "jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" },
27 { "jl777_testB", "02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344" },
28 { "pondsea_SH", "02209073bc0943451498de57f802650311b1f12aa6deffcd893da198a544c04f36" },
29 { "crackers_EU", "0340c66cf2c41c41efb420af57867baa765e8468c12aa996bfd816e1e07e410728" },
30 { "pondsea_EU", "0225aa6f6f19e543180b31153d9e6d55d41bc7ec2ba191fd29f19a2f973544e29d" },
31 { "locomb_EU", "025c6d26649b9d397e63323d96db42a9d3caad82e1d6076970efe5056c00c0779b" },
32 { "fullmoon_AE", "0204a908350b8142698fdb6fabefc97fe0e04f537adc7522ba7a1e8f3bec003d4a" },
33 { "movecrypto_EU", "021ab53bc6cf2c46b8a5456759f9d608966eff87384c2b52c0ac4cc8dd51e9cc42" },
34 { "badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" },
35 { "crackers_NA", "029e1c01131974f4cd3f564cc0c00eb87a0f9721043fbc1ca60f9bd0a1f73f64a1" },
36 { "proto_EU", "03681ffdf17c8f4f0008cefb7fa0779c5e888339cdf932f0974483787a4d6747c1" },
37 { "jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" },
38 { "farl4web_EU", "035caa40684ace968677dca3f09098aa02b70e533da32390a7654c626e0cf908e1" },
39 { "nxtswe_EU", "032fb104e5eaa704a38a52c126af8f67e870d70f82977e5b2f093d5c1c21ae5899" },
40 { "traderbill_EU", "03196e8de3e2e5d872f31d79d6a859c8704a2198baf0af9c7b21e29656a7eb455f" },
41 { "vanbreuk_EU", "024f3cad7601d2399c131fd070e797d9cd8533868685ddbe515daa53c2e26004c3" },
42 { "titomane_EU", "03517fcac101fed480ae4f2caf775560065957930d8c1facc83e30077e45bdd199" },
43 { "supernet_AE", "029d93ef78197dc93892d2a30e5a54865f41e0ca3ab7eb8e3dcbc59c8756b6e355" },
44 { "supernet_EU", "02061c6278b91fd4ac5cab4401100ffa3b2d5a277e8f71db23401cc071b3665546" },
45 { "yassin_EU", "033fb7231bb66484081952890d9a03f91164fb27d392d9152ec41336b71b15fbd0" },
46 { "durerus_EU", "02bcbd287670bdca2c31e5d50130adb5dea1b53198f18abeec7211825f47485d57" },
47 { "badass_SH", "026b49dd3923b78a592c1b475f208e23698d3f085c4c3b4906a59faf659fd9530b" },
48 { "baddass_NA" "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" },
49 { "pondsea_NA", "031bcfdbb62268e2ff8dfffeb9ddff7fe95fca46778c77eebff9c3829dfa1bb411" },
50 { "rnr_EU", "0287aa4b73988ba26cf6565d815786caf0d2c4af704d7883d163ee89cd9977edec" },
51 { "crackers_SH", "02313d72f9a16055737e14cfc528dcd5d0ef094cfce23d0348fe974b6b1a32e5f0" },
52 { "grewal_SH", "03212a73f5d38a675ee3cdc6e82542a96c38c3d1c79d25a1ed2e42fcf6a8be4e68" },
53 { "polycryptoblock_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" },
54 { "titomane_NA", "0387046d9745414fb58a0fa3599078af5073e10347e4657ef7259a99cb4f10ad47" },
55 { "titomane_AE", "03cda6ca5c2d02db201488a54a548dbfc10533bdc275d5ea11928e8d6ab33c2185" },
56};
57
f2d60864 58int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,NOTARIZED_HEIGHT;
998397aa 59std::string NOTARY_PUBKEY;
f2d60864 60uint256 NOTARIZED_HASH;
50027f06 61
c9b8b8b0 62int32_t komodo_blockindexcheck(CBlockIndex *pindex,uint32_t *nBitsp)
e3463de1 63{
aa8b56ea 64 // 1 -> valid notary block, change nBits to KOMODO_MINDIFF_NBITS
65 // -1 -> invalid, ie, prior to notarized block
d11ed5b9 66 CBlock block; int32_t i,height; char *coinbasestr;
937401b6 67 if ( pindex == 0 )
68 return(0);
482c3933 69 if ( ReadBlockFromDisk(block,pindex,1) == 0 )
34a08ade 70 return(0);
72837a51 71 if ( block.vtx.size() > 0 )
72 {
73 height = pindex->nHeight;
74 coinbasestr = (char *)block.vtx[0].vout[0].scriptPubKey.ToString().c_str();
df1620e2 75 for (i=0; i<64; i++)
76 {
78bcf6ee 77 if ( Notaries[i][0] == 0 || Notaries[i][1] == 0 || Notaries[i][0][0] == 0 || Notaries[i][1][0] == 0 )
df1620e2 78 break;
79 if ( strncmp(Notaries[i][1],coinbasestr,66) == 0 )
219c2c0d 80 {
92e1ff9c 81 //printf("Notary.[%d] %s ht.%d (%s)\n",i,Notaries[i][0],height,coinbasestr);
82 //*nBitsp = KOMODO_MINDIFF_NBITS;
83 return(1);
219c2c0d 84 }
df1620e2 85 }
e156b049 86 }
c9b8b8b0 87 // compare against elected notary pubkeys as of height
e3463de1 88 return(0);
89}
90
c9b8b8b0 91void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
50027f06 92{
44c4fbbd 93 char *scriptstr; int32_t i,height,txn_count,len;
3d35aa5b 94 // update voting results and official (height, notaries[])
68916cc6 95 if ( pindex != 0 )
b501ded2 96 {
656eddcd 97 height = pindex->nHeight;
98 txn_count = block.vtx.size();
92e1ff9c 99 if ( txn_count == 0 )
dc64de68 100 {
92e1ff9c 101 printf("no transactions for ht.%d\n",height);
dc64de68 102 if ( ReadBlockFromDisk(block,pindex,1) == 0 )
103 {
104 printf("komodo_connectblock: ht.%d error reading block\n",height);
105 return;
106 }
107 txn_count = block.vtx.size();
108 printf("new txn_count.%d\n",txn_count);
109 }
656eddcd 110 for (i=0; i<txn_count; i++)
111 {
112 scriptstr = (char *)block.vtx[i].vout[0].scriptPubKey.ToString().c_str();
44c4fbbd 113 if ( (len= strlen(scriptstr)) == 0 )
114 {
115 printf("komodo_connectblock: ht.%d NULL script??\n",height);
116 if ( ReadBlockFromDisk(block,pindex,1) == 0 )
117 {
118 printf("komodo_connectblock: ht.%d error reading block\n",height);
119 return;
120 }
121 txn_count = block.vtx.size();
122 i = -1;
123 printf("loaded block ht.%d\n",height);
124 continue;
125 }
df1620e2 126 if ( strncmp(scriptstr,CRYPTO777_PUBSECPSTR,66) == 0 )
6f4c9a66 127 printf(">>>>>>>> ");
128 printf("ht.%d txi.%d (%s)\n",height,i,scriptstr);
656eddcd 129 }
44c4fbbd 130 } else printf("komodo_connectblock: unexpected null pindex\n");
3d35aa5b 131}
132
0570045c 133int32_t komodo_is_notaryblock(CBlockHeader& blockhdr)
3d35aa5b 134{
68916cc6 135 //uint32_t nBits = 0;
136 //return(komodo_blockindexcheck(mapBlockIndex[blockhdr.GetHash()],&nBits));
137 return(0);
3d35aa5b 138}
139
0570045c 140int32_t komodo_blockhdrcheck(CBlockHeader& blockhdr,uint32_t *nBitsp)
3d35aa5b 141{
aa8b56ea 142 int32_t retval;
143 if ( (retval= komodo_is_notaryblock(blockhdr)) > 0 )
0570045c 144 *nBitsp = KOMODO_MINDIFF_NBITS;
aa8b56ea 145 return(retval);
3d35aa5b 146}
147
0570045c 148int32_t komodo_blockcheck(CBlock& block,uint32_t *nBitsp)
d27afb07 149{
c9b8b8b0 150 return(komodo_blockhdrcheck(block,nBitsp));
d27afb07 151}
fcd36118 152
153#endif
This page took 0.049506 seconds and 4 git commands to generate.