您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ uint256函数代码示例

51自学网 2021-06-03 09:07:25
  C++
这篇教程C++ uint256函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中uint256函数的典型用法代码示例。如果您正苦于以下问题:C++ uint256函数的具体用法?C++ uint256怎么用?C++ uint256使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了uint256函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ProcessBlockMsg

bool ProcessBlockMsg(BTCMessage &msg){	if (!msg.VerifyChecksum() || msg.vPayload.size()<=80)	// something wrong with checksum or length, can't process it		return false;	// calculate hash of this block	uint256 curBlockHash = Hash(msg.vPayload.begin(), msg.vPayload.begin()+80);	mysqlpp::Connection *my_conn = mydb.GrabConnection();	// get a database connection	if (mydb.IsBlockHashKnown(my_conn, &curBlockHash)) {		mydb.ReleaseConnection(my_conn);		return true;			// nothing to do, as we got already this block somehow (from previous download or unsollicited message)	}	// now do the real stuff: block is not known yet	ChainBlocks newBlock(0);	// create new block to add, we don't know ID yet	newBlock.hash.assign((char *)curBlockHash.begin(), 32);	newBlock.prevhash.assign((char *)&msg.vPayload[4], 32);	// first 4 bytes are version number, not checked for now	newBlock.height=-2;			// height not yet known	// --> see if prevBlockHash exists in existing blocks in ChainBlocks	int iPrevHeight = mydb.GetBlockHeightFromHash(my_conn, newBlock.prevhash);	if (iPrevHeight>=-1) {					// this new block has a previous hash of a temporary block with known height		newBlock.height=iPrevHeight+1;		// so height of this block is known		int iBestHeight=mydb.GetBestHeightKnown(my_conn);		if (newBlock.height<=iBestHeight) {	// height of new block is less or equal then best known temporary --> discard all temp blocks with this height and above			for (iPrevHeight=iBestHeight; iPrevHeight>=newBlock.height; iPrevHeight--)				mydb.DeleteBlockDataOfHeight(my_conn, iPrevHeight);		}	}	else {									// this new block has unknown height		if (BTCnode.GetNodeStatus()>4) {				// we have an up-to-date block chain, so this is unusual, probably a block fork happened			int iSafeHeight = mydb.GetSafeHeight(my_conn);			if (iSafeHeight>0) {				uint256 hash_start;				if (mydb.GetBlockHashFromHeight(my_conn, iSafeHeight, hash_start)) {					if (BTCnode.SendMsg_GetBlocks(hash_start, uint256(0))) {						BTCnode.Peer_AskedBlockHeight = iSafeHeight + 500;  // we asked up to 500 new blocks					}				}			}		}	}	newBlock.status = (newBlock.height>=0)? 1 : 0;	// --> add it to ChainBlocks	if (mydb.AddBlockToChain(my_conn, newBlock)) {	// block added successfully		// --> add tx's to ChainTxIns and ChainTxOuts		std::vector<unsigned char>::iterator itTxBegin;		std::vector<unsigned char>::iterator it=msg.vPayload.begin()+80;	// we start at 80 offset with TX data		int iNrTransactions = (int)msg.GetVarInt(it);						// retrieve the varint indicating number of transactions		int iEachTx;		mysqlpp::Transaction myTrans(*my_conn);		for (iEachTx=0; iEachTx < iNrTransactions; iEachTx++) {		// loop through each transaction			itTxBegin = it;											// remember where current transaction starts for hash calculation later on			ChainTxs newTx(newBlock.ID, iEachTx);					// insert incomplete Tx as we need referencial integrity on depending TxIns and TxOuts			if (mydb.InsertChainTx(my_conn, newTx)) {				it +=4;		// skip version number				int iNrTxIO = (int)msg.GetVarInt(it);				// number of input transactions				int iEachTxIO;				for (iEachTxIO=0; iEachTxIO < iNrTxIO; iEachTxIO++) {					// loop through each "in" transaction					// we retain only the "OutPoint" Structure, we expect signature to be valid (otherwise it wouldn't be in a block)					ChainTxIns newTxIn(newBlock.ID, iEachTx, iEachTxIO);		// create record data variable					newTxIn.opHash.assign((char *)&it[0],32);	// OutPoint hash					memcpy(&newTxIn.opN, &it[32], 4);			// OutPoint index number					it+=36;		// skip OutPoint					int iVI = (int)msg.GetVarInt(it);			// length of script					it+=iVI;	// skip script					it+=4;		// skip sequence					mydb.InsertChainTxIn(my_conn, newTxIn);				}				iNrTxIO = (int)msg.GetVarInt(it);				// number of output transactions				for (iEachTxIO=0; iEachTxIO < iNrTxIO; iEachTxIO++) {					// loop through each "out" transaction					// we examine the script and extract: value, type and hash(es)					ChainTxOuts newTxOut(newBlock.ID, iEachTx, iEachTxIO);		// create record data variable					memcpy(&newTxOut.value, &it[0], 8);			// value of output					it+=8;		// skip the value					newTxOut.txType=0;					int iVI = (int)msg.GetVarInt(it);			// length of script					// examine script to find out the type of transactions					if (it[0]<OP_PUSHDATA1) {	// script starts with immediate data						if (it[0]==65 && it[66]==OP_CHECKSIG) {		// transaction is "Transaction to IP address/ Generation"							vector<unsigned char> vPubKey(it+1, it+66);	// extract Public Key from Msg							uint160 uKeyHash = Hash160(vPubKey);							newTxOut.smartID.assign((const char *)&uKeyHash, 20);		// copy it into record							newTxOut.smartIDAdr = Hash160ToAddress(uKeyHash);			// store base58 address too							newTxOut.storeID.it_is_null();								// storeID is not used							newTxOut.txType=2;						}					}					else {						if (it[0]==OP_DUP && it[1]==OP_HASH160 && it[2]==20 && it[23]==OP_EQUALVERIFY) { // transaction start = std Tx to BitcoinAddress							if (it[24]==OP_CHECKSIG) {	// it is standard transaction								vector<unsigned char> vKeyHash(it+3, it+23);			// extract hash from Msg								newTxOut.smartID.assign((const char *)&it[3], 20);		// extract hash from Msg								newTxOut.smartIDAdr = Hash160ToAddress( uint160(vKeyHash) );								newTxOut.storeID.it_is_null();								newTxOut.txType=1;							}//.........这里部分代码省略.........
开发者ID:thilovonbraun,项目名称:bird,代码行数:101,


示例2: GetBestBlock

uint256 CCoinsViewCache::GetBestBlock() const {    if (hashBlock == uint256(0))        hashBlock = base->GetBestBlock();    return hashBlock;}
开发者ID:RoPe93,项目名称:freeanonymousinternet,代码行数:5,


示例3: CMainParams

    CMainParams() {        // The message start string is designed to be unlikely to occur in normal data.        pchMessageStart[0] = 0x06;        pchMessageStart[1] = 0x03;        pchMessageStart[2] = 0x04;        pchMessageStart[3] = 0x01;        nDefaultPort = 2222; //Ring was forged in the second age        nRPCPort = 2223; //Ring was forged in the second age.        bnProofOfWorkLimit = CBigNum(~uint256(0) >> 20);        nSubsidyHalvingInterval = 500000;        // Build the genesis block. Note that the output of the genesis coinbase cannot        // be spent as it did not originally exist in the database.          const char* pszTimestamp = "Sauron says hello.";        CTransaction txNew;        txNew.vin.resize(1);        txNew.vout.resize(1);        txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));        txNew.vout[0].nValue = 1 * COIN;        txNew.vout[0].scriptPubKey = CScript() << ParseHex("") << OP_CHECKSIG;        genesis.vtx.push_back(txNew);        genesis.hashPrevBlock = 0;        genesis.hashMerkleRoot = genesis.BuildMerkleTree();        genesis.nVersion = 1;        genesis.nTime    = 1386541846;        genesis.nBits    = 0x1e0fffff;        genesis.nNonce   = 0;                //// debug print        hashGenesisBlock = genesis.GetHash();        while (hashGenesisBlock > bnProofOfWorkLimit.getuint256()){            if (++genesis.nNonce==0) break;            hashGenesisBlock = genesis.GetHash();        }        printf("%s/n", hashGenesisBlock.ToString().c_str());        printf("%s/n", genesis.hashMerkleRoot.ToString().c_str());        printf("%x/n", bnProofOfWorkLimit.GetCompact());        genesis.print();                        assert(hashGenesisBlock == uint256("0x"));        assert(genesis.hashMerkleRoot == uint256("0x"));        vSeeds.push_back(CDNSSeedData("someaddress.com or IP addy", "someaddress.com"));        base58Prefixes[PUBKEY_ADDRESS] = 63;        base58Prefixes[SCRIPT_ADDRESS] = 30;        base58Prefixes[SECRET_KEY] = 224;        // Convert the pnSeeds array into usable address objects.        for (unsigned int i = 0; i < ARRAYLEN(pnSeed); i++)        {            // It'll only connect to one or two seed nodes because once it connects,            // it'll get a pile of addresses with newer timestamps.            // Seed nodes are given a random 'last seen time'             const int64 nTwoDays = 2 * 24 * 60 * 60;            struct in_addr ip;            memcpy(&ip, &pnSeed[i], sizeof(ip));            CAddress addr(CService(ip, GetDefaultPort()));            addr.nTime = GetTime() - GetRand(nTwoDays) - nTwoDays;            vFixedSeeds.push_back(addr);        }    }
开发者ID:sauronrings,项目名称:SauronRings-SHA,代码行数:66,


示例4: CMainParams

    CMainParams() {        // The message start string is designed to be unlikely to occur in normal data.        pchMessageStart[0] = 0xf8;        pchMessageStart[1] = 0xb5;        pchMessageStart[2] = 0x03;        pchMessageStart[3] = 0xdf;        vAlertPubKey = ParseHex("04f09702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284");        nDefaultPort = 12835;        nRPCPort = 12832;        bnProofOfWorkLimit = CBigNum(~uint256(0) >> 20);        nSubsidyHalvingInterval = 950000;        // Build the genesis block. Note that the output of the genesis coinbase cannot        // be spent as it did not originally exist in the database.        const char* pszTimestamp = "February 5, 2014: The Black Hills are not for sale - 1868 Is The LAW!";        CTransaction txNew;        txNew.vin.resize(1);        txNew.vout.resize(1);        txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));        txNew.vout[0].nValue = 5000 * COIN;        txNew.vout[0].scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;        genesis.vtx.push_back(txNew);        genesis.hashPrevBlock = 0;        genesis.hashMerkleRoot = genesis.BuildMerkleTree();        genesis.nVersion = 1;        genesis.nTime    = 1390747675;        genesis.nBits    = 0x1e0ffff0;        genesis.nNonce   = 2091390249;        //// debug print        hashGenesisBlock = genesis.GetHash();        //while (hashGenesisBlock > bnProofOfWorkLimit.getuint256()){        //   if (++genesis.nNonce==0) break;        //    hashGenesisBlock = genesis.GetHash();        //}        //printf("%s/n", hashGenesisBlock.ToString().c_str());        //printf("%s/n", genesis.hashMerkleRoot.ToString().c_str());        //printf("%x/n", bnProofOfWorkLimit.GetCompact());        //genesis.print();        assert(hashGenesisBlock == uint256("0x00000c7c73d8ce604178dae13f0fc6ec0be3275614366d44b1b4b5c6e238c60c"));        assert(genesis.hashMerkleRoot == uint256("0x62d496378e5834989dd9594cfc168dbb76f84a39bbda18286cddc7d1d1589f4f"));        vSeeds.push_back(CDNSSeedData("node.Maza.org", "node.Maza.org"));        vSeeds.push_back(CDNSSeedData("node.Maza.cf", "node.Maza.cf"));        vSeeds.push_back(CDNSSeedData("Maza.no-ip.org", "Maza.no-ip.org"));        base58Prefixes[PUBKEY_ADDRESS] = 50;        base58Prefixes[SCRIPT_ADDRESS] = 9;        base58Prefixes[SECRET_KEY] = 224;        // Convert the pnSeeds array into usable address objects.        for (unsigned int i = 0; i < ARRAYLEN(pnSeed); i++)        {            // It'll only connect to one or two seed nodes because once it connects,            // it'll get a pile of addresses with newer timestamps.            // Seed nodes are given a random 'last seen time'            const int64 nTwoDays = 2 * 24 * 60 * 60;            struct in_addr ip;            memcpy(&ip, &pnSeed[i], sizeof(ip));            CAddress addr(CService(ip, GetDefaultPort()));            addr.nTime = GetTime() - GetRand(nTwoDays) - nTwoDays;            vFixedSeeds.push_back(addr);        }    }
开发者ID:mazapayu2015,项目名称:Maza-test2,代码行数:68,


示例5: uint256

        const MapCheckpoints *mapCheckpoints;        int64_t nTimeLastCheckpoint;        int64_t nTransactionsLastCheckpoint;        double fTransactionsPerDay;    };    bool fEnabled = true;    // What makes a good checkpoint block?    // + Is surrounded by blocks with reasonable timestamps    //   (no blocks before with a timestamp after, none after with    //    timestamp before)    // + Contains no strange transactions    static MapCheckpoints mapCheckpoints =        boost::assign::map_list_of        ( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"))        ( 33333, uint256("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6"))        ( 74000, uint256("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20"))        (105000, uint256("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97"))        (134444, uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"))        (168000, uint256("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763"))        (193000, uint256("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317"))        (210000, uint256("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e"))        (216116, uint256("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e"))        (225430, uint256("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932"))        (250000, uint256("0x000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214"))        (279000, uint256("0x0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40"))        (295000, uint256("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983"))        ;    static const CCheckpointData data = {        &mapCheckpoints,
开发者ID:clickkarog,项目名称:bitcoin,代码行数:31,


示例6: CMainParams

    CMainParams() {        // The message start string is designed to be unlikely to occur in normal data.        pchMessageStart[0] = 0x09;        pchMessageStart[1] = 0x04;        pchMessageStart[2] = 0x04;        pchMessageStart[3] = 0x05;        nDefaultPort = 7777;        nRPCPort = 7070;        bnProofOfWorkLimit = CBigNum(~uint256(0) >> 20);        nSubsidyHalvingInterval = 250000;        // Build the genesis block. Note that the output of the genesis coinbase cannot        // be spent as it did not originally exist in the database.        const char* pszTimestamp = "Pump dump sell buy hold but when you hear the thunder be ready bc it will be showtimeee";        CTransaction txNew;        txNew.vin.resize(1);        txNew.vout.resize(1);        txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));        txNew.vout[0].nValue = 1 * COIN;        txNew.vout[0].scriptPubKey = CScript() << ParseHex("") << OP_CHECKSIG;        genesis.vtx.push_back(txNew);        genesis.hashPrevBlock = 0;        genesis.hashMerkleRoot = genesis.BuildMerkleTree();        genesis.nVersion = 1;        genesis.nTime    = 1387754247;        genesis.nBits    = 0x1e0fffff;        genesis.nNonce   = 416023;        //// debug print        hashGenesisBlock = genesis.GetHash();        while (hashGenesisBlock > bnProofOfWorkLimit.getuint256()){            if (++genesis.nNonce==0) break;            hashGenesisBlock = genesis.GetHash();        }        printf("%s/n", hashGenesisBlock.ToString().c_str());        printf("%s/n", genesis.hashMerkleRoot.ToString().c_str());        printf("%x/n", bnProofOfWorkLimit.GetCompact());        genesis.print();        assert(hashGenesisBlock == uint256("0x00000a26ae3a3e42c19266cdcb6c1705c644f6e12eff14ed69384ae9415f555d"));        assert(genesis.hashMerkleRoot == uint256("0xcbe518469ca4a98504a704913d2e3b4c0a131c8734a21aa8e56f879071e5c3fc"));        vSeeds.push_back(CDNSSeedData("70.193.4.56", "70.193.4.56"));        base58Prefixes[PUBKEY_ADDRESS] = 127;        base58Prefixes[SCRIPT_ADDRESS] = 30;        base58Prefixes[SECRET_KEY] = 224;        // Convert the pnSeeds array into usable address objects.        for (unsigned int i = 0; i < ARRAYLEN(pnSeed); i++)        {            // It'll only connect to one or two seed nodes because once it connects,            // it'll get a pile of addresses with newer timestamps.            // Seed nodes are given a random 'last seen time'            const int64 nTwoDays = 2 * 24 * 60 * 60;            struct in_addr ip;            memcpy(&ip, &pnSeed[i], sizeof(ip));            CAddress addr(CService(ip, GetDefaultPort()));            addr.nTime = GetTime() - GetRand(nTwoDays) - nTwoDays;            vFixedSeeds.push_back(addr);        }    }
开发者ID:coinmaker,项目名称:Thundercoin,代码行数:66,


示例7: run

    void run ()    {        testcase ("add/traverse");        beast::Journal const j;                            // debug journal                tests::TestFamily f(j);        // h3 and h4 differ only in the leaf, same terminal node (level 19)        uint256 h1, h2, h3, h4, h5;        h1.SetHex ("092891fe4ef6cee585fdc6fda0e09eb4d386363158ec3321b8123e5a772c6ca7");        h2.SetHex ("436ccbac3347baa1f1e53baeef1f43334da88f1f6d70d963b833afd6dfa289fe");        h3.SetHex ("b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8");        h4.SetHex ("b92891fe4ef6cee585fdc6fda2e09eb4d386363158ec3321b8123e5a772c6ca8");        h5.SetHex ("a92891fe4ef6cee585fdc6fda0e09eb4d386363158ec3321b8123e5a772c6ca7");        SHAMap sMap (SHAMapType::FREE, f, beast::Journal());        SHAMapItem i1 (h1, IntToVUC (1)), i2 (h2, IntToVUC (2)), i3 (h3, IntToVUC (3)), i4 (h4, IntToVUC (4)), i5 (h5, IntToVUC (5));        unexpected (!sMap.addItem (i2, true, false), "no add");        unexpected (!sMap.addItem (i1, true, false), "no add");        std::shared_ptr<SHAMapItem const> i;        i = sMap.peekFirstItem ();        unexpected (!i || (*i != i1), "bad traverse");        i = sMap.peekNextItem (i->key());        unexpected (!i || (*i != i2), "bad traverse");        i = sMap.peekNextItem (i->key());        unexpected (i, "bad traverse");        sMap.addItem (i4, true, false);        sMap.delItem (i2.key());        sMap.addItem (i3, true, false);        i = sMap.peekFirstItem ();        unexpected (!i || (*i != i1), "bad traverse");        i = sMap.peekNextItem (i->key());        unexpected (!i || (*i != i3), "bad traverse");        i = sMap.peekNextItem (i->key());        unexpected (!i || (*i != i4), "bad traverse");        i = sMap.peekNextItem (i->key());        unexpected (i, "bad traverse");        testcase ("snapshot");        uint256 mapHash = sMap.getHash ();        std::shared_ptr<SHAMap> map2 = sMap.snapShot (false);        unexpected (sMap.getHash () != mapHash, "bad snapshot");        unexpected (map2->getHash () != mapHash, "bad snapshot");        unexpected (!sMap.delItem (sMap.peekFirstItem ()->key()), "bad mod");        unexpected (sMap.getHash () == mapHash, "bad snapshot");        unexpected (map2->getHash () != mapHash, "bad snapshot");        testcase ("build/tear");        {            std::vector<uint256> keys(8);            keys[0].SetHex ("b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8");            keys[1].SetHex ("b92881fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8");            keys[2].SetHex ("b92691fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8");            keys[3].SetHex ("b92791fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8");            keys[4].SetHex ("b91891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8");            keys[5].SetHex ("b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8");            keys[6].SetHex ("f22891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8");            keys[7].SetHex ("292891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8");            std::vector<uint256> hashes(8);            hashes[0].SetHex ("B7387CFEA0465759ADC718E8C42B52D2309D179B326E239EB5075C64B6281F7F");            hashes[1].SetHex ("FBC195A9592A54AB44010274163CB6BA95F497EC5BA0A8831845467FB2ECE266");            hashes[2].SetHex ("4E7D2684B65DFD48937FFB775E20175C43AF0C94066F7D5679F51AE756795B75");            hashes[3].SetHex ("7A2F312EB203695FFD164E038E281839EEF06A1B99BFC263F3CECC6C74F93E07");            hashes[4].SetHex ("395A6691A372387A703FB0F2C6D2C405DAF307D0817F8F0E207596462B0E3A3E");            hashes[5].SetHex ("D044C0A696DE3169CC70AE216A1564D69DE96582865796142CE7D98A84D9DDE4");            hashes[6].SetHex ("76DCC77C4027309B5A91AD164083264D70B77B5E43E08AEDA5EBF94361143615");            hashes[7].SetHex ("DF4220E93ADC6F5569063A01B4DC79F8DB9553B6A3222ADE23DEA02BBE7230E5");            SHAMap map (SHAMapType::FREE, f, beast::Journal());            expect (map.getHash() == uint256(), "bad initial empty map hash");            for (int i = 0; i < keys.size(); ++i)            {                SHAMapItem item (keys[i], IntToVUC (i));                map.addItem (item, true, false);                expect (map.getHash() == hashes[i], "bad buildup map hash");            }            for (int i = keys.size() - 1; i >= 0; --i)            {                expect (map.getHash() == hashes[i], "bad teardown hash");                map.delItem (keys[i]);            }            expect (map.getHash() == uint256(), "bad final empty map hash");        }    }
开发者ID:referjs,项目名称:rippled,代码行数:88,


示例8: CMainParams

    CMainParams() {        // The message start string is designed to be unlikely to occur in normal data.        pchMessageStart[0] = 0x02;        pchMessageStart[1] = 0x03;        pchMessageStart[2] = 0x04;        pchMessageStart[3] = 0x05;        nDefaultPort = 25535;        nRPCPort = 25536;        bnProofOfWorkLimit = CBigNum(~uint256(0) >> 20);        nSubsidyHalvingInterval = 86400;        // Build the genesis block. Note that the output of the genesis coinbase cannot        // be spent as it did not originally exist in the database.          const char* pszTimestamp = "Lumberjacks and Maple Trees in the Great White North";        CTransaction txNew;        txNew.vin.resize(1);        txNew.vout.resize(1);        txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));        txNew.vout[0].nValue = 1 * COIN;        txNew.vout[0].scriptPubKey = CScript() << ParseHex("") << OP_CHECKSIG;        genesis.vtx.push_back(txNew);        genesis.hashPrevBlock = 0;        genesis.hashMerkleRoot = genesis.BuildMerkleTree();        genesis.nVersion = 1;        genesis.nTime    = 1390857400;        genesis.nBits    = 0x1e0fffff;        genesis.nNonce   = 102200;                //// debug print        hashGenesisBlock = genesis.GetHash();        while (hashGenesisBlock > bnProofOfWorkLimit.getuint256()){            if (++genesis.nNonce==0) break;            hashGenesisBlock = genesis.GetHash();        }        printf("%s/n", hashGenesisBlock.ToString().c_str());        printf("%s/n", genesis.hashMerkleRoot.ToString().c_str());        printf("%x/n", bnProofOfWorkLimit.GetCompact());        genesis.print();                        assert(hashGenesisBlock == uint256("0x00000567bbebf0cde56b9d36d3476eb1ea5c5060a45006e3523e5eaab5e5e212"));        assert(genesis.hashMerkleRoot == uint256("0xb929ecd9c646676b88098ad7a1031e0ab2baf390901083e3f22292b26d8c50b4"));        vSeeds.push_back(CDNSSeedData("andarazoroflove.org", "andarazoroflove.org"));        base58Prefixes[PUBKEY_ADDRESS] = 28;        base58Prefixes[SCRIPT_ADDRESS] = 28;        base58Prefixes[SECRET_KEY] = 224;        // Convert the pnSeeds array into usable address objects.        for (unsigned int i = 0; i < ARRAYLEN(pnSeed); i++)        {            // It'll only connect to one or two seed nodes because once it connects,            // it'll get a pile of addresses with newer timestamps.            // Seed nodes are given a random 'last seen time'             const int64 nTwoDays = 2 * 24 * 60 * 60;            struct in_addr ip;            memcpy(&ip, &pnSeed[i], sizeof(ip));            CAddress addr(CService(ip, GetDefaultPort()));            addr.nTime = GetTime() - GetRand(nTwoDays) - nTwoDays;            vFixedSeeds.push_back(addr);        }    }
开发者ID:broketech,项目名称:CTM,代码行数:66,


示例9: GetMinCollateralFee

bool CGovernanceObject::IsCollateralValid(std::string& strError, bool& fMissingConfirmations) const{    strError = "";    fMissingConfirmations = false;    CAmount nMinFee = GetMinCollateralFee();    uint256 nExpectedHash = GetHash();    CTransactionRef txCollateral;    uint256 nBlockHash;    // RETRIEVE TRANSACTION IN QUESTION    if (!GetTransaction(nCollateralHash, txCollateral, Params().GetConsensus(), nBlockHash, true)) {        strError = strprintf("Can't find collateral tx %s", nCollateralHash.ToString());        LogPrintf("CGovernanceObject::IsCollateralValid -- %s/n", strError);        return false;    }    if (nBlockHash == uint256()) {        strError = strprintf("Collateral tx %s is not mined yet", txCollateral->ToString());        LogPrintf("CGovernanceObject::IsCollateralValid -- %s/n", strError);        return false;    }    if (txCollateral->vout.size() < 1) {        strError = strprintf("tx vout size less than 1 | %d", txCollateral->vout.size());        LogPrintf("CGovernanceObject::IsCollateralValid -- %s/n", strError);        return false;    }    // LOOK FOR SPECIALIZED GOVERNANCE SCRIPT (PROOF OF BURN)    CScript findScript;    findScript << OP_RETURN << ToByteVector(nExpectedHash);    LogPrint("gobject", "CGovernanceObject::IsCollateralValid -- txCollateral->vout.size() = %s, findScript = %s, nMinFee = %lld/n",                txCollateral->vout.size(), ScriptToAsmStr(findScript, false), nMinFee);    bool foundOpReturn = false;    for (const auto& output : txCollateral->vout) {        LogPrint("gobject", "CGovernanceObject::IsCollateralValid -- txout = %s, output.nValue = %lld, output.scriptPubKey = %s/n",                    output.ToString(), output.nValue, ScriptToAsmStr(output.scriptPubKey, false));        if (!output.scriptPubKey.IsPayToPublicKeyHash() && !output.scriptPubKey.IsUnspendable()) {            strError = strprintf("Invalid Script %s", txCollateral->ToString());            LogPrintf("CGovernanceObject::IsCollateralValid -- %s/n", strError);            return false;        }        if (output.scriptPubKey == findScript && output.nValue >= nMinFee) {            foundOpReturn = true;        }    }    if (!foundOpReturn) {        strError = strprintf("Couldn't find opReturn %s in %s", nExpectedHash.ToString(), txCollateral->ToString());        LogPrintf("CGovernanceObject::IsCollateralValid -- %s/n", strError);        return false;    }    // GET CONFIRMATIONS FOR TRANSACTION    AssertLockHeld(cs_main);    int nConfirmationsIn = 0;    if (nBlockHash != uint256()) {        BlockMap::iterator mi = mapBlockIndex.find(nBlockHash);        if (mi != mapBlockIndex.end() && (*mi).second) {            CBlockIndex* pindex = (*mi).second;            if (chainActive.Contains(pindex)) {                nConfirmationsIn += chainActive.Height() - pindex->nHeight + 1;            }        }    }    if ((nConfirmationsIn < GOVERNANCE_FEE_CONFIRMATIONS) &&        (!instantsend.IsLockedInstantSendTransaction(nCollateralHash) || llmq::quorumInstantSendManager->IsLocked(nCollateralHash))) {        strError = strprintf("Collateral requires at least %d confirmations to be relayed throughout the network (it has only %d)", GOVERNANCE_FEE_CONFIRMATIONS, nConfirmationsIn);        if (nConfirmationsIn >= GOVERNANCE_MIN_RELAY_FEE_CONFIRMATIONS) {            fMissingConfirmations = true;            strError += ", pre-accepted -- waiting for required confirmations";        } else {            strError += ", rejected -- try again later";        }        LogPrintf("CGovernanceObject::IsCollateralValid -- %s/n", strError);        return false;    }    strError = "valid";    return true;}
开发者ID:dashpay,项目名称:dash,代码行数:89,


示例10: ParseHashUO

uint256 ParseHashUO(std::map<std::string,UniValue>& o, std::string strKey){    if (!o.count(strKey))        return uint256();    return ParseHashUV(o[strKey], strKey);}
开发者ID:evobits,项目名称:bitcoin,代码行数:6,


示例11: KimotoGravityWell

unsigned int KimotoGravityWell(const CBlockIndex* pindexLast, int algo) {		unsigned int nProofOfWorkLimit = Params().ProofOfWorkLimit(algo).GetCompact();	if (fDebug){    LogPrintf("Proof Of Work Limit For Algo %i, is % i/n", algo, nProofOfWorkLimit);    }    // Genesis block    if (pindexLast == NULL){		LogPrintf("Genesis Block Difficulty");        return nProofOfWorkLimit;	}	const CBlockIndex* pindexPrevAlgo = GetLastBlockIndexForAlgo(pindexLast, algo);    if (pindexPrevAlgo == NULL){		LogPrintf("pindexPrevAlgo == NULL for Algo %i, is % i/n", algo, nProofOfWorkLimit);        return nProofOfWorkLimit;	}    /* Franko Multi Algo Gravity Well */    const CBlockIndex   *BlockLastSolved                 = pindexPrevAlgo;    const CBlockIndex   *BlockReading                    = pindexPrevAlgo;	unsigned int		 AlgoCounter					 = 0;    uint64_t             PastBlocksMass                  = 0;    int64_t              PastRateActualSeconds           = 0;    int64_t              PastRateTargetSeconds           = 0;    double               PastRateAdjustmentRatio         = double(1);    uint256              PastDifficultyAverage;    uint256              PastDifficultyAveragePrev;    uint256              BlockReadingDifficulty;    double               EventHorizonDeviation;    double               EventHorizonDeviationFast;    double               EventHorizonDeviationSlow;    static const int64_t TargetBlockSpacing              = 60; // == 1 minute    unsigned int         TimeDaySeconds                  = 60 * 60 * 24;    int64_t              PastSecondsMin                  = TimeDaySeconds * 0.25; // == 6300 Seconds    int64_t              PastSecondsMax                  = TimeDaySeconds * 7; // == 604800 Seconds    uint64_t             PastBlocksMin                   = PastSecondsMin / TargetBlockSpacing; // == 360 blocks    uint64_t             PastBlocksMax                   = PastSecondsMax / TargetBlockSpacing; // == 10080 blocks	//loop through and count the blocks found by the algo	for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {        if (PastBlocksMax > 0 && i > PastBlocksMax) { break; }		// Makes sure we are only calculating blocks from the specified algo		if (BlockReading->GetAlgo() != algo){ BlockReading = BlockReading->pprev; continue; }		AlgoCounter++;		BlockReading = BlockReading->pprev;	}    if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 ||        (uint64_t)BlockLastSolved->nHeight < PastBlocksMin ||			AlgoCounter < PastBlocksMin) {        return Params().ProofOfWorkLimit(algo).GetCompact();    }        int64_t LatestBlockTime = BlockLastSolved->GetBlockTime();    BlockReading = pindexPrevAlgo;    for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {        if (PastBlocksMax > 0 && i > AlgoCounter) { break; }		// Makes sure we are only calculating blocks from the specified algo		if (BlockReading->GetAlgo() != algo){ BlockReading = BlockReading->pprev; continue; }        PastBlocksMass++;        if (i == 1) {            PastDifficultyAverage.SetCompact(BlockReading->nBits);        } else {            BlockReadingDifficulty.SetCompact(BlockReading->nBits);            if (BlockReadingDifficulty > PastDifficultyAveragePrev) {                PastDifficultyAverage = PastDifficultyAveragePrev + ((BlockReadingDifficulty - PastDifficultyAveragePrev) / i);            } else {                PastDifficultyAverage = PastDifficultyAveragePrev - ((PastDifficultyAveragePrev - BlockReadingDifficulty) / i);            }        }        PastDifficultyAveragePrev = PastDifficultyAverage;        if (LatestBlockTime < BlockReading->GetBlockTime()) {                LatestBlockTime = BlockReading->GetBlockTime();        }        PastRateActualSeconds = LatestBlockTime - BlockReading->GetBlockTime();        PastRateTargetSeconds = TargetBlockSpacing * PastBlocksMass;        PastRateAdjustmentRatio = double(1);                if (PastRateActualSeconds < 1) { PastRateActualSeconds = 1; }                if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {            PastRateAdjustmentRatio = double(PastRateTargetSeconds) / double(PastRateActualSeconds);        }        EventHorizonDeviation                   = 1 + (0.7084 * pow((double(PastBlocksMass)/double(144)), -1.228));        EventHorizonDeviationFast               = EventHorizonDeviation;        EventHorizonDeviationSlow               = 1 / EventHorizonDeviation;        if (PastBlocksMass >= PastBlocksMin) {            if ((PastRateAdjustmentRatio <= EventHorizonDeviationSlow) ||                (PastRateAdjustmentRatio >= EventHorizonDeviationFast)) {                assert(BlockReading);                break;            }        }//.........这里部分代码省略.........
开发者ID:synrg-labs,项目名称:ribbitcoin,代码行数:101,


示例12: CMainParams

    CMainParams() {        // The message start string is designed to be unlikely to occur in normal data.        pchMessageStart[0] = 0x05;        pchMessageStart[1] = 0x05;        pchMessageStart[2] = 0xb5;        pchMessageStart[3] = 0x05;        nDefaultPort = 5530;        nRPCPort = 5531;        bnProofOfWorkLimit = CBigNum(~uint256(0) >> 20);        nSubsidyHalvingInterval = 100000;        // Build the genesis block. Note that the output of the genesis coinbase cannot        // be spent as it did not originally exist in the database.          const char* pszTimestamp = "vcoin sn";        CTransaction txNew;        txNew.vin.resize(1);        txNew.vout.resize(1);        txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));        txNew.vout[0].nValue = 1 * COIN;        txNew.vout[0].scriptPubKey = CScript() << ParseHex("") << OP_CHECKSIG;        genesis.vtx.push_back(txNew);        genesis.hashPrevBlock = 0;        genesis.hashMerkleRoot = genesis.BuildMerkleTree();        genesis.nVersion = 1;        genesis.nTime    = 1431517588;        genesis.nBits    = 0x1e0fffff;        genesis.nNonce   = 1486592;                //// debug print        hashGenesisBlock = genesis.GetHash();        while (hashGenesisBlock > bnProofOfWorkLimit.getuint256()){            if (++genesis.nNonce==0) break;            hashGenesisBlock = genesis.GetHash();        }        printf("%s/n", hashGenesisBlock.ToString().c_str());        printf("%s/n", genesis.hashMerkleRoot.ToString().c_str());        printf("%x/n", bnProofOfWorkLimit.GetCompact());        genesis.print();                        assert(hashGenesisBlock == uint256("0x00000b7e804f0de87e7752550ff04d7686a4599509897feefd7f03904eb45633"));        assert(genesis.hashMerkleRoot == uint256("0x1576ef41775095b26a8f8f2bb65b693ec12230608a425aa84ee462381cae00e6"));        vSeeds.push_back(CDNSSeedData("1", "108.61.10.90"));        vSeeds.push_back(CDNSSeedData("2", "185.92.222.31"));        base58Prefixes[PUBKEY_ADDRESS] = 70;        base58Prefixes[SCRIPT_ADDRESS] = 30;        base58Prefixes[SECRET_KEY] = 224;        // Convert the pnSeeds array into usable address objects.        for (unsigned int i = 0; i < ARRAYLEN(pnSeed); i++)        {            // It'll only connect to one or two seed nodes because once it connects,            // it'll get a pile of addresses with newer timestamps.            // Seed nodes are given a random 'last seen time'             const int64 nTwoDays = 2 * 24 * 60 * 60;            struct in_addr ip;            memcpy(&ip, &pnSeed[i], sizeof(ip));            CAddress addr(CService(ip, GetDefaultPort()));            addr.nTime = GetTime() - GetRand(nTwoDays) - nTwoDays;            vFixedSeeds.push_back(addr);        }    }
开发者ID:chris-vl,项目名称:vcoin,代码行数:67,


示例13: assert

bool shamap::compare (shamap::ref othermap, delta& differences, int maxcount){    // compare two hash trees, add up to maxcount differences to the difference table    // return value: true=complete table of differences given, false=too many differences    // throws on corrupt tables or missing nodes    // caution: othermap is not locked and must be immutable    assert (isvalid () && othermap && othermap->isvalid ());    using stackentry = std::pair <shamaptreenode*, shamaptreenode*>;    std::stack <stackentry, std::vector<stackentry>> nodestack; // track nodes we've pushed    if (gethash () == othermap->gethash ())        return true;    nodestack.push ({root.get(), othermap->root.get()});    while (!nodestack.empty ())    {        shamaptreenode* ournode = nodestack.top().first;        shamaptreenode* othernode = nodestack.top().second;        nodestack.pop ();        if (!ournode || !othernode)        {            assert (false);            throw shamapmissingnode (mtype, uint256 ());        }        if (ournode->isleaf () && othernode->isleaf ())        {            // two leaves            if (ournode->gettag () == othernode->gettag ())            {                if (ournode->peekdata () != othernode->peekdata ())                {                    differences.insert (std::make_pair (ournode->gettag (),                                                 deltaref (ournode->peekitem (),                                                 othernode->peekitem ())));                    if (--maxcount <= 0)                        return false;                }            }            else            {                differences.insert (std::make_pair(ournode->gettag (),                                                   deltaref(ournode->peekitem(),                                                   shamapitem::pointer ())));                if (--maxcount <= 0)                    return false;                differences.insert(std::make_pair(othernode->gettag (),                                                  deltaref(shamapitem::pointer(),                                                  othernode->peekitem ())));                if (--maxcount <= 0)                    return false;            }        }        else if (ournode->isinner () && othernode->isleaf ())        {            if (!walkbranch (ournode, othernode->peekitem (),                    true, differences, maxcount))                return false;        }        else if (ournode->isleaf () && othernode->isinner ())        {            if (!othermap->walkbranch (othernode, ournode->peekitem (),                                       false, differences, maxcount))                return false;        }        else if (ournode->isinner () && othernode->isinner ())        {            for (int i = 0; i < 16; ++i)                if (ournode->getchildhash (i) != othernode->getchildhash (i))                {                    if (othernode->isemptybranch (i))                    {                        // we have a branch, the other tree does not                        shamaptreenode* inode = descendthrow (ournode, i);                        if (!walkbranch (inode,                                         shamapitem::pointer (), true,                                         differences, maxcount))                            return false;                    }                    else if (ournode->isemptybranch (i))                    {                        // the other tree has a branch, we do not                        shamaptreenode* inode =                            othermap->descendthrow(othernode, i);                        if (!othermap->walkbranch (inode,                                                   shamapitem::pointer(),                                                   false, differences, maxcount))                            return false;                    }                    else // the two trees have different non-empty branches                        nodestack.push ({descendthrow (ournode, i),                                        othermap->descendthrow (othernode, i)});                }        }        else            assert (false);//.........这里部分代码省略.........
开发者ID:moorecoin,项目名称:MooreCoinService,代码行数:101,


示例14: CMainParams

    CMainParams() {        // The message start string is designed to be unlikely to occur in normal data.        pchMessageStart[0] = 0x12;        pchMessageStart[1] = 0x0c;        pchMessageStart[2] = 0x07;        pchMessageStart[3] = 0xdd;        nDefaultPort = 18123;        nRPCPort = 18124;        bnProofOfWorkLimit = CBigNum(~uint256(0) >> 20);        //nSubsidyHalvingInterval = 100000;        // Build the genesis block. Note that the output of the genesis coinbase cannot        // be spent as it did not originally exist in the database.          const char* pszTimestamp = "LeaCoin - for Lea, my little sweetie. :-)";        CTransaction txNew;        txNew.vin.resize(1);        txNew.vout.resize(1);        txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));        txNew.vout[0].nValue = 1 * COIN;        txNew.vout[0].scriptPubKey = CScript() << ParseHex("") << OP_CHECKSIG;        genesis.vtx.push_back(txNew);        genesis.hashPrevBlock = 0;        genesis.hashMerkleRoot = genesis.BuildMerkleTree();        genesis.nVersion = 1;        genesis.nTime    = 1387357200;        genesis.nBits    = 0x1e0fffff;        genesis.nNonce   = 647623;                //// debug print        hashGenesisBlock = genesis.GetHash();        //while (hashGenesisBlock > bnProofOfWorkLimit.getuint256()){        //    if (++genesis.nNonce==0) break;        //    hashGenesisBlock = genesis.GetHash();        //}        printf("%s/n", hashGenesisBlock.ToString().c_str());        printf("%s/n", genesis.hashMerkleRoot.ToString().c_str());        printf("%x/n", bnProofOfWorkLimit.GetCompact());        genesis.print();                        assert(hashGenesisBlock == uint256("0x00000a33e2728123ae58837d86248e19c3530a603aa9b59228fc9954ef2c93e0"));        assert(genesis.hashMerkleRoot == uint256("0x448cd8630d0904ac9bb61d6fb51a0c3b25b707913b3f5a91af4e2220934690da"));        vSeeds.push_back(CDNSSeedData("leacoin.org", "dnsseed.leacoin.org"));        base58Prefixes[PUBKEY_ADDRESS] = 48;        base58Prefixes[SCRIPT_ADDRESS] = 30;        base58Prefixes[SECRET_KEY] = 224;        // Convert the pnSeeds array into usable address objects.        for (unsigned int i = 0; i < ARRAYLEN(pnSeed); i++)        {            // It'll only connect to one or two seed nodes because once it connects,            // it'll get a pile of addresses with newer timestamps.            // Seed nodes are given a random 'last seen time'             const int64 nTwoDays = 2 * 24 * 60 * 60;            struct in_addr ip;            memcpy(&ip, &pnSeed[i], sizeof(ip));            CAddress addr(CService(ip, GetDefaultPort()));            addr.nTime = GetTime() - GetRand(nTwoDays) - nTwoDays;            vFixedSeeds.push_back(addr);        }    }
开发者ID:cyberpay,项目名称:CyberPay,代码行数:66,


示例15: CMainParams

    CMainParams() {        // The message start string is designed to be unlikely to occur in normal data.        pchMessageStart[0] = 0x66;        pchMessageStart[1] = 0x66;        pchMessageStart[2] = 0x66;        pchMessageStart[3] = 0x66;        nDefaultPort = 24242;        nRPCPort = 24243;        bnProofOfWorkLimit = CBigNum(~uint256(0) >> 20);        nSubsidyHalvingInterval = 35040000;        // Build the genesis block. Note that the output of the genesis coinbase cannot        // be spent as it did not originally exist in the database.          const char* pszTimestamp = "Release the Kraken - www.krakencoin.com";        CTransaction txNew;        txNew.vin.resize(1);        txNew.vout.resize(1);        txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));        txNew.vout[0].nValue = 1 * COIN;        txNewvout1nValue = 5;        txNewvout2nValue = 450000 * COIN;        txNew.vout[0].scriptPubKey = CScript() << ParseHex("") << OP_CHECKSIG;        genesis.vtx.push_back(txNew);        genesis.hashPrevBlock = 0;        genesis.hashMerkleRoot = genesis.BuildMerkleTree();        genesis.nVersion = 1;        genesis.nTime    = 1394270601;        genesis.nBits    = 0x1e0fffff;        genesis.nNonce   = 943874;                //// debug print        hashGenesisBlock = genesis.GetHash();        //while (hashGenesisBlock > bnProofOfWorkLimit.getuint256()){          //  if (++genesis.nNonce==0) break;            //hashGenesisBlock = genesis.GetHash();        //}        printf("%s/n", hashGenesisBlock.ToString().c_str());        printf("%s/n", genesis.hashMerkleRoot.ToString().c_str());        printf("%x/n", bnProofOfWorkLimit.GetCompact());        genesis.print();                        assert(hashGenesisBlock == uint256("0x00000e9d058285796d9d49c3110a98c9367d25b7ab82cab06088f29ff4160b2a"));        assert(genesis.hashMerkleRoot == uint256("0x67cf79c130dc3b7f3a164ffde6d4ff3b30fb3847e649e5ab8c889cbcba8db40d"));        vSeeds.push_back(CDNSSeedData("162.243.90.199", "162.243.90.199"));        base58Prefixes[PUBKEY_ADDRESS] = 45;        base58Prefixes[SCRIPT_ADDRESS] = 30;        base58Prefixes[SECRET_KEY] = 224;        // Convert the pnSeeds array into usable address objects.        for (unsigned int i = 0; i < ARRAYLEN(pnSeed); i++)        {            // It'll only connect to one or two seed nodes because once it connects,            // it'll get a pile of addresses with newer timestamps.            // Seed nodes are given a random 'last seen time'             const int64 nTwoDays = 2 * 24 * 60 * 60;            struct in_addr ip;            memcpy(&ip, &pnSeed[i], sizeof(ip));            CAddress addr(CService(ip, GetDefaultPort()));            addr.nTime = GetTime() - GetRand(nTwoDays) - nTwoDays;            vFixedSeeds.push_back(addr);        }    }
开发者ID:krakencoin,项目名称:krakencoin,代码行数:68,


示例16: AntiGravityWave

// AntiGravityWave by reorder, derived from code by Evan Duffield - [email
C++ uint256S函数代码示例
C++ uint16_tobuffer函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。