void CoinEng::ExportToBootstrapDat(const path& pathBoostrap) { uint32_t n = Db->GetMaxHeight()+1; #ifndef X_DEBUG//!!!T if (Mode == EngMode::Bootstrap) { CEngStateDescription stateDesc(_self, EXT_STR("Copying " << GetBootstrapPath() << " -> " << pathBoostrap)); return (void)copy_file(GetBootstrapPath(), pathBoostrap, copy_options::overwrite_existing); } #endif CEngStateDescription stateDesc(_self, EXT_STR("Exporting " << n << " blocks to " << pathBoostrap)); FileStream fs(pathBoostrap, FileMode::Create, FileAccess::Write); BinaryWriter wr(fs); for (uint32_t i=0; i<n && Runned; ++i) { wr << ChainParams.ProtocolMagic; MemoryStream ms; Block block = GetBlockByHeight(i); //!!!? block.LoadToMemory(); //!!!? EXT_FOR (const Tx& tx, block.Txes) { //!!!? // tx.m_pimpl->m_nBytesOfHash = 0; //!!!? } //!!!? block.m_pimpl->m_hash.reset(); //!!!?block.m_pimpl->m_txHashesOutNums.clear(); block.Write(BinaryWriter(ms).Ref()); wr << uint32_t(ms.Position); fs.WriteBuf(ms); } }
void OptionalDeleteExpiredDomains(uint32_t height) override { if (ResolverMode) { if (!(heightExpired & 0xFF)) { SqliteCommand(EXT_STR("DELETE FROM domains WHERE height <= " << heightExpired), m_db) .ExecuteNonQuery(); } } else { Block blockExpired = GetBlockByHeight(heightExpired); EXT_FOR (const TxHashOutNum& hom, blockExpired.get_TxHashesOutNums()) { m_cmdDeleteDomain .Bind(1, ReducedHashValue(hom.HashTx)) .ExecuteNonQuery(); } } }