本文整理汇总了C++中TrieNode::SetKey方法的典型用法代码示例。如果您正苦于以下问题:C++ TrieNode::SetKey方法的具体用法?C++ TrieNode::SetKey怎么用?C++ TrieNode::SetKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrieNode
的用法示例。
在下文中一共展示了TrieNode::SetKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addr
CMainParams() {
// The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ASCII, not valid as UTF-8, and produce
// a large 4-byte int at any alignment.
pchMessageStart[0] = 0xf9;
pchMessageStart[1] = 0xbe;
pchMessageStart[2] = 0xb4;
pchMessageStart[3] = 0xd9;
vAlertPubKey = ParseHex("038b1e94fa4d647bb8ea50b1540b2a04846181fd10d87e35b609311054ab02cba3");
nDefaultPort = 8253;
nRPCPort = 8252;
bnProofOfWorkLimit = CBigNum(~uint256(0) >> 20);
nSubsidyHalvingInterval = 210000;
//printf("Target: %s\n", GetTargetWork(4096.0).GetHex().c_str()); exit(0);
// Build the genesis block. Note that the output of the genesis coinbase cannot
// be spent as it did not originally exist in the database.
//
// CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
// CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
// CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
// CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
// vMerkleTree: 4a5e1e
CTransaction txNew;
txNew.vin.resize(0);
txNew.vout.resize(1);
txNew.vout[0].nValue = MAX_MONEY; //All coins created in genesis
txNew.vout[0].pubKey = 0; //Genesis target is coinbase
txNew.nLockHeight=0;
string msg = "2014/07/27 - Epoch Times - How Bitcoin Compares...";
txNew.msg = vector<char>(msg.begin(),msg.end());
genesis.vtx.push_back(txNew);
genesis.hashPrevBlock = 0;
genesis.hashMerkleRoot = genesis.BuildMerkleTree();
//Build a single trienode to find the hash of the coinbase only trie
TrieNode *coinbase = new TrieNode(NODE_LEAF);
coinbase->SetKey(0);
coinbase->SetBalance(txNew.vout[0].nValue);
genesis.hashAccountRoot = coinbase->Hash(); //TODO: get the trie hash
delete coinbase;
genesis.nVersion = 1;
genesis.nHeight = 0;
genesis.nTime = 1406509200;
genesis.nNonce = 1041215929;
hashGenesisBlock = genesis.GetHash();
//printf("%s\n", genesis.GetHash().ToString().c_str());
//printf("%s\n", genesis.hashMerkleRoot.ToString().c_str());
assert(genesis.hashMerkleRoot == uint256("0x9dabd47e692ed615eae95da0c95f195a7dea9428bb9f9e0cd4c7d12533bf3667"));
if(hashGenesisBlock != uint256("0x000009a460ccc429ac6e53c91c6ed2d96697884b8b656a903042faff8971c5aa"))
MineGenesis(genesis);
vSeeds.push_back(CDNSSeedData("gpile.it", "gpile.it"));
//sa ToDO: Review. The convert_to_container stuff was added as a quick fix to get it building in c++11. it should work
// but not 100% certain and haven't tested
base58Prefixes[PUBKEY_ADDRESS] = (list_of(28)).convert_to_container<vector<unsigned char> >();
base58Prefixes[SCRIPT_ADDRESS] = (list_of(5)).convert_to_container<vector<unsigned char> >();
base58Prefixes[SECRET_KEY] = (list_of(128)).convert_to_container<vector<unsigned char> >();
base58Prefixes[EXT_PUBLIC_KEY] = (list_of(0x04)(0x88)(0xB2)(0x1E)).convert_to_container<vector<unsigned char> >();
base58Prefixes[EXT_SECRET_KEY] = (list_of(0x04)(0x88)(0xAD)(0xE4)).convert_to_container<vector<unsigned char> >();
// 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' of between one and two
// weeks ago.
const int64_t nOneWeek = 7*24*60*60;
struct in_addr ip;
memcpy(&ip, &pnSeed[i], sizeof(ip));
CAddress addr(CService(ip, GetDefaultPort()));
addr.nTime = GetTime() - GetRand(nOneWeek) - nOneWeek;
vFixedSeeds.push_back(addr);
}
}