enum plugin_status plugin_start(const void* parameter) { int action, i; struct jackpot game; (void)parameter; rb->srand(*rb->current_tick); #ifdef HAVE_LCD_CHARCELLS patterns_init(rb->screens[SCREEN_MAIN]); #endif /* HAVE_LCD_CHARCELLS */ jackpot_init(&game); FOR_NB_SCREENS(i){ rb->screens[i]->clear_display(); jackpot_display_slot_machine(&game, rb->screens[i]); } /*Empty the event queue*/ rb->button_clear_queue(); while (true) { action = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, ARRAYLEN(plugin_contexts)); switch ( action ) { case PLA_CANCEL: return PLUGIN_OK; case PLA_SELECT: jackpot_play_turn(&game); break; default: if (rb->default_event_handler_ex(action, jackpot_exit, NULL) == SYS_USB_CONNECTED) return PLUGIN_USB_CONNECTED; break; } } jackpot_exit(NULL); return PLUGIN_OK; }
TEST(Utf8Utils, utf8IsValid) { static const struct { bool expected; const char* text; size_t textLen; } kData[] = { DATA(true, ""), DATA(true, "Hello World!"), DATA(true, "T\xC3\xA9l\xC3\xA9vision"), DATA(false, "\x80\x80"), DATA(true, "\xC1\xB6"), DATA(false, "\xC0\x7f"), DATA(true, "foo\xE0\x80\x80"), DATA(false, "foo\xE0\x80"), }; const size_t kDataSize = ARRAYLEN(kData); for (size_t n = 0; n < kDataSize; ++n) { EXPECT_EQ(kData[n].expected, utf8IsValid(kData[n].text, kData[n].textLen)) << "#" << n; } }
mxArray* popPage() { size_t M,N,maxMN; double retVal; mxArray* tmp; biEntry* cmdStruct = lookupEntry("PageList", vars, ARRAYLEN(vars)); if (cmdStruct->var == NULL) { return cmdStruct->getter(cmdStruct); } else { retVal = mxGetScalar(cmdStruct->var); M = mxGetM(cmdStruct->var); N = mxGetN(cmdStruct->var); maxMN = M > N ? M : N; tmp = mxCreateDoubleMatrix(1, maxMN - 1, mxREAL); memcpy(mxGetPr(tmp), mxGetPr(cmdStruct->var) + 1, (maxMN - 1)*sizeof(double)); cmdStruct->setter(cmdStruct, tmp); return mxCreateDoubleScalar(retVal); } }
void settings_apply_skins(void) { char buf[MAX_PATH]; /* re-initialize the skin buffer before we start reloading skins */ skin_buffer_init(); enum screen_type screen = SCREEN_MAIN; unsigned int i; #ifdef HAVE_LCD_BITMAP skin_backdrop_init(); skin_font_init(); #endif #if CONFIG_TUNER fms_skin_init(); #endif for (i=0; i<ARRAYLEN(skins); i++) { #ifdef HAVE_REMOTE_LCD screen = skins[i].suffix[0] == 'r' ? SCREEN_REMOTE : SCREEN_MAIN; #endif CHART2(">skin load ", skins[i].suffix); if (skins[i].setting[0] && skins[i].setting[0] != '-') { snprintf(buf, sizeof buf, WPS_DIR "/%s.%s", skins[i].setting, skins[i].suffix); skins[i].loadfunc(screen, buf, true); } else { skins[i].loadfunc(screen, NULL, true); } CHART2("<skin load ", skins[i].suffix); } viewportmanager_theme_changed(THEME_STATUSBAR); #if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 FOR_NB_SCREENS(i) screens[i].backdrop_show(sb_get_backdrop(i)); #endif }
void mspClientProcess(void) { static uint8_t index = 0; bool busy = mspPorts[1].commandSenderFn != NULL; if (busy) { return; } commandToSend = commandsToSend[index]; mspPorts[1].commandSenderFn = mspRequestFCSimpleCommandSender; index++; if (index >= ARRAYLEN(commandsToSend)) { index = 0; } // // handle timeout of received data. // uint32_t now = micros(); mspClientStatus.timeoutOccured = (cmp32(now, mspClientStatus.lastReplyAt) >= MSP_CLIENT_TIMEOUT_INTERVAL); }
/* Buffer a block of sound data for the given sound. Return the number of * frames buffered, or a RageSoundReader return code. */ int RageSoundDriver::GetDataForSound( Sound &s ) { sound_block *p[2]; unsigned psize[2]; s.m_Buffer.get_write_pointers( p, psize ); /* If we have no open buffer slot, we have a buffer overflow. */ ASSERT( psize[0] > 0 ); sound_block *pBlock = p[0]; int size = ARRAYLEN(pBlock->m_Buffer)/channels; int iRet = s.m_pSound->GetDataToPlay( pBlock->m_Buffer, size, pBlock->m_iPosition, pBlock->m_FramesInBuffer ); if( iRet > 0 ) { pBlock->m_BufferNext = pBlock->m_Buffer; s.m_Buffer.advance_write_pointer( 1 ); } // LOG->Trace( "incr fr wr %i (state %i) (%p)", // (int) pBlock->m_FramesInBuffer, s.m_State, s.m_pSound ); return iRet; }
bool dbg_hw_info_dma(void) { lcd_setfont(FONT_SYSFIXED); while(1) { int button = get_action(CONTEXT_STD, HZ / 25); switch(button) { case ACTION_STD_NEXT: case ACTION_STD_PREV: case ACTION_STD_OK: case ACTION_STD_MENU: lcd_setfont(FONT_UI); return true; case ACTION_STD_CANCEL: lcd_setfont(FONT_UI); return false; } lcd_clear_display(); lcd_putsf(0, 0, "S C name bar apb ahb una"); for(unsigned i = 0; i < ARRAYLEN(dbg_channels); i++) { struct imx233_dma_info_t info = imx233_dma_get_info(dbg_channels[i].chan, DMA_INFO_ALL); lcd_putsf(0, i + 1, "%c %c %4s %8x %3x %3x %3x", info.gated ? 'g' : info.freezed ? 'f' : ' ', !info.int_enabled ? '-' : info.int_error ? 'e' : info.int_cmdcomplt ? 'c' : ' ', dbg_channels[i].name, info.bar, info.apb_bytes, info.ahb_bytes, info.nr_unaligned); } lcd_update(); yield(); } }
// 移動通知 void Movable::notify( int gen_ftype ) { KServer *sessions[MAX_CLIENT]; int n = g_listener->GetChildren((vce::Session**)sessions, ARRAYLEN(sessions)); for(int i=0;i<n;i++){ PlayerCharacter *pc = sessions[i]->getPC(); if(pc){ // 同じフロアの近くにいるプレイヤーに伝える if( pc->floor != this->floor || pc->coord.distance( this->coord ) > NOTIFY_DISTANCE )continue; } else { // pcが無くても特別にwatchする状態だったら送る Coord c; vce::VUint32 flid; if( sessions[i]->isViewmode(&c, &flid ) == false ) continue; if( this->floor->id != flid || this->coord.distance( c ) > NOTIFY_DISTANCE )continue; } switch( gen_ftype ){ case k_proto::FUNCTION_MOVENOTIFY: sessions[i]->send_moveNotify( this->id, this->typeID, this->name.c_str(), this->coord.x, this->coord.y, this->floor->id ); break; case k_proto::FUNCTION_DISAPPEARNOTIFY: sessions[i]->send_disappearNotify( this->id ); break; } } }
const glyph &Font::GetGlyph( wchar_t c ) const { //ASSERT(c >= 0 && c <= 0xFFFFFF); // shooting a blank really...DarkLink kept running into the stupid assert with non-roman song titles, // and looking at it, I'm gonna guess that this is how ITG2 prevented crashing with them // --infamouspat if (c < 0 || c > 0xFFFFFF) c = 1; /* Fast path: */ if( c < (int) ARRAYLEN(m_iCharToGlyphCache) && m_iCharToGlyphCache[c] ) return *m_iCharToGlyphCache[c]; /* Try the regular character. */ map<longchar,glyph*>::const_iterator it = m_iCharToGlyph.find(c); /* If that's missing, use the default glyph. */ if(it == m_iCharToGlyph.end()) it = m_iCharToGlyph.find(DEFAULT_GLYPH); if(it == m_iCharToGlyph.end()) RageException::Throw( "The default glyph is missing from the font '%s'", path.c_str() ); return *it->second; }
static bool clix_help(void) { static char *help_text[] = { "Clix", "", "Aim", "", "Remove", "all", "blocks", "from", "the", "board", "to", "achieve", "the", "next", "level.", "You", "can", "only", "remove", "blocks,", "if", "at", "least", "two", "blocks", "with", "the", "same", "color", "have", "a", "direct", "connection.", "The", "more", "blocks", "you", "remove", "per", "turn,", "the", "more", "points", "you", "get." }; static struct style_text formation[]={ { 0, TEXT_CENTER|TEXT_UNDERLINE }, { 2, C_RED }, LAST_STYLE_ITEM }; rb->lcd_setfont(FONT_UI); rb->lcd_set_foreground(LCD_WHITE); if (display_text(ARRAYLEN(help_text), help_text, formation, NULL, true)) return true; rb->lcd_setfont(FONT_SYSFIXED); return false; }
CMainParams() { strNetworkID = "main"; consensus.nSubsidyHalvingInterval = 100000; // Note: actual number of blocks per calendar year with DGW v3 is ~200700 (for example 449750 - 249050) consensus.nMasternodePaymentsStartBlock = 100000; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock consensus.nMasternodePaymentsIncreaseBlock = 158000; // actual historical value consensus.nMasternodePaymentsIncreasePeriod = 576*30; // 17280 - actual historical value consensus.nInstantSendKeepLock = 24; consensus.nBudgetPaymentsStartBlock = 328008; // actual historical value consensus.nBudgetPaymentsCycleBlocks = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725 consensus.nBudgetPaymentsWindowBlocks = 100; consensus.nBudgetProposalEstablishingTime = 60*60*24; consensus.nSuperblockStartBlock = 614820; // The block at which 12.1 goes live (end of final 12.0 budget cycle) consensus.nSuperblockCycle = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725 consensus.nGovernanceMinQuorum = 10; consensus.nGovernanceFilterElements = 20000; consensus.nMasternodeMinimumConfirmations = 15; consensus.nMajorityEnforceBlockUpgrade = 750; consensus.nMajorityRejectBlockOutdated = 950; nLastPOWBlock = 200; nMaturity = 50; consensus.nMajorityWindow = 1000; consensus.BIP34Height = 1; consensus.BIP34Hash = uint256S("0x000007d91d1254d60e2dd1ae580383070a4ddffa4c64c2eeb4a2f9ecc0414343"); consensus.powLimit = uint256S("00000fffff000000000000000000000000000000000000000000000000000000"); consensus.nPowTargetTimespan = 24 * 60 * 60; // Gridcoin: 1 day consensus.nPowTargetSpacing = 2.5 * 60; // Gridcoin: 2.5 minutes consensus.fPowAllowMinDifficultyBlocks = false; consensus.fPowNoRetargeting = false; consensus.nRuleChangeActivationThreshold = 1916; // 95% of 2016 consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008 consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008 // Deployment of BIP68, BIP112, and BIP113. consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0; consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1486252800; // Feb 5th, 2017 consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1517788800; // Feb 5th, 2018 // Deployment of DIP0001 consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].bit = 1; consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nStartTime = 1508025600; // Oct 15th, 2017 consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nTimeout = 1539561600; // Oct 15th, 2018 consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nWindowSize = 4032; consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nThreshold = 3226; // 80% of 4032 // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000172210fe351643b3f1"); // 750000 // By default assume that the signatures in ancestors of this block are valid. consensus.defaultAssumeValid = uint256S("0x00000000000000b4181bbbdddbae464ce11fede5d0292fb63fdede1e7c8ab21c"); //750000 /** * 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 32-bit integer with any alignment. */ pchMessageStart[0] = 0xbf; pchMessageStart[1] = 0x0c; pchMessageStart[2] = 0x6b; pchMessageStart[3] = 0xbd; vAlertPubKey = ParseHex("0x0"); nDefaultPort = 32739; nMaxTipAge = 6 * 60 * 60; // ~144 blocks behind -> 2 x fork detection time, was 24 * 60 * 60 in bitcoin nDelayGetHeadersTime = 24 * 60 * 60; nPruneAfterHeight = 100000; genesis = CreateGenesisBlock(1511309700, 2033640, 0x1e0ffff0, 1, 50 * COIN, 0); consensus.hashGenesisBlock = genesis.GetHash(); assert(consensus.hashGenesisBlock == uint256S("0x00000bbfdb174286fad36fa3e12bc0976c6181bb6fdf7b2a30caacc1b61b04b4")); assert(genesis.hashMerkleRoot == uint256S("0x4442ce0b92014dba69e4c6664ab88081b4d1d2eb6bcafa281f8d712a356011ce")); vSeeds.push_back(CDNSSeedData("gridcoin.org", "dnsseed.gridcoin.org")); vSeeds.push_back(CDNSSeedData("gridcoindot.io", "dnsseed.gridcoindot.io")); vSeeds.push_back(CDNSSeedData("masternode.io", "dnsseed.masternode.io")); vSeeds.push_back(CDNSSeedData("gridcoin.io", "dnsseed.gridcoin.io")); // Gridcoin addresses start with 'R' & 'S' base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,62); // Gridcoin script addresses start with Z base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,85); // Gridcoin private keys start with 'Z' base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,128+62); // Gridcoin BIP32 pubkeys start with 'xpub' (Bitcoin defaults) base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E).convert_to_container<std::vector<unsigned char> >(); // Gridcoin BIP32 prvkeys start with 'xprv' (Bitcoin defaults) base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4).convert_to_container<std::vector<unsigned char> >(); // Gridcoin BIP44 coin type is '5' nExtCoinType = 5; vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main)); fMiningRequiresPeers = false; fDefaultConsistencyChecks = false; fRequireStandard = true; fMineBlocksOnDemand = false; fTestnetToBeDeprecatedFieldRPC = false; nPoolMaxTransactions = 3; nFulfilledRequestExpireTime = 60*60; // fulfilled requests expire in 1 hour strSporkPubKey = ""; checkpointData = (CCheckpointData) { boost::assign::map_list_of ( 0, uint256S("0x0")) ( 0, uint256S("0x0")), 1507424630, // * UNIX timestamp of last checkpoint block 3701128, // * total number of transactions between genesis and last checkpoint // (the tx=... number in the SetBestChain debug.log lines) 5000 // * estimated number of transactions per day after checkpoint }; }
// Mode 3 //helptext int CmdHF15Demod(const char *Cmd) { char cmdp = param_getchar(Cmd, 0); if (cmdp == 'h' || cmdp == 'H') return usage_15_demod(); // The sampling rate is 106.353 ksps/s, for T = 18.8 us int i, j; int max = 0, maxPos = 0; int skip = 4; if (GraphTraceLen < 1000) return 0; // First, correlate for SOF for (i = 0; i < 1000; i++) { int corr = 0; for (j = 0; j < ARRAYLEN(FrameSOF); j += skip) { corr += FrameSOF[j] * GraphBuffer[i + (j / skip)]; } if (corr > max) { max = corr; maxPos = i; } } PrintAndLogEx(NORMAL, "SOF at %d, correlation %d", maxPos, max / (ARRAYLEN(FrameSOF) / skip)); i = maxPos + ARRAYLEN(FrameSOF) / skip; int k = 0; uint8_t outBuf[20]; memset(outBuf, 0, sizeof(outBuf)); uint8_t mask = 0x01; for (;;) { int corr0 = 0, corr1 = 0, corrEOF = 0; for (j = 0; j < ARRAYLEN(Logic0); j += skip) { corr0 += Logic0[j] * GraphBuffer[i + (j / skip)]; } for (j = 0; j < ARRAYLEN(Logic1); j += skip) { corr1 += Logic1[j] * GraphBuffer[i + (j / skip)]; } for (j = 0; j < ARRAYLEN(FrameEOF); j += skip) { corrEOF += FrameEOF[j] * GraphBuffer[i + (j / skip)]; } // Even things out by the length of the target waveform. corr0 *= 4; corr1 *= 4; if (corrEOF > corr1 && corrEOF > corr0) { PrintAndLogEx(NORMAL, "EOF at %d", i); break; } else if (corr1 > corr0) { i += ARRAYLEN(Logic1) / skip; outBuf[k] |= mask; } else { i += ARRAYLEN(Logic0) / skip; } mask <<= 1; if (mask == 0) { k++; mask = 0x01; } if ((i + (int)ARRAYLEN(FrameEOF)) >= GraphTraceLen) { PrintAndLogEx(NORMAL, "ran off end!"); break; } } if (mask != 0x01) { PrintAndLogEx(WARNING, "Error, uneven octet! (discard extra bits!)"); PrintAndLogEx(NORMAL, " mask = %02x", mask); } PrintAndLogEx(NORMAL, "%d octets", k); for (i = 0; i < k; i++) PrintAndLogEx(NORMAL, "# %2d: %02x ", i, outBuf[i]); PrintAndLogEx(NORMAL, "CRC %04x", Crc(outBuf, k - 2)); return 0; }
CTestNetParams() { strNetworkID = "test"; consensus.nSubsidyHalvingInterval = 210240; consensus.nMasternodePaymentsStartBlock = 4010; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock consensus.nMasternodePaymentsIncreaseBlock = 4030; consensus.nMasternodePaymentsIncreasePeriod = 10; consensus.nInstantSendKeepLock = 6; consensus.nBudgetPaymentsStartBlock = 4100; consensus.nBudgetPaymentsCycleBlocks = 50; consensus.nBudgetPaymentsWindowBlocks = 10; consensus.nBudgetProposalEstablishingTime = 60*20; consensus.nSuperblockStartBlock = 4200; // NOTE: Should satisfy nSuperblockStartBlock > nBudgetPeymentsStartBlock consensus.nSuperblockCycle = 24; // Superblocks can be issued hourly on testnet consensus.nGovernanceMinQuorum = 1; consensus.nGovernanceFilterElements = 500; consensus.nMasternodeMinimumConfirmations = 1; consensus.nMajorityEnforceBlockUpgrade = 51; consensus.nMajorityRejectBlockOutdated = 75; consensus.nMajorityWindow = 100; consensus.BIP34Height = 1; consensus.BIP34Hash = uint256S("0x0000047d24635e347be3aaaeb66c26be94901a2f962feccd4f95090191f208c1"); consensus.powLimit = uint256S("00000fffff000000000000000000000000000000000000000000000000000000"); consensus.nPowTargetTimespan = 24 * 60 * 60; // Gridcoin: 1 day consensus.nPowTargetSpacing = 2.5 * 60; // Gridcoin: 2.5 minutes consensus.fPowAllowMinDifficultyBlocks = true; consensus.fPowNoRetargeting = false; consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008 consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008 // Deployment of BIP68, BIP112, and BIP113. consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0; consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1506556800; // September 28th, 2017 consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1538092800; // September 28th, 2018 // Deployment of DIP0001 consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].bit = 1; consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nStartTime = 1505692800; // Sep 18th, 2017 consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nTimeout = 1537228800; // Sep 18th, 2018 consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nWindowSize = 100; consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nThreshold = 50; // 50% of 100 // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S("00000000000000000000000000000000000000000000000000000003cd72a542"); //4000 // By default assume that the signatures in ancestors of this block are valid. consensus.defaultAssumeValid = uint256S("00000ce22113f3eb8636e225d6a1691e132fdd587aed993e1bc9b07a0235eea4"); //4000 nLastPOWBlock = 200; nMaturity = 15; pchMessageStart[0] = 0xce; pchMessageStart[1] = 0xe2; pchMessageStart[2] = 0xca; pchMessageStart[3] = 0xff; vAlertPubKey = ParseHex(""); nDefaultPort = 32748; nMaxTipAge = 0x7fffffff; // allow mining on top of old blocks for testnet nDelayGetHeadersTime = 24 * 60 * 60; nPruneAfterHeight = 1000; int iNonce; for (iNonce=1356250; iNonce < 99999999; iNonce++) { genesis = CreateGenesisBlock(1511309285, iNonce, 0x1e0ffff0, 1, 50 * COIN, 1); arith_uint256 hashTarget = arith_uint256().SetCompact(genesis.nBits); if (UintToArith256(genesis.GetHash()) <= hashTarget) break; } consensus.hashGenesisBlock = genesis.GetHash(); printf("Genesis Check testnet %f \n",(double)iNonce); printf("Genesis hash %s, MerkleRoot %s \n",genesis.GetHash().GetHex().c_str(), genesis.hashMerkleRoot.GetHex().c_str()); assert(consensus.hashGenesisBlock == uint256S("0x0000094271fd4996a2be9951d2f45b1cf75da8dd59dbba009de2e44d0050843f")); assert(genesis.hashMerkleRoot == uint256S("0x4442ce0b92014dba69e4c6664ab88081b4d1d2eb6bcafa281f8d712a356011ce")); vFixedSeeds.clear(); vSeeds.clear(); vSeeds.push_back(CDNSSeedData("gridcoindot.io", "testnet-seed.gridcoindot.io")); vSeeds.push_back(CDNSSeedData("masternode.io", "test.dnsseed.masternode.io")); // Testnet Gridcoin addresses start with 'y' base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,140); // Testnet Gridcoin script addresses start with '8' or '9' base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,19); // Testnet private keys start with '9' or 'c' (Bitcoin defaults) base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239); // Testnet Gridcoin BIP32 pubkeys start with 'tpub' (Bitcoin defaults) base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >(); // Testnet Gridcoin BIP32 prvkeys start with 'tprv' (Bitcoin defaults) base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >(); // Testnet Gridcoin BIP44 coin type is '1' (All coin's testnet default) nExtCoinType = 1; vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test)); fMiningRequiresPeers = false; fDefaultConsistencyChecks = false; fRequireStandard = false; fMineBlocksOnDemand = false; fTestnetToBeDeprecatedFieldRPC = true; nPoolMaxTransactions = 3; nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes strSporkPubKey = "046f78dcf911fbd61910136f7f0f8d90578f68d0b3ac973b5040fb7afb501b5939f39b108b0569dca71488f5bbf498d92e4d1194f6f941307ffd95f75e76869f0e"; checkpointData = (CCheckpointData) { boost::assign::map_list_of ( 0, uint256S("0x0")) ( 0, uint256S("0x0")), 1462856598, // * UNIX timestamp of last checkpoint block 3094, // * total number of transactions between genesis and last checkpoint // (the tx=... number in the SetBestChain debug.log lines) 500 // * estimated number of transactions per day after checkpoint }; }
enum plugin_status plugin_start(const void* parameter) { int button; #ifdef MAZE_NEW_PRE int lastbutton = BUTTON_NONE; #endif int quit = 0; struct maze maze; (void)parameter; /* Turn off backlight timeout */ backlight_ignore_timeout(); /* Seed the RNG */ rb->srand(*rb->current_tick); FOR_NB_SCREENS(i) rb->screens[i]->set_viewport(NULL); /* Draw the background */ #if LCD_DEPTH > 1 rb->lcd_set_backdrop(NULL); #if LCD_DEPTH >= 16 rb->lcd_set_foreground(LCD_RGBPACK( 0, 0, 0)); rb->lcd_set_background(LCD_RGBPACK(182, 198, 229)); /* rockbox blue */ #elif LCD_DEPTH == 2 rb->lcd_set_foreground(0); rb->lcd_set_background(LCD_DEFAULT_BG); #endif #endif /* Initialize and draw the maze */ maze_init(&maze); maze_generate(&maze); FOR_NB_SCREENS(i) maze_draw(&maze, rb->screens[i]); while(!quit) { #ifdef __PLUGINLIB_ACTIONS_H__ button = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, ARRAYLEN(plugin_contexts)); #else button = rb->button_get(true); #endif switch(button) { case MAZE_NEW: #ifdef MAZE_NEW_PRE if(lastbutton != MAZE_NEW_PRE) break; #endif maze_init(&maze); maze_generate(&maze); FOR_NB_SCREENS(i) maze_draw(&maze, rb->screens[i]); break; case MAZE_SOLVE: maze_solve(&maze); FOR_NB_SCREENS(i) maze_draw(&maze, rb->screens[i]); break; case MAZE_UP: case MAZE_UP_REPEAT: maze_move_player_up(&maze); FOR_NB_SCREENS(i) maze_draw(&maze, rb->screens[i]); break; case MAZE_RIGHT: case MAZE_RIGHT_REPEAT: maze_move_player_right(&maze); FOR_NB_SCREENS(i) maze_draw(&maze, rb->screens[i]); break; case MAZE_DOWN: case MAZE_DOWN_REPEAT: maze_move_player_down(&maze); FOR_NB_SCREENS(i) maze_draw(&maze, rb->screens[i]); break; case MAZE_LEFT: case MAZE_LEFT_REPEAT: maze_move_player_left(&maze); FOR_NB_SCREENS(i) maze_draw(&maze, rb->screens[i]); break; case MAZE_QUIT: /* quit plugin */ quit=1; break; default: if (rb->default_event_handler(button) == SYS_USB_CONNECTED) { /* quit plugin */ quit=2; } break; } #ifdef MAZE_NEW_PRE if( button != BUTTON_NONE ) lastbutton = button; #endif } /* Turn on backlight timeout (revert to settings) */ backlight_use_settings(); return ((quit == 1) ? PLUGIN_OK : PLUGIN_USB_CONNECTED); }
#include "global.h" #include "io/G15.h" #include "RageLog.h" #include "RageUtil.h" #include "arch/USB/USBDriver_Impl.h" const unsigned short G15_VENDOR_ID = 0x046D; const unsigned short G15_PRODUCT_ID[] = { 0xC227, 0xC251 }; const unsigned NUM_PRODUCT_IDS = ARRAYLEN( G15_PRODUCT_ID ); /* 10 ms */ const unsigned REQ_TIMEOUT = 10000; void PixmapToLCDData( const unsigned char *pData, unsigned char *pLCD ) { ASSERT(pLCD); ASSERT(pData); memset(pLCD, 0, 992); pLCD[0] = 0x03; // ?_? for( unsigned row = 0; row < 43; row++ ) { for( unsigned col = 0; col < 160; col++ ) { if ( pData[row*160+col] == 0x01 ) { pLCD[(row/8)*160 + col + 32] |= 1 << (row%8);
CMainParams() { strNetworkID = "main"; consensus.nSubsidyHalvingInterval = 210000; consensus.BIP34Height = 227931; consensus.BIP34Hash = uint256S("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"); consensus.BIP65Height = 388381; // 000000000000000004c2b624ed5d7756c508d90fd0da2c7c679febfa6c4735f0 consensus.BIP66Height = 363725; // 00000000000000000379eaa19dce8c9b722d46ae6a57c2f1a988119488b50931 consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks consensus.nPowTargetSpacing = 10 * 60; consensus.fPowAllowMinDifficultyBlocks = false; consensus.fPowNoRetargeting = false; consensus.nRuleChangeActivationThreshold = 1916; // 95% of 2016 consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008 consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008 // Deployment of BIP68, BIP112, and BIP113. consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0; consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1462060800; // May 1st, 2016 consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1493596800; // May 1st, 2017 // Deployment of SegWit (BIP141, BIP143, and BIP147) consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1; consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1479168000; // November 15th, 2016. consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1510704000; // November 15th, 2017. // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000002cb971dd56d1c583c20f90"); // By default assume that the signatures in ancestors of this block are valid. consensus.defaultAssumeValid = uint256S("0x0000000000000000030abc968e1bd635736e880b946085c93152969b9a81a6e2"); //447235 /** * 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 32-bit integer with any alignment. */ pchMessageStart[0] = 0xf9; pchMessageStart[1] = 0xbe; pchMessageStart[2] = 0xb4; pchMessageStart[3] = 0xd9; nDefaultPort = 8333; nPruneAfterHeight = 100000; genesis = CreateGenesisBlock(1231006505, 2083236893, 0x1d00ffff, 1, 50 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); assert(consensus.hashGenesisBlock == uint256S("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f")); assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b")); // Note that of those with the service bits flag, most only support a subset of possible options vSeeds.push_back(CDNSSeedData("bitcoin.sipa.be", "seed.bitcoin.sipa.be", true)); // Pieter Wuille, only supports x1, x5, x9, and xd vSeeds.push_back(CDNSSeedData("bluematt.me", "dnsseed.bluematt.me", true)); // Matt Corallo, only supports x9 vSeeds.push_back(CDNSSeedData("dashjr.org", "dnsseed.bitcoin.dashjr.org")); // Luke Dashjr vSeeds.push_back(CDNSSeedData("bitcoinstats.com", "seed.bitcoinstats.com", true)); // Christian Decker, supports x1 - xf vSeeds.push_back(CDNSSeedData("bitcoin.jonasschnelli.ch", "seed.bitcoin.jonasschnelli.ch", true)); // Jonas Schnelli, only supports x1, x5, x9, and xd base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,0); base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5); base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,128); base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E).convert_to_container<std::vector<unsigned char> >(); base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4).convert_to_container<std::vector<unsigned char> >(); vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main)); fMiningRequiresPeers = true; fDefaultConsistencyChecks = false; fRequireStandard = true; fMineBlocksOnDemand = false; checkpointData = (CCheckpointData) { boost::assign::map_list_of ( 11111, uint256S("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) ( 33333, uint256S("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6")) ( 74000, uint256S("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")) (105000, uint256S("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")) (134444, uint256S("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")) (168000, uint256S("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763")) (193000, uint256S("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317")) (210000, uint256S("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e")) (216116, uint256S("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e")) (225430, uint256S("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932")) (250000, uint256S("0x000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214")) (279000, uint256S("0x0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40")) (295000, uint256S("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983")) }; chainTxData = ChainTxData{ // Data as of block 00000000000000000166d612d5595e2b1cd88d71d695fc580af64d8da8658c23 (height 446482). 1483472411, // * UNIX timestamp of last known number of transactions 184495391, // * total number of transactions between genesis and that timestamp // (the tx=... number in the SetBestChain debug.log lines) 3.2 // * estimated number of transactions per second after that timestamp }; }
void RegisterMiscRPCCommands(CRPCTable &t) { for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) t.appendCommand(commands[vcidx].name, &commands[vcidx]); }
CMainParams() { // The message start string is designed to be unlikely to occur in normal data. pchMessageStart[0] = 0xb6; pchMessageStart[1] = 0xb6; pchMessageStart[2] = 0xb6; pchMessageStart[3] = 0xb6; nDefaultPort = 48327; nRPCPort = 48328; 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 = "Nadecoin"; 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 = 1300000000; 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("0x5c85b50a51b3437abdf0ed22d984278d4f95e60650966ecc179e84d7d1a1a271")); assert(genesis.hashMerkleRoot == uint256("0xc3ab53bcf6c4174ab22abec6923320e6f2af142fc3ec9c6c6f36065db7d02940")); vSeeds.push_back(CDNSSeedData("google.org", "google.org")); base58Prefixes[PUBKEY_ADDRESS] = 36; 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); } }
void StopREST() { for (unsigned int i = 0; i < ARRAYLEN(uri_prefixes); i++) UnregisterHTTPHandler(uri_prefixes[i].prefix, false); }
int main() { int i, j; char* value; size_t valueSize; cl_uint platformCount = 0; cl_platform_id* platforms; cl_uint deviceCount; cl_device_id* devices; cl_uint maxComputeUnits; // get all platforms if (clGetPlatformIDs(0, NULL, &platformCount) != CL_SUCCESS) { printf("Unable to get platform IDs\n"); exit(1); } platforms = (cl_platform_id*) malloc(sizeof(cl_platform_id) * platformCount); if (clGetPlatformIDs(platformCount, platforms, NULL) != CL_SUCCESS) { printf("Unable to get platform IDs\n"); exit(1); } for (i = 0; i < platformCount; i++) { printf("%i. Platform\n", i+1); char data[1024]; size_t retsize; for (int j=0; j<ARRAYLEN(platform_data_items); ++j) { if (clGetPlatformInfo(platforms[i], platform_data_items[j].id, sizeof(data), data, &retsize) != CL_SUCCESS || retsize == sizeof(data)) { printf("Unable to get platform %s\n", platform_data_items[j].name); continue; } printf(" %s: %s\n", platform_data_items[j].name, data); } // get all devices if (clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, 0, NULL, &deviceCount) != CL_SUCCESS) { printf("Unable to get device IDs for platform %p\n", platforms[i]); continue; } devices = (cl_device_id*) malloc(sizeof(cl_device_id) * deviceCount); if (clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, deviceCount, devices, NULL) != CL_SUCCESS) { printf("Unable to get device IDs for platform %p\n", platforms[i]); continue; } // for each device print critical attributes for (j = 0; j < deviceCount; j++) { // print device name clGetDeviceInfo(devices[j], CL_DEVICE_NAME, 0, NULL, &valueSize); value = (char*) malloc(valueSize); clGetDeviceInfo(devices[j], CL_DEVICE_NAME, valueSize, value, NULL); printf("%d. Device: %s\n", j+1, value); free(value); // print hardware device version clGetDeviceInfo(devices[j], CL_DEVICE_VERSION, 0, NULL, &valueSize); value = (char*) malloc(valueSize); clGetDeviceInfo(devices[j], CL_DEVICE_VERSION, valueSize, value, NULL); printf(" %d.%d Hardware version: %s\n", j+1, 1, value); free(value); // print software driver version clGetDeviceInfo(devices[j], CL_DRIVER_VERSION, 0, NULL, &valueSize); value = (char*) malloc(valueSize); clGetDeviceInfo(devices[j], CL_DRIVER_VERSION, valueSize, value, NULL); printf(" %d.%d Software version: %s\n", j+1, 2, value); free(value); // print c version supported by compiler for device clGetDeviceInfo(devices[j], CL_DEVICE_OPENCL_C_VERSION, 0, NULL, &valueSize); value = (char*) malloc(valueSize); clGetDeviceInfo(devices[j], CL_DEVICE_OPENCL_C_VERSION, valueSize, value, NULL); printf(" %d.%d OpenCL C version: %s\n", j+1, 3, value); free(value); // print parallel compute units clGetDeviceInfo(devices[j], CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(maxComputeUnits), &maxComputeUnits, NULL); printf(" %d.%d Parallel compute units: %d\n", j+1, 4, maxComputeUnits); } free(devices); } free(platforms); return 0; }
bool StartREST() { for (unsigned int i = 0; i < ARRAYLEN(uri_prefixes); i++) RegisterHTTPHandler(uri_prefixes[i].prefix, false, uri_prefixes[i].handler); return true; }
bool RunTests( SoundReader *snd, const TestFile &tf ) { const char *fn = tf.fn; { float len = snd->GetLength(); // printf("%f\n", len); if( len < 1000.0f ) { LOG->Warn( "Test file %s is too short", fn ); return false; } } /* Read the first second of the file. Do this without calling any * seek functions. */ const int one_second_frames = snd->GetSampleRate(); const int one_second=one_second_frames*sizeof(int16_t)*2; int16_t sdata[one_second_frames*2]; char *data = (char *) sdata; memset( data, 0x42, one_second ); ReadData( snd, -1, data, one_second ); { /* Find out how many frames of silence we have. */ int SilentFrames = FramesOfSilence( sdata, one_second_frames ); const int16_t *InitialData = sdata + SilentFrames*2; const int InitialDataSize = one_second_frames - SilentFrames; if( InitialDataSize < (int) sizeof(tf.initial) ) { LOG->Warn( "Not enough (%i<%i) data to check after %i frames of silence", InitialDataSize, sizeof(tf.initial), SilentFrames ); return false; } bool Failed = false; if( SilentFrames != tf.SilentFrames ) { LOG->Trace( "Expected %i silence, got %i (%i too high)", tf.SilentFrames, SilentFrames, SilentFrames-tf.SilentFrames ); Failed = true; } bool Identical = !memcmp( InitialData, tf.initial, sizeof(tf.initial) ); if( !Identical ) { LOG->Trace("Expected data:"); dump( tf.initial, ARRAYLEN(tf.initial) ); LOG->Trace(" "); Failed = true; } if( Failed ) { LOG->Trace("Got data:"); dump( InitialData, min( 16, 2*InitialDataSize ) ); } const int LaterOffsetFrames = one_second_frames/2; /* half second */ const int LaterOffsetSamples = LaterOffsetFrames * channels; const int16_t *LaterData = sdata + LaterOffsetSamples; Identical = !memcmp( LaterData, tf.later, sizeof(tf.later) ); if( !Identical ) { LOG->Trace("Expected half second data:"); dump( tf.later, ARRAYLEN(tf.later) ); LOG->Trace("Got half second data:"); dump( LaterData, 16 ); Failed = true; /* See if we can find the half second data. */ int16_t *p = (int16_t *) xmemsearch( sdata, one_second, tf.later, sizeof(tf.later), LaterOffsetSamples*sizeof(int16_t) ); if( p ) { int SamplesOff = p-sdata; int FramesOff = SamplesOff/2; LOG->Trace("Found half second data at frame %i (wanted %i), ahead by %i samples", FramesOff, LaterOffsetFrames, FramesOff-LaterOffsetFrames ); } // else // dump( "foo", sdata, one_second/sizeof(int16_t) ); } if( Failed ) return false; } /* Make sure we're getting non-null data. */ { bool all_null=true; bool all_42=true; for( int i = 0; i < one_second; ++i ) { if( data[i] != 0 ) all_null=false; if( data[i] != 0x42 ) all_42=false; } if( all_null || all_42 ) { LOG->Warn( "'%s': sanity check failed (%i %i)", fn, all_null, all_42 ); return false; } } /* Read to EOF, discarding the data. */ while(1) { char buf[4096]; int got = snd->Read( buf, sizeof(buf) ); if( got < int(sizeof(buf)) ) break; } /* Now, make sure reading after an EOF returns another EOF. */ if( !must_be_eof(snd) ) { LOG->Warn("Fail: Reading past EOF didn't EOF"); return false; } if( !must_be_eof(snd) ) { LOG->Warn("Fail: Reading past EOF twice didn't EOF"); return false; } /* SetPosition_Accurate(0) must always reset properly. */ snd->SetPosition_Accurate( 0 ); if( !test_read( snd, data, one_second ) ) { LOG->Warn("Fail: SetPosition_Accurate(0) didn't work"); return false; } /* SetPosition_Fast(0) must always reset properly. */ snd->SetPosition_Fast( 0 ); if( !test_read( snd, data, one_second ) ) { LOG->Warn("Fail: SetPosition_Fast(0) didn't work"); return false; } /* Seek to 1ms and make sure it gives us the correct data. */ snd->SetPosition_Accurate( 1 ); if( !test_read( snd, data + one_second * 1/1000, one_second * 1/1000 ) ) { LOG->Warn("Fail: SetPosition_Accurate(1) didn't work"); return false; } /* Seek to 500ms and make sure it gives us the correct data. */ snd->SetPosition_Accurate( 500 ); if( !test_read( snd, data+one_second * 500/1000, one_second * 500/1000 ) ) { LOG->Warn("Fail: seek(500) didn't work"); return false; } /* Make sure seeking past end of file returns 0. */ int ret2 = snd->SetPosition_Fast( 10000000 ); if( ret2 != 0 ) { LOG->Warn( "Fail: SetPosition_Fast(1000000) returned %i instead of 0", ret2 ); return false; } /* Make sure that reading after a seek past EOF returns EOF. */ if( !must_be_eof(snd) ) { LOG->Warn("Fail: SetPosition_Fast EOF didn't EOF"); return false; } ret2 = snd->SetPosition_Accurate( 10000000 ); if( ret2 != 0 ) { LOG->Warn( "Fail: SetPosition_Accurate(1000000) returned %i instead of 0", ret2 ); return false; } if( !must_be_eof(snd) ) { LOG->Warn("Fail: SetPosition_Fast EOF didn't EOF"); return false; } /* Seek to a spot that lies exactly on a TOC entry, to check the * case that SetPosition_hard doesn't actually have to do anything. */ return true; }
NetMsgType::PING, NetMsgType::PONG, NetMsgType::NOTFOUND, NetMsgType::FILTERLOAD, NetMsgType::FILTERADD, NetMsgType::FILTERCLEAR, NetMsgType::REJECT, NetMsgType::SENDHEADERS, NetMsgType::FEEFILTER, NetMsgType::SENDCMPCT, NetMsgType::CMPCTBLOCK, NetMsgType::GETBLOCKTXN, NetMsgType::BLOCKTXN, NetMsgType::DANDELIONTX, }; const static std::vector<std::string> allNetMessageTypesVec(allNetMessageTypes, allNetMessageTypes+ARRAYLEN(allNetMessageTypes)); CMessageHeader::CMessageHeader(const MessageStartChars& pchMessageStartIn) { memcpy(pchMessageStart, pchMessageStartIn, MESSAGE_START_SIZE); memset(pchCommand, 0, sizeof(pchCommand)); nMessageSize = -1; memset(pchChecksum, 0, CHECKSUM_SIZE); } CMessageHeader::CMessageHeader(const MessageStartChars& pchMessageStartIn, const char* pszCommand, unsigned int nMessageSizeIn) { memcpy(pchMessageStart, pchMessageStartIn, MESSAGE_START_SIZE); memset(pchCommand, 0, sizeof(pchCommand)); strncpy(pchCommand, pszCommand, COMMAND_SIZE); nMessageSize = nMessageSizeIn;
CMainParams() { // The message start string is designed to be unlikely to occur in normal data. pchMessageStart[0] = 0xf7; pchMessageStart[1] = 0x26; pchMessageStart[2] = 0xa1; pchMessageStart[3] = 0xbf; vAlertPubKey = ParseHex("04e41db2a8b8dc3981f819d46060875ce483bf303613b108e673d7bb636f7786bd0458e2ced6e8b337be32d024562f3e69776412b55a7210396ad7a9944812b445"); nDefaultPort = 48481; nRPCPort = 48480; bnProofOfWorkLimit = CBigNum(~uint256(0) >> 20); nSubsidyHalvingInterval = 262800; // 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 = "Tone Abbet Does it again"; 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 = COIN / 10000; 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 = 1403852000; genesis.nBits = 0x1e0fffff; genesis.nNonce = 1376737; //// 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(); /*if (false && (genesis.GetHash() != hashGenesisBlock)) { // This will figure out a valid hash and Nonce if you're // creating a different genesis block: uint256 hashTarget = CBigNum().SetCompact(genesis.nBits).getuint256(); while (genesis.GetHash() > hashTarget) { ++genesis.nNonce; if (genesis.nNonce == 0) { printf("NONCE WRAPPED, incrementing time"); ++genesis.nTime; } } } //// debug print genesis.print(); printf("genesis.GetHash() == %s\n", genesis.GetHash().ToString().c_str()); printf("genesis.hashMerkleRoot == %s\n", genesis.hashMerkleRoot.ToString().c_str()); printf("genesis.nTime = %u \n", genesis.nTime); printf("genesis.nNonce = %u \n", genesis.nNonce); */ assert(hashGenesisBlock == uint256("0x00000dffc654ad0a8d9055536135b69d71dcd878d901508fc9381bde67bf0645")); assert(genesis.hashMerkleRoot == uint256("0x94076775c950c86d89bc2225c87bcb4e29621b57d5e9b430d7fa190078b0e980")); vSeeds.push_back(CDNSSeedData("162.248.4.167", "162.248.4.167")); vSeeds.push_back(CDNSSeedData("seed2.whirlcoin.org", "seed2.whirlcoin.org")); vSeeds.push_back(CDNSSeedData("seed3.whirlcoin.org", "seed3.whirlcoin.org")); vSeeds.push_back(CDNSSeedData("whirlcoin.zapto.org", "whirlcoin.zapto.org")); vSeeds.push_back(CDNSSeedData("whirlcoin.no-ip.org", "whirlcoin.no-ip.org")); vSeeds.push_back(CDNSSeedData("whirlcoin.strangled.net", "whirlcoin.strangled.net")); vSeeds.push_back(CDNSSeedData("whirlcoin.ignorelist.com", "whirlcoin.ignorelist.com")); base58Prefixes[PUBKEY_ADDRESS] = 73; base58Prefixes[SCRIPT_ADDRESS] = 12; base58Prefixes[SECRET_KEY] = 226; // 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); } }
static inline int get_button(void) { return pluginlib_getaction(HZ/2, plugin_contexts, ARRAYLEN(plugin_contexts)); }
CTestNetParams() { strNetworkID = "test"; consensus.nSubsidyHalvingInterval = 2100000; consensus.BIP34Height = 1; consensus.BIP34Hash = uint256S("0x1caab189318ac7a857f327ebc08fa9d2e9768f46b9f00cabc9a914a1184a29a2"); consensus.BIP65Height = 451; consensus.BIP66Height = 451; consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.powNeoScryptLimit = uint256S("0000003fffff0000000000000000000000000000000000000000000000000000"); consensus.nPowTargetTimespan = 3.5 * 24 * 60 * 60; // two weeks consensus.nPowTargetSpacing = 2.5 * 60; consensus.checkpointPubKey = "0421c27bb6580b05dcda1f47e59274489f094a3e85d96bbc38d5befd10eee97397ec8a93b6d8d79e8370239a8f39adf66322b41dafe83066bbcee6144e4c41a699"; consensus.vAlertPubKey = ParseHex("04ee30d11e8de34c8c40410d7aefed4865e9d9978335239dd4869e62651030d9a18332537c03ff24580fe668cfcdf087341715b56b1c0788b600631ed4445d3280"); consensus.fPowAllowMinDifficultyBlocks = true; consensus.fPowNoRetargeting = false; consensus.nRuleChangeActivationThreshold = 375; // 75% for testchains consensus.nMinerConfirmationWindow = 500; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008 consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008 // Deployment of BIP68, BIP112, and BIP113. consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0; consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1514764800; // Jan 1st, 2018 consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1546300800; // Jan 1st, 2019 // Deployment of SegWit (BIP141, BIP143, and BIP147) consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1; consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1514764800; // Jan 1st, 2018 consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1546300800; // Jan 1st, 2019 // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000000000100010"); // By default assume that the signatures in ancestors of this block are valid. consensus.defaultAssumeValid = uint256S("0x54fe00bf048fffe073889abebe84f11a616053ed1e43c3954a0a7e0e20c76219"); pchMessageStart[0] = 0x91; pchMessageStart[1] = 0x65; pchMessageStart[2] = 0x6a; pchMessageStart[3] = 0x71; pchMessageStartOld[0] = 0xda; pchMessageStartOld[1] = 0xaf; pchMessageStartOld[2] = 0xa5; pchMessageStartOld[3] = 0xba; nDefaultPort = 19336; nPruneAfterHeight = 1000; consensus.nForkTwo = 0; consensus.nForkThree = 0; consensus.nForkFour = 0; consensus.nTimeLimit = 100; consensus.nNeoScryptFork = 1486758327; genesis = CreateGenesisBlock(1396255061, 677449, 0x1e0ffff0, 1, 50 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); assert(consensus.hashGenesisBlock == uint256S("0x7734b3734ab1f0d0758e6c274622a377092549df05f6a4fe6939cbc754939169")); assert(genesis.hashMerkleRoot == uint256S("0x97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9")); vFixedSeeds.clear(); vSeeds.clear(); // nodes with support for servicebits filtering should be at the top vSeeds.emplace_back("testnet-explorer2.feathercoin.com"); vSeeds.emplace_back("testnet-dnsseed.feathercoin.com"); base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111); base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196); base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239); base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF}; base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94}; bech32_hrp = "tf"; vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test)); fDefaultConsistencyChecks = false; fRequireStandard = false; fMineBlocksOnDemand = false; checkpointData = { { {6000, uint256S("488c04227b4bf26dfd9ae3b39f0f4ded29573e96530c7a161d57ff53af0c88d0")}, } }; chainTxData = ChainTxData{ 1517011548, 6003, 0.01 }; /* enable fallback fee on testnet */ m_fallback_fee_enabled = true; }
CTestNetParams() { strNetworkID = "test"; consensus.nSubsidyHalvingInterval = 210000; consensus.BIP34Height = 21111; consensus.BIP34Hash = uint256S("0x0000000023b3a96d3484e5abb3755c413e7d41500f8e2a5c3f0dd01299cd8ef8"); consensus.BIP65Height = 581885; // 00000000007f6655f22f98e72ed80d8b06dc761d5da09df0fa1dc4be4f861eb6 consensus.BIP66Height = 330776; // 000000002104c8c45e99a8853285a3b592602a3ccde2b832481da85e9e4ba182 consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks consensus.nPowTargetSpacing = 10 * 60; consensus.fPowAllowMinDifficultyBlocks = true; consensus.fPowNoRetargeting = false; consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008 consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008 // Deployment of BIP68, BIP112, and BIP113. consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0; consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1456790400; // March 1st, 2016 consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1493596800; // May 1st, 2017 // Deployment of SegWit (BIP141, BIP143, and BIP147) consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1; consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1462060800; // May 1st 2016 consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1493596800; // May 1st 2017 // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000198b4def2baa9338d6"); // By default assume that the signatures in ancestors of this block are valid. consensus.defaultAssumeValid = uint256S("0x000000000871ee6842d3648317ccc8a435eb8cc3c2429aee94faff9ba26b05a0"); //1043841 pchMessageStart[0] = 0x0b; pchMessageStart[1] = 0x11; pchMessageStart[2] = 0x09; pchMessageStart[3] = 0x07; nDefaultPort = 18333; nPruneAfterHeight = 1000; genesis = CreateGenesisBlock(1296688602, 414098458, 0x1d00ffff, 1, 50 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); assert(consensus.hashGenesisBlock == uint256S("0x000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943")); assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b")); vFixedSeeds.clear(); vSeeds.clear(); // nodes with support for servicebits filtering should be at the top vSeeds.push_back(CDNSSeedData("testnetbitcoin.jonasschnelli.ch", "testnet-seed.bitcoin.jonasschnelli.ch", true)); vSeeds.push_back(CDNSSeedData("petertodd.org", "seed.tbtc.petertodd.org", true)); vSeeds.push_back(CDNSSeedData("bluematt.me", "testnet-seed.bluematt.me")); vSeeds.push_back(CDNSSeedData("bitcoin.schildbach.de", "testnet-seed.bitcoin.schildbach.de")); base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111); base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196); base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239); base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >(); base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >(); vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test)); fMiningRequiresPeers = true; fDefaultConsistencyChecks = false; fRequireStandard = false; fMineBlocksOnDemand = false; checkpointData = (CCheckpointData) { boost::assign::map_list_of ( 546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")), }; chainTxData = ChainTxData{ // Data as of block 00000000c2872f8f8a8935c8e3c5862be9038c97d4de2cf37ed496991166928a (height 1063660) 1483546230, 12834668, 0.15 }; }
CMainParams() { strNetworkID = "main"; consensus.nSubsidyHalvingInterval = 2100000; consensus.BIP34Height = 344407; consensus.BIP34Hash = uint256S("0x9ca8e68e34ccdeeb35a52176155a7d524c8216a82450d696abcfda340129e271"); consensus.BIP65Height = 2120750; consensus.BIP66Height = 2120750; consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.powNeoScryptLimit = uint256S("0000003fffff0000000000000000000000000000000000000000000000000000"); consensus.nPowTargetTimespan = 3.5 * 24 * 60 * 60; // two weeks consensus.nPowTargetSpacing = 2.5 * 60; consensus.checkpointPubKey = "04c67c0114bc7cb8bb84ee0f3319e1df3339d335a15bdb04605cf2655d19212848a66d4535f3c91e943061474b7cacfd4eaa10835d35a8d4e431c68a4c4f5450ba"; consensus.vAlertPubKey = ParseHex("043c19a29fe8f763369aea68107e82854af7b072fc7d2d2adb87d2a3b40b51ab0d0e77805096e255a87388b175fd4a49d93d9b6c878004975e41222a3b85086eef"); consensus.fPowAllowMinDifficultyBlocks = false; consensus.fPowNoRetargeting = false; consensus.nRuleChangeActivationThreshold = 15120; // 75% of 20160 consensus.nMinerConfirmationWindow = 20160; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008 consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008 // Deployment of BIP68, BIP112, and BIP113. consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0; consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1519862400; // March 1st, 2018 consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1551398400; // March 1st, 2019 // Deployment of SegWit (BIP141, BIP143, and BIP147) consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1; consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1519862400; // March 1st, 2018 consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1551398400; // March 1st, 2019 // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000000005383a3c6486afe6"); // By default assume that the signatures in ancestors of this block are valid. consensus.defaultAssumeValid = uint256S("0xbb4955cff435b39df717aeb144d60ecc2c47b8a133ca7663df66bace6dea97c6"); // 2124200 /** * 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 32-bit integer with any alignment. */ pchMessageStart[0] = 0x41; pchMessageStart[1] = 0x15; pchMessageStart[2] = 0x1a; pchMessageStart[3] = 0x21; // End of the bridge from old to new pchMessageStart pchMessageStartOld[0] = 0xfb; pchMessageStartOld[1] = 0xc0; pchMessageStartOld[2] = 0xb6; pchMessageStartOld[3] = 0xdb; nDefaultPort = 9336; nPruneAfterHeight = 100000; consensus.nForkOne = 33000; consensus.nForkTwo = 87948; consensus.nForkThree = 204639; consensus.nForkFour = 432000; consensus.nTimeLimit = 2313000; consensus.nNeoScryptFork = 1414346265; genesis = CreateGenesisBlock(1317972665, 2084524493, 0x1e0ffff0, 1, 50 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); assert(consensus.hashGenesisBlock == uint256S("0x12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2")); assert(genesis.hashMerkleRoot == uint256S("0x97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9")); // Note that of those which support the service bits prefix, most only support a subset of // possible options. // This is fine at runtime as we'll fall back to using them as a oneshot if they don't support the // service bits we want, but we should get them updated to support all service bits wanted by any // release ASAP to avoid it where possible. vSeeds.emplace_back("dnsseed.feathercoin.com"); vSeeds.emplace_back("dnsseed1.feathercoin.com"); vSeeds.emplace_back("dnsseed.alltheco.in"); vSeeds.emplace_back("dnsseed.bushstar.co.uk"); base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,14); base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5); base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,142); base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xBC, 0x26}; base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xDA, 0xEE}; bech32_hrp = "fc"; vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main)); fDefaultConsistencyChecks = false; fRequireStandard = true; fMineBlocksOnDemand = false; checkpointData = { { { 22267, uint256S("0x23dc7d871fc2a9b994112e978019f6370bab0b8979f557afe77a7ab620224b70")}, { 31846, uint256S("0xba7d5c0e6d46f6448253290ce037e13975c13ca9c375ae854b6b2f85044fc0f9")}, { 41300, uint256S("0x8c4e02f6c0d20e856fd7e952a147fee30ce145ca6932a284f354924362d2b408")}, { 500000, uint256S("0x2b7ea20e3899deb9591015b0a5a589b9f6032ab82e018014fafe11637b1a2daf")}, {1000000, uint256S("0xb9e03dffe6b43cac38191d1bbb0d74fec21223e0de052928c96f498ba305f918")}, {1593400, uint256S("0xe97230c788e7240eb325576810fee62f5162905f63a832f15928b88ac6a938c6")}, {1776411, uint256S("0x4f6de194bd2f4580e2ac9337289c7cca348d3f35c9079af2760b288315b82feb")}, {2124270, uint256S("0x4f6de194bd2f4580e2ac9337289c7cca348d3f35c9079af2760b288315b82feb")}, } }; chainTxData = ChainTxData{ // Data as of block 0000000000000000002d6cca6761c99b3c2e936f9a0e304b7c7651a993f461de (height 506081). 1520948476, // * UNIX timestamp of last known number of transactions 4229159, // * total number of transactions between genesis and that timestamp // (the tx=... number in the ChainStateFlushed debug.log lines) 0.03 // * estimated number of transactions per second after that timestamp }; /* disable fallback fee on mainnet */ m_fallback_fee_enabled = true; }
bool CInv::IsKnownType() const { return (type >= 1 && type < ARRAYLEN(ppszTypeName)); }
CMainParams() { // The message start string is designed to be unlikely to occur in normal data. pchMessageStart[0] = 0x04; pchMessageStart[1] = 0x05; pchMessageStart[2] = 0x05; pchMessageStart[3] = 0x04; nDefaultPort = 25536; nRPCPort = 25537; 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 = "Scotcoin!"; 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 = 1392946703; genesis.nBits = 0x1e0fffff; genesis.nNonce = 168193; //// 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("0x0000020b9d4db902554e1131eee9d0a016e201215b2fd6e7279e4321f99a3e15")); assert(genesis.hashMerkleRoot == uint256("0xa887ab6f2204b79e5af2878efc78e5da804013f94f4e23cb73239b6abbf95ce4")); 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); } }