├── .gitattributes ├── .gitignore ├── CONTRIBUTING.md ├── COPYING ├── Dockerfile ├── INSTALL ├── Makefile.am ├── README.md ├── TODO.md ├── autotool.sh ├── bootstrap.sh ├── configure.ac ├── contrib ├── HTML.py ├── bitcoind.bash-completion ├── bitrpc │ └── bitrpc.py ├── buildenv │ ├── .gitignore │ ├── Vagrantfile │ └── scripts │ │ ├── activate │ │ ├── bin │ │ └── twister │ │ └── vagrant_bootstrap.sh ├── debian │ ├── README │ ├── bitcoin-qt.desktop │ ├── bitcoin-qt.install │ ├── bitcoin-qt.lintian-overrides │ ├── bitcoin-qt.protocol │ ├── bitcoind.bash-completion │ ├── bitcoind.examples │ ├── bitcoind.install │ ├── bitcoind.lintian-overrides │ ├── bitcoind.manpages │ ├── changelog │ ├── compat │ ├── control │ ├── copyright │ ├── examples │ │ └── bitcoin.conf │ ├── gbp.conf │ ├── manpages │ │ ├── bitcoin-qt.1 │ │ ├── bitcoin.conf.5 │ │ └── bitcoind.1 │ ├── patches │ │ ├── README │ │ └── series │ ├── rules │ ├── source │ │ └── format │ └── watch ├── gitian-descriptors │ ├── README.md │ ├── boost-linux.yml │ ├── boost-win.yml │ ├── deps-linux.yml │ ├── deps-win.yml │ ├── gitian-linux.yml │ └── gitian-win.yml ├── gitian-downloader │ ├── bluematt-key.pgp │ ├── devrandom-key.pgp │ ├── gavinandresen-key.pgp │ ├── laanwj-key.pgp │ ├── linux-download-config │ ├── luke-jr-key.pgp │ ├── sipa-key.pgp │ ├── tcatm-key.pgp │ ├── win32-download-config │ └── wtogami-key.pgp ├── homebrew │ ├── bitcoin.qt.pro.patch │ └── makefile.osx.patch ├── macdeploy │ ├── LICENSE │ ├── background.png │ ├── background.psd │ ├── fancy.plist │ ├── macdeployqtplus │ └── notes.txt ├── posts_sync.py ├── pyminer │ ├── README │ ├── example-config.cfg │ └── pyminer.py ├── qos │ ├── README │ └── tc.sh ├── qt_translations.py ├── seeds │ ├── README │ └── makeseeds.py ├── spendfrom │ ├── README │ ├── setup.py │ └── spendfrom.py ├── test-patches │ ├── README │ └── temp-revert-2.patch ├── testgen │ ├── README │ ├── base58.py │ └── gen_base58_test_vectors.py ├── tidy_datadir.sh ├── usernameCrawler.py ├── verifysfbinaries │ └── verify.sh └── wallettools │ ├── walletchangepass.py │ └── walletunlock.py ├── doc ├── Doxyfile ├── assets-attribution.txt ├── build-msw.md ├── build-osx.md ├── build-unix.md ├── building-on-gentoo.md ├── building-on-ubuntu-debian.md ├── building-on-vagrant.md ├── coding.md └── release-process.md ├── libtorrent ├── .gitignore ├── .regression.yml ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── ChangeLog ├── Jamfile ├── Jamroot.jam ├── LICENSE ├── Makefile.am ├── NEWS ├── README ├── autotool.sh ├── bootstrap.sh ├── build-aux │ ├── config.guess │ └── config.sub ├── build_dist.sh ├── clean.py ├── configure.ac ├── darwin_valgrind.suppressions ├── dht_flood.py ├── docs │ ├── Linkage.png │ ├── arctic_thumb.png │ ├── bitbuddy_thumb.jpg │ ├── bitfox.png │ ├── bitrocket_thumb.png │ ├── bitscast_thumb.png │ ├── bitslug_thumb.png │ ├── btg_thumb.jpg │ ├── bubba.png │ ├── building.html │ ├── building.rst │ ├── client_test.html │ ├── client_test.png │ ├── client_test.rst │ ├── contributing.html │ ├── contributing.rst │ ├── cwnd.png │ ├── cwnd_thumb.png │ ├── delays.png │ ├── delays_thumb.png │ ├── deluge.png │ ├── dht_extensions.html │ ├── dht_extensions.rst │ ├── dht_rss.html │ ├── dht_rss.rst │ ├── dht_sec.html │ ├── dht_sec.rst │ ├── dht_store.html │ ├── dht_store.rst │ ├── disk_access.png │ ├── disk_access_elevator.png │ ├── disk_access_no_elevator.png │ ├── disk_buffer.png │ ├── disk_buffer_before_optimization.png │ ├── disk_buffer_sample.png │ ├── disk_io.png │ ├── electric_sheep_thumb.jpg │ ├── examples.html │ ├── examples.rst │ ├── extension_protocol.html │ ├── extension_protocol.rst │ ├── fatrat.png │ ├── fdm.png │ ├── features.html │ ├── features.rst │ ├── firetorrent.png │ ├── flush.jpg │ ├── folx.png │ ├── gen_reference_doc.py │ ├── gen_todo.py │ ├── hacking.rst │ ├── halite_thumb.png │ ├── im_thumb.jpg │ ├── index.html │ ├── index.rst │ ├── ip_id_v4.png │ ├── ip_id_v6.png │ ├── ips.py │ ├── leechcraft.png │ ├── libtorrent_plugins.html │ ├── libtorrent_plugins.rst │ ├── libtorrent_screen.png │ ├── limewire.png │ ├── lince.png │ ├── make_thumb.sh │ ├── make_torrent.html │ ├── make_torrent.rst │ ├── makefile │ ├── manual.html │ ├── manual.rst │ ├── merkle_tree.graffle │ ├── merkle_tree.png │ ├── miro.jpg │ ├── moopolice_thumb.gif │ ├── our_delay_base.png │ ├── our_delay_base_thumb.png │ ├── projects.html │ ├── projects.rst │ ├── pump.png │ ├── python_binding.html │ ├── python_binding.rst │ ├── qbittorrent_thumb.jpg │ ├── read_disk_buffers.dot │ ├── read_disk_buffers.graffle │ ├── read_disk_buffers.png │ ├── running_tests.html │ ├── running_tests.rst │ ├── session_stats_peers.png │ ├── storage.graffle │ ├── storage.png │ ├── style.css │ ├── stylesheet │ ├── t2e.jpg │ ├── template.txt │ ├── todo.html │ ├── tonidoplug.png │ ├── troubleshooting.dot │ ├── troubleshooting.png │ ├── tuning.html │ ├── tuning.rst │ ├── tvblob.jpg │ ├── tvitty.jpg │ ├── udp_tracker_protocol.html │ ├── udp_tracker_protocol.rst │ ├── unicode_support.png │ ├── utp.html │ ├── utp.rst │ ├── write_disk_buffers.dot │ ├── write_disk_buffers.graffle │ ├── write_disk_buffers.png │ ├── ziptorrent_thumb.gif │ └── zyxel.png ├── examples │ ├── Jamfile │ ├── Makefile.am │ ├── client_test.cpp │ ├── connection_tester.cpp │ ├── dump_torrent.cpp │ ├── fragmentation_test.cpp │ ├── make_torrent.cpp │ ├── rss_reader.cpp │ ├── run_benchmarks.py │ ├── simple_client.cpp │ ├── upnp_test.cpp │ └── utp_test.cpp ├── include │ └── libtorrent │ │ ├── ConvertUTF.h │ │ ├── GeoIP.h │ │ ├── Makefile.am │ │ ├── add_torrent_params.hpp │ │ ├── address.hpp │ │ ├── alert.hpp │ │ ├── alert_dispatcher.hpp │ │ ├── alert_manager.hpp │ │ ├── alert_types.hpp │ │ ├── alloca.hpp │ │ ├── allocator.hpp │ │ ├── assert.hpp │ │ ├── aux_ │ │ └── session_impl.hpp │ │ ├── bandwidth_limit.hpp │ │ ├── bandwidth_manager.hpp │ │ ├── bandwidth_queue_entry.hpp │ │ ├── bandwidth_socket.hpp │ │ ├── bencode.hpp │ │ ├── bitfield.hpp │ │ ├── bloom_filter.hpp │ │ ├── broadcast_socket.hpp │ │ ├── bt_peer_connection.hpp │ │ ├── buffer.hpp │ │ ├── build_config.hpp │ │ ├── chained_buffer.hpp │ │ ├── config.hpp │ │ ├── connection_queue.hpp │ │ ├── copy_ptr.hpp │ │ ├── create_torrent.hpp │ │ ├── deadline_timer.hpp │ │ ├── debug.hpp │ │ ├── disk_buffer_holder.hpp │ │ ├── disk_buffer_pool.hpp │ │ ├── disk_io_thread.hpp │ │ ├── entry.hpp │ │ ├── enum_net.hpp │ │ ├── error.hpp │ │ ├── error_code.hpp │ │ ├── escape_string.hpp │ │ ├── extensions.hpp │ │ ├── extensions │ │ ├── logger.hpp │ │ ├── lt_trackers.hpp │ │ ├── metadata_transfer.hpp │ │ ├── smart_ban.hpp │ │ ├── ut_metadata.hpp │ │ └── ut_pex.hpp │ │ ├── file.hpp │ │ ├── file_pool.hpp │ │ ├── file_storage.hpp │ │ ├── fingerprint.hpp │ │ ├── gzip.hpp │ │ ├── hasher.hpp │ │ ├── http_connection.hpp │ │ ├── http_parser.hpp │ │ ├── http_seed_connection.hpp │ │ ├── http_stream.hpp │ │ ├── http_tracker_connection.hpp │ │ ├── i2p_stream.hpp │ │ ├── identify_client.hpp │ │ ├── instantiate_connection.hpp │ │ ├── intrusive_ptr_base.hpp │ │ ├── invariant_check.hpp │ │ ├── io.hpp │ │ ├── io_service.hpp │ │ ├── io_service_fwd.hpp │ │ ├── ip_filter.hpp │ │ ├── ip_voter.hpp │ │ ├── kademlia │ │ ├── dht_get.hpp │ │ ├── dht_observer.hpp │ │ ├── dht_tracker.hpp │ │ ├── find_data.hpp │ │ ├── logging.hpp │ │ ├── msg.hpp │ │ ├── node.hpp │ │ ├── node_entry.hpp │ │ ├── node_id.hpp │ │ ├── observer.hpp │ │ ├── refresh.hpp │ │ ├── routing_table.hpp │ │ ├── rpc_manager.hpp │ │ └── traversal_algorithm.hpp │ │ ├── lazy_entry.hpp │ │ ├── lsd.hpp │ │ ├── magnet_uri.hpp │ │ ├── max.hpp │ │ ├── natpmp.hpp │ │ ├── packet_buffer.hpp │ │ ├── parse_url.hpp │ │ ├── pch.hpp │ │ ├── pe_crypto.hpp │ │ ├── peer.hpp │ │ ├── peer_connection.hpp │ │ ├── peer_id.hpp │ │ ├── peer_info.hpp │ │ ├── peer_request.hpp │ │ ├── piece_block_progress.hpp │ │ ├── piece_picker.hpp │ │ ├── policy.hpp │ │ ├── proxy_base.hpp │ │ ├── ptime.hpp │ │ ├── puff.hpp │ │ ├── random.hpp │ │ ├── rsa.hpp │ │ ├── rss.hpp │ │ ├── session.hpp │ │ ├── session_settings.hpp │ │ ├── session_status.hpp │ │ ├── settings.hpp │ │ ├── size_type.hpp │ │ ├── sliding_average.hpp │ │ ├── socket.hpp │ │ ├── socket_io.hpp │ │ ├── socket_type.hpp │ │ ├── socket_type_fwd.hpp │ │ ├── socks5_stream.hpp │ │ ├── ssl_stream.hpp │ │ ├── stat.hpp │ │ ├── storage.hpp │ │ ├── storage_defs.hpp │ │ ├── string_util.hpp │ │ ├── struct_debug.hpp │ │ ├── thread.hpp │ │ ├── time.hpp │ │ ├── timestamp_history.hpp │ │ ├── tommath.h │ │ ├── tommath_class.h │ │ ├── tommath_superclass.h │ │ ├── torrent.hpp │ │ ├── torrent_handle.hpp │ │ ├── torrent_info.hpp │ │ ├── tracker_manager.hpp │ │ ├── udp_socket.hpp │ │ ├── udp_tracker_connection.hpp │ │ ├── union_endpoint.hpp │ │ ├── upnp.hpp │ │ ├── utf8.hpp │ │ ├── utp_socket_manager.hpp │ │ ├── utp_stream.hpp │ │ ├── version.hpp │ │ ├── web_connection_base.hpp │ │ ├── web_peer_connection.hpp │ │ └── xml_parse.hpp ├── libtorrent-rasterbar-cmake.pc.in ├── libtorrent-rasterbar.pc.in ├── list_files.py ├── m4 │ ├── ax_boost_base.m4 │ ├── ax_boost_python.m4 │ ├── ax_boost_system.m4 │ ├── ax_check_geoip.m4 │ ├── ax_check_openssl.m4 │ ├── ax_pthread.m4 │ ├── ax_python_devel.m4 │ ├── config.rpath │ ├── gettext-lib.m4 │ ├── iconv.m4 │ ├── ltsugar.m4 │ └── pkgconfig.m4 ├── runme-android.sh ├── sanity-checker.xml ├── set_version.py ├── src │ ├── ConvertUTF.cpp │ ├── GeoIP.c │ ├── Makefile.am │ ├── alert.cpp │ ├── alert_manager.cpp │ ├── allocator.cpp │ ├── asio.cpp │ ├── asio_ssl.cpp │ ├── assert.cpp │ ├── bandwidth_limit.cpp │ ├── bandwidth_manager.cpp │ ├── bandwidth_queue_entry.cpp │ ├── bloom_filter.cpp │ ├── broadcast_socket.cpp │ ├── bt_peer_connection.cpp │ ├── chained_buffer.cpp │ ├── connection_queue.cpp │ ├── create_torrent.cpp │ ├── disk_buffer_holder.cpp │ ├── disk_buffer_pool.cpp │ ├── disk_io_thread.cpp │ ├── entry.cpp │ ├── enum_net.cpp │ ├── error_code.cpp │ ├── escape_string.cpp │ ├── file.cpp │ ├── file_pool.cpp │ ├── file_storage.cpp │ ├── gzip.cpp │ ├── hasher.cpp │ ├── http_connection.cpp │ ├── http_parser.cpp │ ├── http_seed_connection.cpp │ ├── http_stream.cpp │ ├── http_tracker_connection.cpp │ ├── i2p_stream.cpp │ ├── identify_client.cpp │ ├── instantiate_connection.cpp │ ├── ip_filter.cpp │ ├── ip_voter.cpp │ ├── kademlia │ │ ├── dht_get.cpp │ │ ├── dht_tracker.cpp │ │ ├── find_data.cpp │ │ ├── logging.cpp │ │ ├── node.cpp │ │ ├── node_id.cpp │ │ ├── refresh.cpp │ │ ├── routing_table.cpp │ │ ├── rpc_manager.cpp │ │ └── traversal_algorithm.cpp │ ├── lazy_bdecode.cpp │ ├── logger.cpp │ ├── lsd.cpp │ ├── lt_trackers.cpp │ ├── magnet_uri.cpp │ ├── metadata_transfer.cpp │ ├── mpi.c │ ├── natpmp.cpp │ ├── packet_buffer.cpp │ ├── parse_url.cpp │ ├── pe_crypto.cpp │ ├── peer_connection.cpp │ ├── piece_picker.cpp │ ├── policy.cpp │ ├── puff.cpp │ ├── random.cpp │ ├── rsa.cpp │ ├── rss.cpp │ ├── session.cpp │ ├── session_impl.cpp │ ├── settings.cpp │ ├── sha1.cpp │ ├── smart_ban.cpp │ ├── socket_io.cpp │ ├── socket_type.cpp │ ├── socks5_stream.cpp │ ├── stat.cpp │ ├── storage.cpp │ ├── string_util.cpp │ ├── thread.cpp │ ├── time.cpp │ ├── timestamp_history.cpp │ ├── torrent.cpp │ ├── torrent_handle.cpp │ ├── torrent_info.cpp │ ├── tracker_manager.cpp │ ├── udp_socket.cpp │ ├── udp_tracker_connection.cpp │ ├── upnp.cpp │ ├── ut_metadata.cpp │ ├── ut_pex.cpp │ ├── utf8.cpp │ ├── utp_socket_manager.cpp │ ├── utp_stream.cpp │ ├── web_connection_base.cpp │ └── web_peer_connection.cpp ├── test │ ├── Jamfile │ ├── Makefile.am │ ├── cb.xml │ ├── compile-dht.sh │ ├── dht_server.cpp │ ├── dht_server.hpp │ ├── enum_if.cpp │ ├── eztv.xml │ ├── fg.xml │ ├── kat.xml │ ├── main.cpp │ ├── mn.xml │ ├── pb.xml │ ├── peer_server.cpp │ ├── peer_server.hpp │ ├── root1.xml │ ├── root2.xml │ ├── setup_transfer.cpp │ ├── setup_transfer.hpp │ ├── test.hpp │ ├── test_auto_unchoke.cpp │ ├── test_bandwidth_limiter.cpp │ ├── test_bdecode_performance.cpp │ ├── test_bencoding.cpp │ ├── test_buffer.cpp │ ├── test_checking.cpp │ ├── test_dht.cpp │ ├── test_fast_extension.cpp │ ├── test_file.cpp │ ├── test_file_storage.cpp │ ├── test_hasher.cpp │ ├── test_http_connection.cpp │ ├── test_ip_filter.cpp │ ├── test_lsd.cpp │ ├── test_metadata_extension.cpp │ ├── test_natpmp.cpp │ ├── test_pe_crypto.cpp │ ├── test_peer_priority.cpp │ ├── test_pex.cpp │ ├── test_piece_picker.cpp │ ├── test_primitives.cpp │ ├── test_privacy.cpp │ ├── test_rss.cpp │ ├── test_session.cpp │ ├── test_storage.cpp │ ├── test_swarm.cpp │ ├── test_threads.cpp │ ├── test_torrent.cpp │ ├── test_torrent_parse.cpp │ ├── test_tracker.cpp │ ├── test_trackers_extension.cpp │ ├── test_transfer.cpp │ ├── test_upnp.cpp │ ├── test_utp.cpp │ └── test_web_seed.cpp ├── tools │ ├── Jamfile │ ├── Makefile.am │ ├── parse_bandwidth_log.py │ ├── parse_buffer_log.py │ ├── parse_dht_log.py │ ├── parse_dht_rtt.py │ ├── parse_dht_stats.py │ ├── parse_disk_access.py │ ├── parse_disk_buffer_log.py │ ├── parse_disk_log.py │ ├── parse_hash_fails.cpp │ ├── parse_memory_log.py │ ├── parse_peer_log.py │ ├── parse_request_log.cpp │ ├── parse_sample.py │ ├── parse_session_stats.py │ ├── parse_test_results.py │ ├── parse_utp_log.py │ ├── run_regression_tests.py │ └── run_tests.py └── update_copyright.py ├── m4 ├── ax_berkeley_db_cxx.m4 ├── ax_boost_base.m4 ├── ax_boost_chrono.m4 ├── ax_boost_filesystem.m4 ├── ax_boost_locale.m4 ├── ax_boost_program_options.m4 ├── ax_boost_python.m4 ├── ax_boost_regex.m4 ├── ax_boost_system.m4 ├── ax_boost_thread.m4 ├── ax_check_geoip.m4 ├── ax_check_openssl.m4 ├── ax_pthread.m4 ├── ax_python_devel.m4 ├── config.rpath ├── gettext-lib.m4 ├── iconv.m4 ├── ltsugar.m4 ├── lt~obsolete.m4 └── pkgconfig.m4 ├── share ├── applications │ ├── twister-control.desktop │ └── twister.desktop ├── certs │ ├── BitcoinFoundation_Apple_Cert.pem │ ├── BitcoinFoundation_Comodo_Cert.pem │ └── PrivateKeyNotes.md ├── genbuild.sh ├── pixmaps │ ├── twister128.png │ ├── twister16.png │ ├── twister256.png │ ├── twister32.png │ └── twister64.png ├── qt │ ├── Info.plist │ ├── clean_mac_info_plist.py │ ├── extract_strings_qt.py │ ├── img │ │ └── reload.xcf │ ├── make_spinner.py │ └── make_windows_icon.sh ├── setup.nsi └── ui.rc ├── src ├── addrman.cpp ├── addrman.h ├── alert.cpp ├── alert.h ├── allocators.h ├── base58.h ├── bignum.h ├── bitcoind.cpp ├── bitcoinrpc.cpp ├── bitcoinrpc.h ├── bloom.cpp ├── bloom.h ├── chainparams.cpp ├── chainparams.h ├── checkpoints.cpp ├── checkpoints.h ├── checkqueue.h ├── clientversion.h ├── compat.h ├── core.cpp ├── core.h ├── crypter.cpp ├── crypter.h ├── db.cpp ├── db.h ├── dhtproxy.cpp ├── dhtproxy.h ├── hash.cpp ├── hash.h ├── init.cpp ├── init.h ├── json │ ├── LICENSE.txt │ ├── json_spirit.h │ ├── json_spirit_error_position.h │ ├── json_spirit_reader.cpp │ ├── json_spirit_reader.h │ ├── json_spirit_reader_template.h │ ├── json_spirit_stream_reader.h │ ├── json_spirit_utils.h │ ├── json_spirit_value.cpp │ ├── json_spirit_value.h │ ├── json_spirit_writer.cpp │ ├── json_spirit_writer.h │ └── json_spirit_writer_template.h ├── key.cpp ├── key.h ├── keystore.cpp ├── keystore.h ├── leveldb.cpp ├── leveldb.h ├── leveldb │ ├── .gitignore │ ├── AUTHORS │ ├── LICENSE │ ├── Makefile │ ├── NEWS │ ├── README │ ├── TODO │ ├── WINDOWS.md │ ├── build_detect_platform │ ├── db │ │ ├── builder.cc │ │ ├── builder.h │ │ ├── c.cc │ │ ├── c_test.c │ │ ├── corruption_test.cc │ │ ├── db_bench.cc │ │ ├── db_impl.cc │ │ ├── db_impl.h │ │ ├── db_iter.cc │ │ ├── db_iter.h │ │ ├── db_test.cc │ │ ├── dbformat.cc │ │ ├── dbformat.h │ │ ├── dbformat_test.cc │ │ ├── filename.cc │ │ ├── filename.h │ │ ├── filename_test.cc │ │ ├── leveldb_main.cc │ │ ├── log_format.h │ │ ├── log_reader.cc │ │ ├── log_reader.h │ │ ├── log_test.cc │ │ ├── log_writer.cc │ │ ├── log_writer.h │ │ ├── memtable.cc │ │ ├── memtable.h │ │ ├── repair.cc │ │ ├── skiplist.h │ │ ├── skiplist_test.cc │ │ ├── snapshot.h │ │ ├── table_cache.cc │ │ ├── table_cache.h │ │ ├── version_edit.cc │ │ ├── version_edit.h │ │ ├── version_edit_test.cc │ │ ├── version_set.cc │ │ ├── version_set.h │ │ ├── version_set_test.cc │ │ ├── write_batch.cc │ │ ├── write_batch_internal.h │ │ └── write_batch_test.cc │ ├── doc │ │ ├── bench │ │ │ ├── db_bench_sqlite3.cc │ │ │ └── db_bench_tree_db.cc │ │ ├── benchmark.html │ │ ├── doc.css │ │ ├── impl.html │ │ ├── index.html │ │ ├── log_format.txt │ │ └── table_format.txt │ ├── helpers │ │ └── memenv │ │ │ ├── memenv.cc │ │ │ ├── memenv.h │ │ │ └── memenv_test.cc │ ├── include │ │ └── leveldb │ │ │ ├── c.h │ │ │ ├── cache.h │ │ │ ├── comparator.h │ │ │ ├── db.h │ │ │ ├── env.h │ │ │ ├── filter_policy.h │ │ │ ├── iterator.h │ │ │ ├── options.h │ │ │ ├── slice.h │ │ │ ├── status.h │ │ │ ├── table.h │ │ │ ├── table_builder.h │ │ │ └── write_batch.h │ ├── port │ │ ├── README │ │ ├── atomic_pointer.h │ │ ├── port.h │ │ ├── port_example.h │ │ ├── port_posix.cc │ │ ├── port_posix.h │ │ ├── port_win.cc │ │ ├── port_win.h │ │ ├── thread_annotations.h │ │ └── win │ │ │ └── stdint.h │ ├── table │ │ ├── block.cc │ │ ├── block.h │ │ ├── block_builder.cc │ │ ├── block_builder.h │ │ ├── filter_block.cc │ │ ├── filter_block.h │ │ ├── filter_block_test.cc │ │ ├── format.cc │ │ ├── format.h │ │ ├── iterator.cc │ │ ├── iterator_wrapper.h │ │ ├── merger.cc │ │ ├── merger.h │ │ ├── table.cc │ │ ├── table_builder.cc │ │ ├── table_test.cc │ │ ├── two_level_iterator.cc │ │ └── two_level_iterator.h │ └── util │ │ ├── arena.cc │ │ ├── arena.h │ │ ├── arena_test.cc │ │ ├── bloom.cc │ │ ├── bloom_test.cc │ │ ├── cache.cc │ │ ├── cache_test.cc │ │ ├── coding.cc │ │ ├── coding.h │ │ ├── coding_test.cc │ │ ├── comparator.cc │ │ ├── crc32c.cc │ │ ├── crc32c.h │ │ ├── crc32c_test.cc │ │ ├── env.cc │ │ ├── env_posix.cc │ │ ├── env_test.cc │ │ ├── env_win.cc │ │ ├── filter_policy.cc │ │ ├── hash.cc │ │ ├── hash.h │ │ ├── histogram.cc │ │ ├── histogram.h │ │ ├── logging.cc │ │ ├── logging.h │ │ ├── mutexlock.h │ │ ├── options.cc │ │ ├── posix_logger.h │ │ ├── random.h │ │ ├── status.cc │ │ ├── testharness.cc │ │ ├── testharness.h │ │ ├── testutil.cc │ │ └── testutil.h ├── limitedmap.h ├── main.cpp ├── main.h ├── makefile.android ├── makefile.freebsd ├── makefile.linux-mingw ├── makefile.mingw ├── makefile.osx ├── makefile.osx-bitcoin ├── makefile.unix ├── mruset.h ├── net.cpp ├── net.h ├── netbase.cpp ├── netbase.h ├── noui.cpp ├── obj-test │ └── .gitignore ├── obj │ └── .gitignore ├── protocol.cpp ├── protocol.h ├── qt │ ├── aboutdialog.cpp │ ├── aboutdialog.h │ ├── addressbookpage.cpp │ ├── addressbookpage.h │ ├── addresstablemodel.cpp │ ├── addresstablemodel.h │ ├── askpassphrasedialog.cpp │ ├── askpassphrasedialog.h │ ├── bitcoin.cpp │ ├── bitcoin.qrc │ ├── bitcoinaddressvalidator.cpp │ ├── bitcoinaddressvalidator.h │ ├── bitcoinamountfield.cpp │ ├── bitcoinamountfield.h │ ├── bitcoingui.cpp │ ├── bitcoingui.h │ ├── bitcoinstrings.cpp │ ├── bitcoinunits.cpp │ ├── bitcoinunits.h │ ├── clientmodel.cpp │ ├── clientmodel.h │ ├── csvmodelwriter.cpp │ ├── csvmodelwriter.h │ ├── editaddressdialog.cpp │ ├── editaddressdialog.h │ ├── forms │ │ ├── aboutdialog.ui │ │ ├── addressbookpage.ui │ │ ├── askpassphrasedialog.ui │ │ ├── editaddressdialog.ui │ │ ├── optionsdialog.ui │ │ ├── overviewpage.ui │ │ ├── qrcodedialog.ui │ │ ├── rpcconsole.ui │ │ ├── sendcoinsdialog.ui │ │ ├── sendcoinsentry.ui │ │ ├── signverifymessagedialog.ui │ │ └── transactiondescdialog.ui │ ├── guiconstants.h │ ├── guiutil.cpp │ ├── guiutil.h │ ├── locale │ │ ├── bitcoin_af_ZA.ts │ │ ├── bitcoin_ar.ts │ │ ├── bitcoin_bg.ts │ │ ├── bitcoin_bs.ts │ │ ├── bitcoin_ca.ts │ │ ├── bitcoin_ca_ES.ts │ │ ├── bitcoin_cs.ts │ │ ├── bitcoin_cy.ts │ │ ├── bitcoin_da.ts │ │ ├── bitcoin_de.ts │ │ ├── bitcoin_el_GR.ts │ │ ├── bitcoin_en.ts │ │ ├── bitcoin_eo.ts │ │ ├── bitcoin_es.ts │ │ ├── bitcoin_es_CL.ts │ │ ├── bitcoin_et.ts │ │ ├── bitcoin_eu_ES.ts │ │ ├── bitcoin_fa.ts │ │ ├── bitcoin_fa_IR.ts │ │ ├── bitcoin_fi.ts │ │ ├── bitcoin_fr.ts │ │ ├── bitcoin_fr_CA.ts │ │ ├── bitcoin_gu_IN.ts │ │ ├── bitcoin_he.ts │ │ ├── bitcoin_hi_IN.ts │ │ ├── bitcoin_hr.ts │ │ ├── bitcoin_hu.ts │ │ ├── bitcoin_it.ts │ │ ├── bitcoin_ja.ts │ │ ├── bitcoin_la.ts │ │ ├── bitcoin_lt.ts │ │ ├── bitcoin_lv_LV.ts │ │ ├── bitcoin_nb.ts │ │ ├── bitcoin_nl.ts │ │ ├── bitcoin_pl.ts │ │ ├── bitcoin_pt_BR.ts │ │ ├── bitcoin_pt_PT.ts │ │ ├── bitcoin_ro_RO.ts │ │ ├── bitcoin_ru.ts │ │ ├── bitcoin_sk.ts │ │ ├── bitcoin_sr.ts │ │ ├── bitcoin_sv.ts │ │ ├── bitcoin_th_TH.ts │ │ ├── bitcoin_tr.ts │ │ ├── bitcoin_uk.ts │ │ ├── bitcoin_zh_CN.ts │ │ └── bitcoin_zh_TW.ts │ ├── macdockiconhandler.h │ ├── macdockiconhandler.mm │ ├── macnotificationhandler.h │ ├── macnotificationhandler.mm │ ├── monitoreddatamapper.cpp │ ├── monitoreddatamapper.h │ ├── notificator.cpp │ ├── notificator.h │ ├── optionsdialog.cpp │ ├── optionsdialog.h │ ├── optionsmodel.cpp │ ├── optionsmodel.h │ ├── overviewpage.cpp │ ├── overviewpage.h │ ├── paymentserver.cpp │ ├── paymentserver.h │ ├── qrcodedialog.cpp │ ├── qrcodedialog.h │ ├── qvalidatedlineedit.cpp │ ├── qvalidatedlineedit.h │ ├── qvaluecombobox.cpp │ ├── qvaluecombobox.h │ ├── res │ │ ├── bitcoin-qt.rc │ │ ├── icons │ │ │ ├── add.png │ │ │ ├── address-book.png │ │ │ ├── bitcoin.icns │ │ │ ├── bitcoin.ico │ │ │ ├── bitcoin.png │ │ │ ├── bitcoin_testnet.ico │ │ │ ├── bitcoin_testnet.png │ │ │ ├── clock1.png │ │ │ ├── clock2.png │ │ │ ├── clock3.png │ │ │ ├── clock4.png │ │ │ ├── clock5.png │ │ │ ├── configure.png │ │ │ ├── connect0_16.png │ │ │ ├── connect1_16.png │ │ │ ├── connect2_16.png │ │ │ ├── connect3_16.png │ │ │ ├── connect4_16.png │ │ │ ├── debugwindow.png │ │ │ ├── edit.png │ │ │ ├── editcopy.png │ │ │ ├── editpaste.png │ │ │ ├── export.png │ │ │ ├── filesave.png │ │ │ ├── history.png │ │ │ ├── key.png │ │ │ ├── lock_closed.png │ │ │ ├── lock_open.png │ │ │ ├── notsynced.png │ │ │ ├── overview.png │ │ │ ├── qrcode.png │ │ │ ├── quit.png │ │ │ ├── receive.png │ │ │ ├── remove.png │ │ │ ├── send.png │ │ │ ├── synced.png │ │ │ ├── toolbar.png │ │ │ ├── toolbar_testnet.png │ │ │ ├── transaction0.png │ │ │ ├── transaction2.png │ │ │ ├── tx_inout.png │ │ │ ├── tx_input.png │ │ │ ├── tx_mined.png │ │ │ └── tx_output.png │ │ ├── images │ │ │ ├── about.png │ │ │ ├── splash.png │ │ │ └── splash_testnet.png │ │ ├── movies │ │ │ └── update_spinner.mng │ │ └── src │ │ │ ├── bitcoin.svg │ │ │ ├── clock1.svg │ │ │ ├── clock2.svg │ │ │ ├── clock3.svg │ │ │ ├── clock4.svg │ │ │ ├── clock5.svg │ │ │ ├── clock_green.svg │ │ │ ├── inout.svg │ │ │ └── questionmark.svg │ ├── rpcconsole.cpp │ ├── rpcconsole.h │ ├── sendcoinsdialog.cpp │ ├── sendcoinsdialog.h │ ├── sendcoinsentry.cpp │ ├── sendcoinsentry.h │ ├── signverifymessagedialog.cpp │ ├── signverifymessagedialog.h │ ├── splashscreen.cpp │ ├── splashscreen.h │ ├── test │ │ ├── test_main.cpp │ │ ├── uritests.cpp │ │ └── uritests.h │ ├── transactiondesc.cpp │ ├── transactiondesc.h │ ├── transactiondescdialog.cpp │ ├── transactiondescdialog.h │ ├── transactionfilterproxy.cpp │ ├── transactionfilterproxy.h │ ├── transactionrecord.cpp │ ├── transactionrecord.h │ ├── transactiontablemodel.cpp │ ├── transactiontablemodel.h │ ├── transactionview.cpp │ ├── transactionview.h │ ├── walletframe.cpp │ ├── walletframe.h │ ├── walletmodel.cpp │ ├── walletmodel.h │ ├── walletstack.cpp │ ├── walletstack.h │ ├── walletview.cpp │ └── walletview.h ├── rpcblockchain.cpp ├── rpcdump.cpp ├── rpcmining.cpp ├── rpcnet.cpp ├── rpcrawtransaction.cpp ├── rpcwallet.cpp ├── runme-android.sh ├── script.cpp ├── script.h ├── scrypt-sse2.cpp ├── scrypt.cpp ├── scrypt.h ├── serialize.h ├── softcheckpoint.cpp ├── softcheckpoint.h ├── sync.cpp ├── sync.h ├── test │ ├── Checkpoints_tests.cpp │ ├── DoS_tests.cpp │ ├── README │ ├── accounting_tests.cpp │ ├── alert_tests.cpp │ ├── allocator_tests.cpp │ ├── base32_tests.cpp │ ├── base58_tests.cpp │ ├── base64_tests.cpp │ ├── bignum_tests.cpp │ ├── bloom_tests.cpp │ ├── canonical_tests.cpp │ ├── checkblock_tests.cpp │ ├── compress_tests.cpp │ ├── data │ │ ├── alertTests │ │ ├── base58_encode_decode.json │ │ ├── base58_keys_invalid.json │ │ ├── base58_keys_valid.json │ │ ├── script_invalid.json │ │ ├── script_valid.json │ │ ├── sig_canonical.json │ │ ├── sig_noncanonical.json │ │ ├── tx_invalid.json │ │ └── tx_valid.json │ ├── getarg_tests.cpp │ ├── key_tests.cpp │ ├── miner_tests.cpp │ ├── mruset_tests.cpp │ ├── multisig_tests.cpp │ ├── netbase_tests.cpp │ ├── pmt_tests.cpp │ ├── rpc_tests.cpp │ ├── script_P2SH_tests.cpp │ ├── script_tests.cpp │ ├── serialize_tests.cpp │ ├── sigopcount_tests.cpp │ ├── test_bitcoin.cpp │ ├── transaction_tests.cpp │ ├── uint160_tests.cpp │ ├── uint256_tests.cpp │ ├── util_tests.cpp │ └── wallet_tests.cpp ├── threadsafety.h ├── twister.cpp ├── twister.h ├── twister_rss.cpp ├── twister_rss.h ├── twister_utils.cpp ├── twister_utils.h ├── txdb.cpp ├── txdb.h ├── ui_interface.h ├── uint256.h ├── utf8core.h ├── util.cpp ├── util.h ├── version.cpp ├── version.h ├── wallet.cpp ├── wallet.h ├── walletdb.cpp └── walletdb.h ├── twister-control.py ├── twister-on-docker └── twister-qt.pro /.gitattributes: -------------------------------------------------------------------------------- 1 | src/version.cpp export-subst 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | src/*.exe 2 | src/bitcoin 3 | src/bitcoind 4 | src/test_bitcoin 5 | .*.swp 6 | *.*~* 7 | *.bak 8 | *.rej 9 | *.orig 10 | *.o 11 | *.patch 12 | .bitcoin 13 | 14 | # http://www.gnu.org/software/automake 15 | 16 | Makefile.in 17 | 18 | # http://www.gnu.org/software/autoconf 19 | 20 | /autom4te.cache 21 | /aclocal.m4 22 | /compile 23 | /configure 24 | /depcomp 25 | /install-sh 26 | /missing 27 | /m4/* 28 | 29 | # 30 | /config.log 31 | /config.status 32 | /config.report 33 | 34 | # 35 | *.lo 36 | 37 | 38 | # Compilation and Qt preprocessor part 39 | *.qm 40 | Makefile 41 | bitcoin-qt 42 | Bitcoin-Qt.app 43 | 44 | # Unit-tests 45 | Makefile.test 46 | bitcoin-qt_test 47 | 48 | # Resources cpp 49 | qrc_*.cpp 50 | 51 | # Qt creator 52 | *.pro.user 53 | 54 | # Mac specific 55 | .DS_Store 56 | build 57 | 58 | !src/leveldb-*/Makefile 59 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | Contributors communicate through various channels: 4 | 5 | - GitHub: [miguelfreitas/twister-core](https://github.com/miguelfreitas/twister-core/issues/) 6 | - Google Groups: [`twister-users`](http://groups.google.com/d/forum/twister-users) 7 | - IRC: [`#twister`](https://kiwiirc.com/client/chat.freenode.net/#twister) 8 | - Wiki: http://wiki.twister.net.co 9 | - Twitter: [@TwisterPtoP](https://twitter.com/TwisterPtoP) 10 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 twister Developers 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Dockerfile for building Twister peer-to-peer micro-blogging 3 | # 4 | FROM ubuntu:14.04 5 | 6 | # Install twister-core 7 | RUN apt-get update 8 | RUN apt-get install -y git autoconf libtool build-essential libboost-all-dev libssl-dev libdb++-dev libminiupnpc-dev && apt-get clean 9 | #RUN git clone https://github.com/miguelfreitas/twister-core.git 10 | ADD . /twister-core 11 | RUN cd twister-core && \ 12 | ./bootstrap.sh && \ 13 | make 14 | 15 | # Install twister-html 16 | RUN git clone https://github.com/miguelfreitas/twister-html.git /twister-html 17 | 18 | # Configure HOME directory 19 | # and persist twister data directory as a volume 20 | ENV HOME /root 21 | VOLUME /root/.twister 22 | 23 | # Run twisterd by default 24 | ENTRYPOINT ["/twister-core/twisterd", "-rpcuser=user", "-rpcpassword=pwd", "-rpcallowip=172.17.42.1", "-htmldir=/twister-html", "-printtoconsole"] 25 | EXPOSE 28332 26 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Building twister 2 | 3 | *************************************************************** 4 | *** THIS IS ALPHA SOFTWARE - THE BUILD SYSTEM IS UNFINISHED *** 5 | *************************************************************** 6 | 7 | This software is a proof-of-concept, a forced marriage between 8 | bitcoin and libtorrent codebases. So don't expect an easy ride. 9 | Building this thing is quite hacky (but hopefully not complicated). 10 | 11 | 1) Twister relies on a bundled custom version of libtorrent, so 12 | first you need to build that: 13 | 14 | $ cd libtorrent 15 | $ ./bootstrap.sh 16 | $ ./configure --enable-logging --enable-debug --enable-dht 17 | $ make 18 | 19 | Note1: 64-bit systems may need eg. "--with-boost-libdir=/usr/lib64" 20 | or "--with-boost-libdir=/usr/lib/x86_64-linux-gnu/" 21 | Note2: disable logging if you want, but at this point it might 22 | help to diagnose problems in case anything goes wrong. 23 | 24 | 2) Then, for bitcoin/twister, you have actually two choices to 25 | build. Both will produce (almost) the same "twisterd" executable, 26 | so try which one works for you. 27 | 28 | 2a) Using qmake 29 | 30 | $ qmake 31 | $ make 32 | 33 | 2b) Using standard makefile 34 | 35 | $ cd src 36 | $ make -f makefile.unix 37 | 38 | 39 | DEPENDENCIES 40 | ============ 41 | 42 | OpenSSL, Berkeley DB, Boost and miniupnpc are required. 43 | 44 | Please read doc/build-unix.md for a complete list and instructions. 45 | 46 | 47 | 48 | Original bitcoin build instruction 49 | ================================== 50 | 51 | See doc/readme-qt.md for instructions on building Bitcoin-Qt. 52 | (note: the graphic interface is disabled) 53 | 54 | See doc/build-*.md for instructions on building bitcoind, 55 | the intended-for-services, no-graphical-interface, reference 56 | implementation of Bitcoin. 57 | 58 | 59 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ./autotool.sh 4 | ./configure $@ 5 | 6 | -------------------------------------------------------------------------------- /contrib/buildenv/.gitignore: -------------------------------------------------------------------------------- 1 | #vagrant part 2 | vagrant 3 | .vagrant -------------------------------------------------------------------------------- /contrib/buildenv/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | require 'time' 4 | timezone = Time.now.zone 5 | 6 | 7 | Vagrant.configure("2") do |config| 8 | 9 | config.vm.define "precise64" do |precise64| 10 | precise64.vm.box = 'precise64' 11 | precise64.vm.box_url = 'http://files.vagrantup.com/precise64.box' 12 | end 13 | 14 | #config.vm.define "saucy64" do |saucy64| 15 | # saucy64.vm.box = 'saucy64' 16 | # saucy64.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-amd64-vagrant-disk1.box' 17 | #end 18 | 19 | 20 | config.vm.provider "virtualbox" do |v| 21 | v.customize ["modifyvm", :id, "--memory", ENV.fetch('VAGRANT_RAM', 1024)] 22 | v.customize ["modifyvm", :id, "--cpus", ENV.fetch('VAGRANT_CPU', 1)] 23 | v.customize ["modifyvm", :id, "--rtcuseutc", "on"] 24 | end 25 | 26 | 27 | config.vm.synced_folder "../../", "/home/vagrant/twister-core" 28 | 29 | config.vm.network :public_network 30 | config.vm.network :forwarded_port, guest: 28332, host: 28332, host_ip: '127.0.0.1' 31 | 32 | config.vm.provision :shell do |s| 33 | bootstrap = ENV.fetch('DO_BOOTSTRAP', 1) 34 | compile = ENV.fetch('DO_COMPILE', 1) 35 | run = ENV.fetch('DO_RUN', 1) 36 | s.path = 'scripts/vagrant_bootstrap.sh' 37 | s.args = ["#{timezone}", "#{bootstrap}", "#{compile}", "#{run}"] 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /contrib/buildenv/scripts/activate: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 3 | 4 | export TWISTER_CORE_PATH='/home/vagrant/twister-core' 5 | export TWISTER_HOME='/home/vagrant/.twister' 6 | 7 | alias twisterd='$TWISTER_CORE_PATH/twisterd' 8 | 9 | 10 | 11 | if [ ! -n "$TWISTER_OLD_PATH" ]; then 12 | echo 'setting up the environment' 13 | export TWISTER_OLD_PATH=$PATH 14 | export TWISTER_OLD_PS1=$PS1 15 | export PATH=$DIR/bin:$PATH 16 | export PS1="(twister)$PS1\n> " 17 | else 18 | echo 'already active' 19 | fi 20 | 21 | function deactivate { 22 | if [ -n "$TWISTER_OLD_PATH" ]; then 23 | echo 'cleaning up the environment' 24 | export PATH=$TWISTER_OLD_PATH 25 | export PS1=$TWISTER_OLD_PS1 26 | unset TWISTER_OLD_PATH 27 | unset TWISTER_OLD_PS1 28 | unset -f deactivate 29 | fi 30 | } -------------------------------------------------------------------------------- /contrib/buildenv/scripts/bin/twister: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RPCUSER='user' 4 | RPCPASSWORD='pwd' 5 | RPCALLOWIP='127.0.0.1' 6 | 7 | BIN=$TWISTER_CORE_PATH/twisterd 8 | 9 | CONFFILE="$TWISTER_HOME/twister.conf" 10 | 11 | OPTS="-daemon -debug" 12 | if [ ! -f "$CONFFILE" ]; then 13 | OPTS='$OPTS -pid=$PIDFILE -rpcuser=$RPCUSER -rpcpassword=$RPCPASSWORD -rpcallowip=$RPCALLOWIP' 14 | fi 15 | 16 | 17 | function usage { 18 | echo "Usage : $(basename $0) start|stop" 19 | echo 20 | exit 21 | } 22 | 23 | if [ $# -lt 1 ] 24 | then 25 | usage $@ 26 | fi 27 | 28 | case "$1" in 29 | start) $BIN $OPTS 30 | echo 31 | ;; 32 | stop) $BIN stop 33 | ;; 34 | *) echo "Invalid option: $1" 35 | usage $@ 36 | ;; 37 | esac -------------------------------------------------------------------------------- /contrib/debian/README: -------------------------------------------------------------------------------- 1 | This directory contains files used to package bitcoind/bitcoin-qt 2 | for Debian-based Linux systems. 3 | 4 | If you compile bitcoind/bitcoin-qt yourself, there are some 5 | useful files here: 6 | 7 | bitcoin: URI support 8 | -------------------- 9 | 10 | bitcoin-qt.desktop (Gnome / Open Desktop) 11 | To install: 12 | sudo desktop-file-install bitcoin-qt.desktop 13 | sudo update-desktop-database 14 | 15 | If you build yourself, you will either need to modify the paths in 16 | the .desktop file or copy or symlink your bitcoin-qt binary to /usr/bin 17 | and the ../../share/pixmaps/bitcoin128.png to /usr/share/pixmaps 18 | 19 | bitcoin-qt.protocol (KDE) 20 | 21 | -------------------------------------------------------------------------------- /contrib/debian/bitcoin-qt.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | Name=Bitcoin 4 | Comment=Bitcoin P2P Cryptocurrency 5 | Comment[fr]=Bitcoin, monnaie virtuelle cryptographique pair à pair 6 | Comment[tr]=Bitcoin, eşten eşe kriptografik sanal para birimi 7 | Exec=/usr/bin/bitcoin-qt %u 8 | Terminal=false 9 | Type=Application 10 | Icon=/usr/share/pixmaps/bitcoin128.png 11 | MimeType=x-scheme-handler/bitcoin; 12 | Categories=Office; 13 | -------------------------------------------------------------------------------- /contrib/debian/bitcoin-qt.install: -------------------------------------------------------------------------------- 1 | bitcoin-qt usr/bin 2 | share/pixmaps/bitcoin32.xpm usr/share/pixmaps 3 | share/pixmaps/bitcoin16.xpm usr/share/pixmaps 4 | share/pixmaps/bitcoin128.png usr/share/pixmaps 5 | debian/bitcoin-qt.desktop usr/share/applications 6 | debian/bitcoin-qt.protocol usr/share/kde4/services/ 7 | -------------------------------------------------------------------------------- /contrib/debian/bitcoin-qt.lintian-overrides: -------------------------------------------------------------------------------- 1 | # Linked code is Expat - only Debian packaging is GPL-2+ 2 | bitcoin-qt: possible-gpl-code-linked-with-openssl 3 | -------------------------------------------------------------------------------- /contrib/debian/bitcoin-qt.protocol: -------------------------------------------------------------------------------- 1 | [Protocol] 2 | exec=bitcoin-qt '%u' 3 | protocol=bitcoin 4 | input=none 5 | output=none 6 | helper=true 7 | listing= 8 | reading=false 9 | writing=false 10 | makedir=false 11 | deleting=false 12 | -------------------------------------------------------------------------------- /contrib/debian/bitcoind.bash-completion: -------------------------------------------------------------------------------- 1 | contrib/bitcoind.bash-completion bitcoind 2 | -------------------------------------------------------------------------------- /contrib/debian/bitcoind.examples: -------------------------------------------------------------------------------- 1 | debian/examples/bitcoin.conf 2 | -------------------------------------------------------------------------------- /contrib/debian/bitcoind.install: -------------------------------------------------------------------------------- 1 | src/bitcoind usr/bin 2 | -------------------------------------------------------------------------------- /contrib/debian/bitcoind.lintian-overrides: -------------------------------------------------------------------------------- 1 | # Linked code is Expat - only Debian packaging is GPL-2+ 2 | bitcoind: possible-gpl-code-linked-with-openssl 3 | -------------------------------------------------------------------------------- /contrib/debian/bitcoind.manpages: -------------------------------------------------------------------------------- 1 | debian/manpages/bitcoind.1 2 | debian/manpages/bitcoin.conf.5 3 | -------------------------------------------------------------------------------- /contrib/debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /contrib/debian/gbp.conf: -------------------------------------------------------------------------------- 1 | # Configuration file for git-buildpackage and friends 2 | 3 | [DEFAULT] 4 | pristine-tar = True 5 | sign-tags = True 6 | -------------------------------------------------------------------------------- /contrib/debian/patches/README: -------------------------------------------------------------------------------- 1 | 0xxx: Grabbed from upstream development. 2 | 1xxx: Possibly relevant for upstream adoption. 3 | 2xxx: Only relevant for official Debian release. 4 | -------------------------------------------------------------------------------- /contrib/debian/patches/series: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /contrib/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- mode: makefile; coding: utf-8 -*- 3 | 4 | #DEB_MAKE_CHECK_TARGET = test_bitcoin 5 | #build/bitcoind:: 6 | # $(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),,src/test_bitcoin) 7 | 8 | DEB_INSTALL_EXAMPLES_bitcoind += debian/examples/* 9 | DEB_INSTALL_MANPAGES_bitcoind += debian/manpages/* 10 | 11 | %: 12 | dh --with bash-completion $@ 13 | 14 | override_dh_auto_build: 15 | cd src; $(MAKE) -f makefile.unix bitcoind 16 | $(MAKE) 17 | 18 | override_dh_auto_clean: 19 | if [ -f Makefile ]; then $(MAKE) clean; else rm -rf build/; rm -f bitcoin-qt; fi 20 | cd src; $(MAKE) -f makefile.unix clean 21 | 22 | override_dh_auto_configure: 23 | qmake bitcoin-qt.pro USE_QRCODE=1 24 | 25 | override_dh_auto_test: 26 | cd src; $(MAKE) -f makefile.unix test_bitcoin 27 | src/test_bitcoin 28 | 29 | # Ensure wrapper is set executable 30 | binary-post-install/bitcoind: 31 | chmod +x $(cdbs_curdestdir)usr/bin/bitcoind 32 | binary-post-install/bitcoin-qt: 33 | chmod +x $(cdbs_curdestdir)usr/bin/bitcoin-qt 34 | -------------------------------------------------------------------------------- /contrib/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /contrib/debian/watch: -------------------------------------------------------------------------------- 1 | # Run the "uscan" command to check for upstream updates and more. 2 | version=3 3 | # use qa.debian.org redirector; see man uscan 4 | opts=uversionmangle=s/(\d)(alpha|beta|rc)/$1~$2/;s/\-src//,dversionmangle=s/~dfsg\d*// \ 5 | http://sf.net/bitcoin/bitcoin-(\d.*)-linux\.tar\.gz debian 6 | opts=uversionmangle=s/(\d)(alpha|beta|rc)/$1~$2/,dversionmangle=s/~dfsg\d*// \ 7 | http://githubredir.debian.net/github/bitcoin/bitcoin v(.*).tar.gz 8 | -------------------------------------------------------------------------------- /contrib/gitian-downloader/bluematt-key.pgp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/contrib/gitian-downloader/bluematt-key.pgp -------------------------------------------------------------------------------- /contrib/gitian-downloader/devrandom-key.pgp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/contrib/gitian-downloader/devrandom-key.pgp -------------------------------------------------------------------------------- /contrib/gitian-downloader/gavinandresen-key.pgp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/contrib/gitian-downloader/gavinandresen-key.pgp -------------------------------------------------------------------------------- /contrib/gitian-downloader/laanwj-key.pgp: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | Version: SKS 1.1.0 3 | 4 | mQENBE5UtMEBCADOUz2i9l/D8xYINCmfUDnxi+DXvX5LmZ39ZdvsoE+ugO0SRRGdIHEFO2is 5 | 0xezX50wXu9aneb+tEqM0BuiLo6VxaXpxrkxHpr6c4jf37SkE/H0qsi/txEUp7337y3+4HMG 6 | lUjiuh802I72p1qusjsKBnmnnR0rwNouTcoDmGUDh7jpKCtzFv+2TR2dRthJn7vmmjq3+bG6 7 | PYfqoFY1yHrAGT1lrDBULZsQ/NBLI2+J4oo2LYv3GCq8GNnzrovqvTvui50VSROhLrOe58o2 8 | shE+sjQShAy5wYkPt1R1fQnpfx+5vf+TPnkxVwRb3h5GhCp0YL8XC/BXsd5vM4KlVH2rABEB 9 | AAG0K1dsYWRpbWlyIEouIHZhbiBkZXIgTGFhbiA8bGFhbndqQGdtYWlsLmNvbT6JATgEEwEC 10 | ACIFAk5UtMECGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEHSBCwEjRsmmy6YIAK09 11 | buNXyYQrJBsX16sXxEhx5QPKyF3uHJDFJv66SdnpvIkNoznsaPiRJkbTANop93FZmaGa6wVn 12 | zGDiz7jPA8Dpxx5aAYPhIT+zPJAdXWM3wJ/Gio9besRNzniai8Lwi5MZ9R/5yFGBobm6/AcN 13 | 4sUoqA3NSV2U3I29R0Vwlzo8GVtmyi9ENSi6Oo7AcXNTRt69cxW4nAHkB+amwwDJlcAb31ex 14 | bogYXPhScwqQZixRr+JBkKxBjkTXXnQypT4KI5SegYwQVYfyiZmDP7UHKe/u6pSKKbVphLg8 15 | xLB5spcXse8/a2+onrbNlw6y8TXiJ++Z54PE7zztWTXf2huakeG5AQ0ETlS0wQEIAMNO3OkP 16 | xoPRKWzBLcI7JRITAW+HNaLTq3uN2+4WxA57DEjbL9EDoAv+7wTkDAL40f0T+xiu6GJcLFjw 17 | GJZu/tYu7+mErHjrdo+K4suCQt7w5EXCBvOLjhW4tyYMzNx8hP+oqzOW9iEC+6VV91+DYeqt 18 | EkJuyVXOI4vzBlTw8uGow8aMMsCq8XVvKUZFTPsjGl197Q5B3A+ZOFCR8xqiqdPjuz6MglVV 19 | oFdDNu3EZn8zkGsQlovXoE9ndVeVzx/XMNmsxFaMYsReUs253RIf1FEfgExID0fg2OnyLCjS 20 | 2iFW1RgajS+/saIkKl+N1iuMzJA7wMAM0plhRueOG0MtZSsAEQEAAYkBHwQYAQIACQUCTlS0 21 | wQIbDAAKCRB0gQsBI0bJpmsDB/4waenn2CvSHXyomykfpwf5lMte1V5LvH3z5R2LY+1NopRv 22 | LSz3iC39x69XWiTbhywDfgafnGPW4pWBOff2/bu5/A6z1Hnan1vyrRRD/hx1uMJ7S6q+bIvZ 23 | iVIg1p0jH6tdIIhwX3cydhdRZHo7e9oSMgOUWsr6Ar59NRo9CENwGPE4U61HXfOnxWdrFWoA 24 | XdwZczBeLxmUy6Vo6sKqv+gE4bqrtAM0sY/MsQ9cU95x+52ox/sq44lQMwd3ZBYUP7B1qbHI 25 | hZSZuch6MLi5scLPeau0ZvCaljiaMeivP5+x0gWPRs0kI+9sZxInbqvrsJ6oOBJM3xYGhtn1 26 | zZ7qmZR7 27 | =si/k 28 | -----END PGP PUBLIC KEY BLOCK----- 29 | -------------------------------------------------------------------------------- /contrib/gitian-downloader/linux-download-config: -------------------------------------------------------------------------------- 1 | --- 2 | name: bitcoin 3 | urls: 4 | - http://bitcoin.org/bitcoin-latest-linux-gitian.zip 5 | rss: 6 | - url: http://sourceforge.net/api/file/index/project-id/244765/mtime/desc/limit/100/rss 7 | xpath: //item/link/text() 8 | pattern: bitcoin-\d+.\d+.\d+-linux-gitian.zip 9 | signers: 10 | 0A82509767C7D4A5D14DA2301AE1D35043E08E54: 11 | weight: 40 12 | name: BlueMatt 13 | key: bluematt 14 | BF6273FAEF7CC0BA1F562E50989F6B3048A116B5: 15 | weight: 40 16 | name: Devrandom 17 | key: devrandom 18 | E463A93F5F3117EEDE6C7316BD02942421F4889F: 19 | weight: 40 20 | name: Luke-Jr 21 | key: luke-jr 22 | D762373D24904A3E42F33B08B9A408E71DAAC974: 23 | weight: 40 24 | name: "Pieter Wuille" 25 | key: sipa 26 | 77E72E69DA7EE0A148C06B21B34821D4944DE5F7: 27 | weight: 40 28 | name: tcatm 29 | key: tcatm 30 | 01CDF4627A3B88AAE4A571C87588242FBE38D3A8: 31 | weight: 40 32 | name: "Gavin Andresen" 33 | key: gavinandresen 34 | 71A3B16735405025D447E8F274810B012346C9A6: 35 | weight: 40 36 | name: "Wladimir J. van der Laan" 37 | key: laanwj 38 | AEC1884398647C47413C1C3FB1179EB7347DC10D: 39 | weight: 40 40 | name: "Warren Togami" 41 | key: wtogami 42 | minimum_weight: 120 43 | -------------------------------------------------------------------------------- /contrib/gitian-downloader/luke-jr-key.pgp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/contrib/gitian-downloader/luke-jr-key.pgp -------------------------------------------------------------------------------- /contrib/gitian-downloader/sipa-key.pgp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/contrib/gitian-downloader/sipa-key.pgp -------------------------------------------------------------------------------- /contrib/gitian-downloader/tcatm-key.pgp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/contrib/gitian-downloader/tcatm-key.pgp -------------------------------------------------------------------------------- /contrib/gitian-downloader/win32-download-config: -------------------------------------------------------------------------------- 1 | --- 2 | name: bitcoin 3 | urls: 4 | - http://bitcoin.org/bitcoin-latest-win32-gitian.zip 5 | rss: 6 | - url: http://sourceforge.net/api/file/index/project-id/244765/mtime/desc/limit/100/rss 7 | xpath: //item/link/text() 8 | pattern: bitcoin-\d+.\d+.\d+-win32-gitian.zip 9 | signers: 10 | 0A82509767C7D4A5D14DA2301AE1D35043E08E54: 11 | weight: 40 12 | name: BlueMatt 13 | key: bluematt 14 | BF6273FAEF7CC0BA1F562E50989F6B3048A116B5: 15 | weight: 40 16 | name: Devrandom 17 | key: devrandom 18 | E463A93F5F3117EEDE6C7316BD02942421F4889F: 19 | weight: 40 20 | name: Luke-Jr 21 | key: luke-jr 22 | D762373D24904A3E42F33B08B9A408E71DAAC974: 23 | weight: 40 24 | name: "Pieter Wuille" 25 | key: sipa 26 | 77E72E69DA7EE0A148C06B21B34821D4944DE5F7: 27 | weight: 40 28 | name: tcatm 29 | key: tcatm 30 | 01CDF4627A3B88AAE4A571C87588242FBE38D3A8: 31 | weight: 40 32 | name: "Gavin Andresen" 33 | key: gavinandresen 34 | 71A3B16735405025D447E8F274810B012346C9A6: 35 | weight: 40 36 | name: "Wladimir J. van der Laan" 37 | key: laanwj 38 | AEC1884398647C47413C1C3FB1179EB7347DC10D: 39 | weight: 40 40 | name: "Warren Togami" 41 | key: wtogami 42 | minimum_weight: 120 43 | -------------------------------------------------------------------------------- /contrib/homebrew/bitcoin.qt.pro.patch: -------------------------------------------------------------------------------- 1 | diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro 2 | index d938c07..e1dd4ec 100644 3 | --- a/bitcoin-qt.pro 4 | +++ b/bitcoin-qt.pro 5 | @@ -353,7 +353,7 @@ 6 | } 7 | 8 | isEmpty(BDB_LIB_PATH) { 9 | - macx:BDB_LIB_PATH = /opt/local/lib/db48 10 | + macx:BDB_LIB_PATH = /usr/local/opt/berkeley-db4/lib 11 | } 12 | 13 | isEmpty(BDB_LIB_SUFFIX) { 14 | @@ -361,15 +361,15 @@ 15 | } 16 | 17 | isEmpty(BDB_INCLUDE_PATH) { 18 | - macx:BDB_INCLUDE_PATH = /opt/local/include/db48 19 | + macx:BDB_INCLUDE_PATH = /usr/local/opt/berkeley-db4/include 20 | } 21 | 22 | isEmpty(BOOST_LIB_PATH) { 23 | - macx:BOOST_LIB_PATH = /opt/local/lib 24 | + macx:BOOST_LIB_PATH = /usr/local/opt/boost/lib 25 | } 26 | 27 | isEmpty(BOOST_INCLUDE_PATH) { 28 | - macx:BOOST_INCLUDE_PATH = /opt/local/include 29 | + macx:BOOST_INCLUDE_PATH = /usr/local/opt/boost/include 30 | } 31 | 32 | win32:DEFINES += WIN32 33 | -------------------------------------------------------------------------------- /contrib/homebrew/makefile.osx.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/makefile.osx b/src/makefile.osx 2 | index bef0ef3..07ef8d3 100644 3 | --- a/src/makefile.osx 4 | +++ b/src/makefile.osx 5 | @@ -7,17 +7,21 @@ 6 | # Originally by Laszlo Hanyecz (solar@heliacal.net) 7 | 8 | CXX=llvm-g++ 9 | -DEPSDIR=/opt/local 10 | +DEPSDIR=/usr/local 11 | +DB4DIR=/usr/local/opt/berkeley-db4 12 | +OPENSSLDIR=/usr/local/opt/openssl 13 | 14 | INCLUDEPATHS= \ 15 | -I"$(CURDIR)" \ 16 | - -I"$(CURDIR)"/obj \ 17 | + -I"$(CURDIR)/obj" \ 18 | -I"$(DEPSDIR)/include" \ 19 | - -I"$(DEPSDIR)/include/db48" 20 | + -I"$(DB4DIR)/include" \ 21 | + -I"$(OPENSSLDIR)/include" 22 | 23 | LIBPATHS= \ 24 | -L"$(DEPSDIR)/lib" \ 25 | - -L"$(DEPSDIR)/lib/db48" 26 | + -L"$(DB4DIR)/lib" \ 27 | + -L"$(OPENSSLDIR)/lib" 28 | 29 | USE_UPNP:=1 30 | USE_IPV6:=1 31 | @@ -31,14 +35,14 @@ ifdef STATIC 32 | TESTLIBS += \ 33 | $(DEPSDIR)/lib/libboost_unit_test_framework-mt.a 34 | LIBS += \ 35 | - $(DEPSDIR)/lib/db48/libdb_cxx-4.8.a \ 36 | + $(DB4DIR)/lib/libdb_cxx-4.8.a \ 37 | $(DEPSDIR)/lib/libboost_system-mt.a \ 38 | $(DEPSDIR)/lib/libboost_filesystem-mt.a \ 39 | $(DEPSDIR)/lib/libboost_program_options-mt.a \ 40 | $(DEPSDIR)/lib/libboost_thread-mt.a \ 41 | $(DEPSDIR)/lib/libboost_chrono-mt.a \ 42 | - $(DEPSDIR)/lib/libssl.a \ 43 | - $(DEPSDIR)/lib/libcrypto.a \ 44 | + $(OPENSSLDIR)/lib/libssl.a \ 45 | + $(OPENSSLDIR)/lib/libcrypto.a \ 46 | -lz 47 | else 48 | TESTLIBS += \ 49 | -------------------------------------------------------------------------------- /contrib/macdeploy/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/contrib/macdeploy/background.png -------------------------------------------------------------------------------- /contrib/macdeploy/background.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/contrib/macdeploy/background.psd -------------------------------------------------------------------------------- /contrib/macdeploy/fancy.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | window_bounds 6 | 7 | 300 8 | 300 9 | 800 10 | 620 11 | 12 | background_picture 13 | background.png 14 | icon_size 15 | 96 16 | applications_symlink 17 | 18 | items_position 19 | 20 | Applications 21 | 22 | 370 23 | 156 24 | 25 | Bitcoin-Qt.app 26 | 27 | 128 28 | 156 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /contrib/macdeploy/notes.txt: -------------------------------------------------------------------------------- 1 | 2 | macdeployqtplus works best on OS X Lion, for Snow Leopard you'd need to install 3 | Python 2.7 and make it your default Python installation. 4 | 5 | You will need the appscript package for the fancy disk image creation to work. 6 | Install it by invoking "sudo easy_install appscript". 7 | 8 | This script should be invoked in the target directory like this: 9 | $source_dir/contrib/macdeploy/macdeployqtplus Bitcoin-Qt.app -add-qt-tr da,de,es,hu,ru,uk,zh_CN,zh_TW -dmg -fancy $source_dir/contrib/macdeploy/fancy.plist -verbose 2 10 | 11 | During the process, the disk image window will pop up briefly where the fancy 12 | settings are applied. This is normal, please do not interfere. 13 | 14 | You can also set up Qt Creator for invoking the script. For this, go to the 15 | "Projects" tab on the left side, switch to "Run Settings" above and add a 16 | deploy configuration. Next add a deploy step choosing "Custom Process Step". 17 | Fill in the following. 18 | 19 | Enable custom process step: [x] 20 | Command: %{sourceDir}/contrib/macdeploy/macdeployqtplus 21 | Working directory: %{buildDir} 22 | Command arguments: Bitcoin-Qt.app -add-qt-tr da,de,es,hu,ru,uk,zh_CN,zh_TW -dmg -fancy %{sourceDir}/contrib/macdeploy/fancy.plist -verbose 2 23 | 24 | After that you can start the deployment process through the menu with 25 | Build -> Deploy Project "bitcoin-qt" 26 | 27 | -------------------------------------------------------------------------------- /contrib/pyminer/README: -------------------------------------------------------------------------------- 1 | 2 | This is a 'getwork' CPU mining client for bitcoin. 3 | 4 | It is pure-python, and therefore very, very slow. The purpose is to 5 | provide a reference implementation of a miner, for study. 6 | 7 | -------------------------------------------------------------------------------- /contrib/pyminer/example-config.cfg: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # RPC login details 4 | # 5 | host=127.0.0.1 6 | port=8332 7 | 8 | rpcuser=myusername 9 | rpcpass=mypass 10 | 11 | 12 | # 13 | # mining details 14 | # 15 | 16 | threads=4 17 | 18 | # periodic rate for requesting new work, if solution not found 19 | scantime=60 20 | 21 | 22 | # 23 | # misc. 24 | # 25 | 26 | # not really used right now 27 | logdir=/tmp/pyminer 28 | 29 | # set to 1, to enable hashmeter output 30 | hashmeter=0 31 | 32 | 33 | -------------------------------------------------------------------------------- /contrib/qos/README: -------------------------------------------------------------------------------- 1 | This is a Linux bash script that will set up tc to limit the outgoing bandwidth for connections to the Bitcoin network. It limits outbound TCP traffic with a source or destination port of 8333, but not if the destination IP is within a LAN (defined as 192.168.x.x). 2 | 3 | This means one can have an always-on bitcoind instance running, and another local bitcoind/bitcoin-qt instance which connects to this node and receives blocks from it. 4 | -------------------------------------------------------------------------------- /contrib/qos/tc.sh: -------------------------------------------------------------------------------- 1 | #network interface on which to limit traffic 2 | IF="eth0" 3 | #limit of the network interface in question 4 | LINKCEIL="1gbit" 5 | #limit outbound Bitcoin protocol traffic to this rate 6 | LIMIT="160kbit" 7 | #defines the address space for which you wish to disable rate limiting 8 | LOCALNET="192.168.0.0/16" 9 | 10 | #delete existing rules 11 | tc qdisc del dev ${IF} root 12 | 13 | #add root class 14 | tc qdisc add dev ${IF} root handle 1: htb default 10 15 | 16 | #add parent class 17 | tc class add dev ${IF} parent 1: classid 1:1 htb rate ${LINKCEIL} ceil ${LINKCEIL} 18 | 19 | #add our two classes. one unlimited, another limited 20 | tc class add dev ${IF} parent 1:1 classid 1:10 htb rate ${LINKCEIL} ceil ${LINKCEIL} prio 0 21 | tc class add dev ${IF} parent 1:1 classid 1:11 htb rate ${LIMIT} ceil ${LIMIT} prio 1 22 | 23 | #add handles to our classes so packets marked with go into the class with "... handle fw ..." 24 | tc filter add dev ${IF} parent 1: protocol ip prio 1 handle 1 fw classid 1:10 25 | tc filter add dev ${IF} parent 1: protocol ip prio 2 handle 2 fw classid 1:11 26 | 27 | #delete any existing rules 28 | #disable for now 29 | #ret=0 30 | #while [ $ret -eq 0 ]; do 31 | # iptables -t mangle -D OUTPUT 1 32 | # ret=$? 33 | #done 34 | 35 | #limit outgoing traffic to and from port 8333. but not when dealing with a host on the local network 36 | # (defined by $LOCALNET) 37 | # --set-mark marks packages matching these criteria with the number "2" 38 | # these packages are filtered by the tc filter with "handle 2" 39 | # this filter sends the packages into the 1:11 class, and this class is limited to ${LIMIT} 40 | iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET} -j MARK --set-mark 0x2 41 | iptables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET} -j MARK --set-mark 0x2 42 | -------------------------------------------------------------------------------- /contrib/qt_translations.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Helpful little script that spits out a comma-separated list of 4 | # language codes for Qt icons that should be included 5 | # in binary bitcoin distributions 6 | 7 | import glob 8 | import os 9 | import re 10 | import sys 11 | 12 | if len(sys.argv) != 3: 13 | sys.exit("Usage: %s $QTDIR/translations $BITCOINDIR/src/qt/locale"%sys.argv[0]) 14 | 15 | d1 = sys.argv[1] 16 | d2 = sys.argv[2] 17 | 18 | l1 = set([ re.search(r'qt_(.*).qm', f).group(1) for f in glob.glob(os.path.join(d1, 'qt_*.qm')) ]) 19 | l2 = set([ re.search(r'bitcoin_(.*).qm', f).group(1) for f in glob.glob(os.path.join(d2, 'bitcoin_*.qm')) ]) 20 | 21 | print ",".join(sorted(l1.intersection(l2))) 22 | 23 | -------------------------------------------------------------------------------- /contrib/seeds/README: -------------------------------------------------------------------------------- 1 | Utility to generate the pnSeed[] array that is compiled into the client 2 | (see src/net.cpp). 3 | 4 | The 600 seeds compiled into the 0.8 release were created from sipa's DNS seed data, like this: 5 | 6 | curl -s http://bitcoin.sipa.be/seeds.txt | head -1000 | makeseeds.py 7 | 8 | The input to makeseeds.py is assumed to be approximately sorted from most-reliable to least-reliable, 9 | with IP:port first on each line (lines that don't match IPv4:port are ignored). 10 | -------------------------------------------------------------------------------- /contrib/seeds/makeseeds.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Generate pnSeed[] from Pieter's DNS seeder 4 | # 5 | 6 | NSEEDS=600 7 | 8 | import re 9 | import sys 10 | from subprocess import check_output 11 | 12 | def main(): 13 | lines = sys.stdin.readlines() 14 | 15 | ips = [] 16 | pattern = re.compile(r"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}):8333") 17 | for line in lines: 18 | m = pattern.match(line) 19 | if m is None: 20 | continue 21 | ip = 0 22 | for i in range(0,4): 23 | ip = ip + (int(m.group(i+1)) << (8*(i))) 24 | if ip == 0: 25 | continue 26 | ips.append(ip) 27 | 28 | for row in range(0, min(NSEEDS,len(ips)), 8): 29 | print " " + ", ".join([ "0x%08x"%i for i in ips[row:row+8] ]) + "," 30 | 31 | if __name__ == '__main__': 32 | main() 33 | -------------------------------------------------------------------------------- /contrib/spendfrom/README: -------------------------------------------------------------------------------- 1 | Use the raw transactions API to send coins received on a particular 2 | address (or addresses). 3 | 4 | Depends on jsonrpc 5 | 6 | Usage: 7 | 8 | spendfrom.py --from=FROMADDRESS1[,FROMADDRESS2] --to=TOADDRESS --amount=amount \ 9 | --fee=fee --datadir=/path/to/.bitcoin --testnet --dry_run 10 | 11 | With no arguments, outputs a list of amounts associated with addresses. 12 | 13 | With arguments, sends coins received by the FROMADDRESS addresses to the TOADDRESS. 14 | 15 | You may explictly specify how much fee to pay (a fee more than 1% of the amount 16 | will fail, though, to prevent bitcoin-losing accidents). Spendfrom may fail if 17 | it thinks the transaction would never be confirmed (if the amount being sent is 18 | too small, or if the transaction is too many bytes for the fee). 19 | 20 | If a change output needs to be created, the change will be sent to the last 21 | FROMADDRESS (if you specify just one FROMADDRESS, change will go back to it). 22 | 23 | If --datadir is not specified, the default datadir is used. 24 | 25 | The --dry_run option will just create and sign the the transaction and print 26 | the transaction data (as hexadecimal), instead of broadcasting it. 27 | 28 | If the transaction is created and broadcast successfully, a transaction id 29 | is printed. 30 | 31 | If this was a tool for end-users and not programmers, it would have much friendlier 32 | error-handling. 33 | -------------------------------------------------------------------------------- /contrib/spendfrom/setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup 2 | setup(name='btcspendfrom', 3 | version='1.0', 4 | description='Command-line utility for bitcoin "coin control"', 5 | author='Gavin Andresen', 6 | author_email='gavin@bitcoinfoundation.org', 7 | requires=['jsonrpc'], 8 | scripts=['spendfrom.py'], 9 | ) 10 | -------------------------------------------------------------------------------- /contrib/test-patches/README: -------------------------------------------------------------------------------- 1 | These patches are applied when the automated pull-tester 2 | tests each pull and when master is tested using jenkins. 3 | You can find more information about the tests run at 4 | http://jenkins.bluematt.me/pull-tester/files/ 5 | -------------------------------------------------------------------------------- /contrib/test-patches/temp-revert-2.patch: -------------------------------------------------------------------------------- 1 | commit cfae26916dba311f6f75d444301c1f9362267c3e 2 | Author: Matt Corallo 3 | Date: Sun Mar 24 20:45:50 2013 -0400 4 | 5 | Revert "Checkpoint at first block in 11 March chain fork" 6 | 7 | This reverts commit f817c496a1482d05b22c8e539de67f07db1c09d9. 8 | 9 | diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp 10 | index 62234b9..9b11f0b 100644 11 | --- a/src/checkpoints.cpp 12 | +++ b/src/checkpoints.cpp 13 | @@ -44,7 +44,6 @@ namespace Checkpoints 14 | (193000, uint256("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317")) 15 | (210000, uint256("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e")) 16 | (216116, uint256("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e")) 17 | - (225430, uint256("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932")) 18 | ; 19 | static const CCheckpointData data = { 20 | &mapCheckpoints, 21 | -------------------------------------------------------------------------------- /contrib/testgen/README: -------------------------------------------------------------------------------- 1 | Utilities to generate test vectors for the data-driven Bitcoin tests 2 | -------------------------------------------------------------------------------- /contrib/tidy_datadir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -d "$1" ]; then 4 | cd "$1" 5 | else 6 | echo "Usage: $0 " >&2 7 | echo "Removes obsolete Bitcoin database files" >&2 8 | exit 1 9 | fi 10 | 11 | LEVEL=0 12 | if [ -f wallet.dat -a -f addr.dat -a -f blkindex.dat -a -f blk0001.dat ]; then LEVEL=1; fi 13 | if [ -f wallet.dat -a -f peers.dat -a -f blkindex.dat -a -f blk0001.dat ]; then LEVEL=2; fi 14 | if [ -f wallet.dat -a -f peers.dat -a -f coins/CURRENT -a -f blktree/CURRENT -a -f blocks/blk00000.dat ]; then LEVEL=3; fi 15 | if [ -f wallet.dat -a -f peers.dat -a -f chainstate/CURRENT -a -f blocks/index/CURRENT -a -f blocks/blk00000.dat ]; then LEVEL=4; fi 16 | 17 | case $LEVEL in 18 | 0) 19 | echo "Error: no Bitcoin datadir detected." 20 | exit 1 21 | ;; 22 | 1) 23 | echo "Detected old Bitcoin datadir (before 0.7)." 24 | echo "Nothing to do." 25 | exit 0 26 | ;; 27 | 2) 28 | echo "Detected Bitcoin 0.7 datadir." 29 | ;; 30 | 3) 31 | echo "Detected Bitcoin pre-0.8 datadir." 32 | ;; 33 | 4) 34 | echo "Detected Bitcoin 0.8 datadir." 35 | ;; 36 | esac 37 | 38 | FILES="" 39 | DIRS="" 40 | 41 | if [ $LEVEL -ge 3 ]; then FILES=$(echo $FILES blk????.dat blkindex.dat); fi 42 | if [ $LEVEL -ge 2 ]; then FILES=$(echo $FILES addr.dat); fi 43 | if [ $LEVEL -ge 4 ]; then DIRS=$(echo $DIRS coins blktree); fi 44 | 45 | for FILE in $FILES; do 46 | if [ -f $FILE ]; then 47 | echo "Deleting: $FILE" 48 | rm -f $FILE 49 | fi 50 | done 51 | 52 | for DIR in $DIRS; do 53 | if [ -d $DIR ]; then 54 | echo "Deleting: $DIR/" 55 | rm -rf $DIR 56 | fi 57 | done 58 | 59 | echo "Done." 60 | -------------------------------------------------------------------------------- /contrib/wallettools/walletchangepass.py: -------------------------------------------------------------------------------- 1 | from jsonrpc import ServiceProxy 2 | access = ServiceProxy("http://127.0.0.1:8332") 3 | pwd = raw_input("Enter old wallet passphrase: ") 4 | pwd2 = raw_input("Enter new wallet passphrase: ") 5 | access.walletpassphrasechange(pwd, pwd2) -------------------------------------------------------------------------------- /contrib/wallettools/walletunlock.py: -------------------------------------------------------------------------------- 1 | from jsonrpc import ServiceProxy 2 | access = ServiceProxy("http://127.0.0.1:8332") 3 | pwd = raw_input("Enter wallet passphrase: ") 4 | access.walletpassphrase(pwd, 60) -------------------------------------------------------------------------------- /doc/building-on-gentoo.md: -------------------------------------------------------------------------------- 1 | # Gentoo building instructions 2 | 3 | ## Install 4 | 5 | 1. sudo layman -o https://raw.github.com/ddorian1/gentoo-twister-overlay/master/gentoo-twister-overlay.xml -a twister 6 | 1. sudo emerge -av twister 7 | 8 | ## Configuration & web gui 9 | 10 | 1. mkdir ~/.twister 11 | 1. echo -e "rpcuser=user\nrpcpassword=pwd" > ~/.twister/twister.conf 12 | 1. chmod 600 ~/.twister/twister.conf 13 | 1. git clone https://github.com/miguelfreitas/twister-html.git ~/.twister/html 14 | 15 | ## Start 16 | 17 | 1. twisterd -rpcuser=user -rpcpassword=pwd 18 | 1. Open http://127.0.0.1:28332/index.html and use the user/pwd credentials 19 | 1. Create your account ! 20 | -------------------------------------------------------------------------------- /doc/building-on-ubuntu-debian.md: -------------------------------------------------------------------------------- 1 | # Ubuntu / Debian building instructions 2 | 3 | Tested on a pristine: 4 | - Ubuntu 13.10 amd64 5 | 6 | ## Install 7 | 8 | 1. sudo apt-get update 9 | 1. sudo apt-get install git autoconf libtool build-essential libboost-all-dev libssl-dev libdb++-dev libminiupnpc-dev automake 10 | 1. git clone https://github.com/miguelfreitas/twister-core.git 11 | 1. cd twister-core 12 | 1. ./autotool.sh 13 | 1. ./configure 14 | 1. make 15 | 16 | ## Configuration & web gui 17 | 18 | 1. mkdir ~/.twister 19 | 1. echo -e "rpcuser=user\nrpcpassword=pwd" > ~/.twister/twister.conf 20 | 1. chmod 600 ~/.twister/twister.conf 21 | 1. git clone https://github.com/miguelfreitas/twister-html.git ~/.twister/html 22 | 23 | ## Start 24 | 25 | 1. cd twister-core 26 | 1. ./twisterd -rpcuser=user -rpcpassword=pwd -rpcallowip=127.0.0.1 27 | 1. Open http://127.0.0.1:28332/index.html and use the user/pwd credentials 28 | 1. Create your account ! 29 | -------------------------------------------------------------------------------- /doc/building-on-vagrant.md: -------------------------------------------------------------------------------- 1 | # Vagrant + Ubuntu building instructions 2 | 3 | This will run a virtual machine with all tools required to build and run twister 4 | using Vagrant. 5 | This will probably work wherever vagrant can be installed so Windows, Mac, Linux 6 | at least 7 | 8 | ## Dependencies 9 | * http://www.vagrantup.com/ 10 | * https://www.virtualbox.org/ 11 | 12 | 13 | ## Install 14 | 1. git clone https://github.com/miguelfreitas/twister-core.git 15 | 2. cd twister-core/contrib/buildenv 16 | 3. vagrant up 17 | 18 | 19 | 20 | ## Tweeking 21 | If you have lots of ram and CPU in your machine, feel free to use it. 22 | Before running vagrant up please set 23 | VAGRANT_RAM and/or VAGRANT_CPU environment variables to whatever is fitting. 24 | Default is 1 CPU and 1024 MB RAM. 25 | 26 | Example with 2 CPU and 4096 MB RAM. 27 | ```bash 28 | export VAGRANT_CPU=2 29 | export VAGRANT_RAM=4096 30 | ``` -------------------------------------------------------------------------------- /libtorrent/.gitignore: -------------------------------------------------------------------------------- 1 | # http://www.gnu.org/software/automake 2 | 3 | Makefile.in 4 | 5 | # http://www.gnu.org/software/autoconf 6 | 7 | /autom4te.cache 8 | /aclocal.m4 9 | /compile 10 | /configure 11 | /depcomp 12 | /install-sh 13 | /missing 14 | /m4/* 15 | 16 | # 17 | /config.log 18 | /config.status 19 | /config.report 20 | 21 | # 22 | *.lo 23 | -------------------------------------------------------------------------------- /libtorrent/.regression.yml: -------------------------------------------------------------------------------- 1 | test_dirs: 2 | - test 3 | 4 | project: libtorrent 5 | 6 | branch: trunk 7 | 8 | clean: 9 | - test_tmp_* 10 | 11 | time_limit: 500 12 | 13 | features: 14 | - variant=release asserts=production 15 | - encryption=openssl statistics=on logging=verbose disk-stats=on bandwidth-limit-logging=on dht=logging 16 | - ipv6=off dht=off extensions=off logging=none deprecated-functions=off 17 | 18 | -------------------------------------------------------------------------------- /libtorrent/AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/AUTHORS -------------------------------------------------------------------------------- /libtorrent/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2003 - 2007, Arvid Norberg 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution. 13 | * Neither the name of Rasterbar Software nor the names of its 14 | contributors may be used to endorse or promote products derived 15 | from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /libtorrent/Jamroot.jam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/Jamroot.jam -------------------------------------------------------------------------------- /libtorrent/NEWS: -------------------------------------------------------------------------------- 1 | 2 | initial release of libtorrent 0.9 3 | 4 | -------------------------------------------------------------------------------- /libtorrent/README: -------------------------------------------------------------------------------- 1 | libtorrent is a C++ library that aims to be a good alternative to all the 2 | other bittorrent implementations around. It is a 3 | library and not a full featured client, although it comes with a working 4 | example client. 5 | 6 | The main goals of libtorrent are: 7 | 8 | * to be cpu efficient 9 | * to be memory efficient 10 | * to be very easy to use 11 | 12 | See docs/manual.html for more detailed build and usage instructions. 13 | 14 | To build with autotools, run: 15 | 16 | ./configure 17 | 18 | Followed by 19 | 20 | make 21 | 22 | When libtorrent is built, finish off by running the tests: 23 | 24 | make check 25 | 26 | -------------------------------------------------------------------------------- /libtorrent/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ./autotool.sh 4 | ./configure $@ 5 | 6 | -------------------------------------------------------------------------------- /libtorrent/build_dist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | #clear out any extended attributes that Finder may add 5 | sudo xattr -r -d com.apple.FinderInfo * 6 | 7 | rm -f config.log config.report configure 8 | rm -f m4/libtool.m4 m4/lt~obsolete.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/ltoptions.m4 9 | rm -fr autom4te.cache build-aux 10 | rm -f Makefile Makefile.in 11 | rm -f src/Makefile src/Makefile.in 12 | rm -f include/libtorrent/Makefile include/libtorrent/Makefile.in 13 | rm -f examples/Makefile examples/Makefile.in examples/.dep examples/.libs 14 | rm -rf test/Makefile test/Makefile.in test/.dep test/.lib 15 | rm -rf bindings/Makefile bindings/Makefile.in bindings/.dep bindings/.libs 16 | rm -f bindings/python/Makefile bindings/python/Makefile.in 17 | chmod a-x docs/*.rst docs/*.htm* src/*.cpp include/libtorrent/*.hpp 18 | 19 | ./autotool.sh 20 | ./configure --enable-python-binding --enable-examples=yes --enable-tests=yes --with-boost-system=mt --with-boost-python=mt --enable-tests 21 | make V=1 -j8 dist check 22 | -------------------------------------------------------------------------------- /libtorrent/clean.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | to_delete = [ 4 | 'session_stats', 5 | 'libtorrent_logs*', 6 | 'round_trip_ms.log', 7 | 'dht.log', 8 | 'upnp.log', 9 | 'natpmp.log', 10 | 'bin', 11 | 'test_tmp_*' 12 | ] 13 | 14 | directories = [ 15 | 'examples', 16 | 'test', 17 | '.', 18 | 'tools' 19 | ] 20 | 21 | for d in directories: 22 | for f in to_delete: 23 | path = os.path.join(d, f) 24 | print path 25 | os.system('rm -rf %s' % path) 26 | 27 | -------------------------------------------------------------------------------- /libtorrent/docs/Linkage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/Linkage.png -------------------------------------------------------------------------------- /libtorrent/docs/arctic_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/arctic_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/bitbuddy_thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/bitbuddy_thumb.jpg -------------------------------------------------------------------------------- /libtorrent/docs/bitfox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/bitfox.png -------------------------------------------------------------------------------- /libtorrent/docs/bitrocket_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/bitrocket_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/bitscast_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/bitscast_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/bitslug_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/bitslug_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/btg_thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/btg_thumb.jpg -------------------------------------------------------------------------------- /libtorrent/docs/bubba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/bubba.png -------------------------------------------------------------------------------- /libtorrent/docs/client_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/client_test.png -------------------------------------------------------------------------------- /libtorrent/docs/cwnd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/cwnd.png -------------------------------------------------------------------------------- /libtorrent/docs/cwnd_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/cwnd_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/delays.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/delays.png -------------------------------------------------------------------------------- /libtorrent/docs/delays_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/delays_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/deluge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/deluge.png -------------------------------------------------------------------------------- /libtorrent/docs/disk_access.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/disk_access.png -------------------------------------------------------------------------------- /libtorrent/docs/disk_access_elevator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/disk_access_elevator.png -------------------------------------------------------------------------------- /libtorrent/docs/disk_access_no_elevator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/disk_access_no_elevator.png -------------------------------------------------------------------------------- /libtorrent/docs/disk_buffer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/disk_buffer.png -------------------------------------------------------------------------------- /libtorrent/docs/disk_buffer_before_optimization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/disk_buffer_before_optimization.png -------------------------------------------------------------------------------- /libtorrent/docs/disk_buffer_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/disk_buffer_sample.png -------------------------------------------------------------------------------- /libtorrent/docs/disk_io.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/disk_io.png -------------------------------------------------------------------------------- /libtorrent/docs/electric_sheep_thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/electric_sheep_thumb.jpg -------------------------------------------------------------------------------- /libtorrent/docs/fatrat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/fatrat.png -------------------------------------------------------------------------------- /libtorrent/docs/fdm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/fdm.png -------------------------------------------------------------------------------- /libtorrent/docs/firetorrent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/firetorrent.png -------------------------------------------------------------------------------- /libtorrent/docs/flush.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/flush.jpg -------------------------------------------------------------------------------- /libtorrent/docs/folx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/folx.png -------------------------------------------------------------------------------- /libtorrent/docs/halite_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/halite_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/im_thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/im_thumb.jpg -------------------------------------------------------------------------------- /libtorrent/docs/ip_id_v4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/ip_id_v4.png -------------------------------------------------------------------------------- /libtorrent/docs/ip_id_v6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/ip_id_v6.png -------------------------------------------------------------------------------- /libtorrent/docs/ips.py: -------------------------------------------------------------------------------- 1 | #/bin/python 2 | 3 | import os 4 | import sys 5 | 6 | def num_ids(bits, total_bits): 7 | 8 | if total_bits == 32: 9 | bit_dec = 2 10 | else: 11 | bit_dec = 1 12 | 13 | num_used = 7; 14 | ret = 3 15 | 16 | while bits > 0: 17 | ret += min(num_used, bits) 18 | num_used -= bit_dec 19 | if num_used < 0: num_used = 0 20 | bits -= 8 21 | 22 | return 1 << ret 23 | 24 | f = open('ip_id_v4.dat', 'w+') 25 | for i in range(0, 33): 26 | print >>f, '%d\t%d\t%d' % (i, num_ids(i, 32), 1 << i) 27 | f.close() 28 | 29 | f = open('ip_id_v6.dat', 'w+') 30 | for i in range(0, 65): 31 | print >>f, '%d\t%d\t%d' % (i, num_ids(i, 64), 1 << i) 32 | f.close() 33 | 34 | f = open('ip_id.gnuplot', 'w+') 35 | 36 | f.write(''' 37 | set term png size 600,300 38 | set output "ip_id_v4.png" 39 | set logscale y 40 | set title "Number of possible node IDs" 41 | set ylabel "possible node IDs" 42 | set xlabel "bits controlled in IPv4" 43 | set xtics 4 44 | set grid 45 | plot "ip_id_v4.dat" using 1:2 title "octet-wise modulus" with lines, \ 46 | "ip_id_v4.dat" using 1:3 title "hash of IP" with lines 47 | 48 | set output "ip_id_v6.png" 49 | set title "Number of possible node IDs" 50 | set xlabel "bits controlled in IPv6" 51 | plot "ip_id_v6.dat" using 1:2 title "octet-wise modulus" with lines, \ 52 | "ip_id_v6.dat" using 1:3 title "hash of IP" with lines 53 | ''') 54 | f.close() 55 | os.system('gnuplot ip_id.gnuplot') 56 | 57 | -------------------------------------------------------------------------------- /libtorrent/docs/leechcraft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/leechcraft.png -------------------------------------------------------------------------------- /libtorrent/docs/libtorrent_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/libtorrent_screen.png -------------------------------------------------------------------------------- /libtorrent/docs/limewire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/limewire.png -------------------------------------------------------------------------------- /libtorrent/docs/lince.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/lince.png -------------------------------------------------------------------------------- /libtorrent/docs/make_thumb.sh: -------------------------------------------------------------------------------- 1 | convert $1 -resize 150x130 $1 2 | 3 | -------------------------------------------------------------------------------- /libtorrent/docs/makefile: -------------------------------------------------------------------------------- 1 | # this makefile assumes that you have docutils and rst2pdf installed 2 | 3 | WEB_PATH = ~/Documents/rasterbar/web/products/libtorrent 4 | 5 | TARGETS = index \ 6 | udp_tracker_protocol \ 7 | dht_rss \ 8 | dht_store \ 9 | client_test \ 10 | manual \ 11 | building \ 12 | features \ 13 | contributing\ 14 | examples \ 15 | extension_protocol \ 16 | make_torrent \ 17 | dht_extensions \ 18 | dht_sec \ 19 | libtorrent_plugins \ 20 | python_binding \ 21 | projects \ 22 | running_tests \ 23 | utp \ 24 | tuning \ 25 | hacking \ 26 | reference \ 27 | reference-Core \ 28 | reference-String \ 29 | reference-Plugins \ 30 | reference-Create_Torrents \ 31 | reference-Error_Codes \ 32 | reference-Time \ 33 | reference-Storage \ 34 | reference-Utility \ 35 | reference-Bencoding \ 36 | reference-Alerts \ 37 | reference-RSS \ 38 | reference-Filter 39 | 40 | FIGURES = read_disk_buffers write_disk_buffers troubleshooting 41 | 42 | html: $(TARGETS:=.html) $(FIGURES:=.png) todo.html 43 | 44 | pdf: $(TARGETS:=.pdf) $(FIGURES:=.eps) 45 | 46 | epub: $(TARGETS:=.epub) $(FIGURES:=.png) 47 | 48 | all: html 49 | 50 | todo.html:gen_todo.py ../src/*.cpp ../include/libtorrent/*.hpp 51 | python gen_todo.py 52 | 53 | reference.rst:gen_reference_doc.py ../include/libtorrent/*.hpp 54 | python gen_reference_doc.py 55 | 56 | %.epub:%.rst 57 | rst2epub $? $@ 58 | 59 | %.pdf:%.rst 60 | rst2pdf $? -o $@ --stylesheets stylesheet 61 | 62 | %.html:%.rst 63 | rst2html-2.6.py --template=template.txt --stylesheet-path=style.css --link-stylesheet --no-toc-backlinks $? > $@ 64 | cp $@ $(WEB_PATH)/$@ 65 | 66 | %.png:%.dot 67 | dot -Tpng $? >$@ 68 | cp $@ $(WEB_PATH)/$@ 69 | 70 | %.eps:%.dot 71 | dot -Teps $? >$@ 72 | cp $@ $(WEB_PATH)/$@ 73 | 74 | clean: 75 | rm -f $(TARGETS:=.html) $(TARGETS:=.pdf) todo.html reference*.html 76 | 77 | -------------------------------------------------------------------------------- /libtorrent/docs/merkle_tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/merkle_tree.png -------------------------------------------------------------------------------- /libtorrent/docs/miro.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/miro.jpg -------------------------------------------------------------------------------- /libtorrent/docs/moopolice_thumb.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/moopolice_thumb.gif -------------------------------------------------------------------------------- /libtorrent/docs/our_delay_base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/our_delay_base.png -------------------------------------------------------------------------------- /libtorrent/docs/our_delay_base_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/our_delay_base_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/pump.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/pump.png -------------------------------------------------------------------------------- /libtorrent/docs/qbittorrent_thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/qbittorrent_thumb.jpg -------------------------------------------------------------------------------- /libtorrent/docs/read_disk_buffers.dot: -------------------------------------------------------------------------------- 1 | digraph uploading { 2 | 3 | node [shape=box]; 4 | 5 | subgraph user_space { 6 | rank=same; 7 | "disk cache" -> "send buffer" [label="copy into peer's send buffer (copy)"] 8 | "send buffer" -> "encrypted send buffer" [label="encrypt in-place (no copy)" style=dashed]; 9 | } 10 | 11 | subgraph kernel { 12 | rank=same; 13 | "kernel page cache"; 14 | "socket kernel buffer" 15 | } 16 | 17 | "encrypted send buffer" -> "socket kernel buffer" [label="write() to socket (copy)"]; 18 | "kernel page cache" -> "disk cache" [label="read() from file (copy)"] 19 | } 20 | 21 | -------------------------------------------------------------------------------- /libtorrent/docs/read_disk_buffers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/read_disk_buffers.png -------------------------------------------------------------------------------- /libtorrent/docs/session_stats_peers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/session_stats_peers.png -------------------------------------------------------------------------------- /libtorrent/docs/storage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/storage.png -------------------------------------------------------------------------------- /libtorrent/docs/t2e.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/t2e.jpg -------------------------------------------------------------------------------- /libtorrent/docs/template.txt: -------------------------------------------------------------------------------- 1 | %(head_prefix)s 2 | %(head)s 3 | 4 | 5 | 16 | %(stylesheet)s 17 | 22 | %(body_prefix)s 23 |
24 |
25 | 30 |
31 | 35 |
36 | %(body_pre_docinfo)s 37 | %(docinfo)s 38 | %(body)s 39 |
40 | 43 |
44 | 46 | 50 | %(body_suffix)s 51 | -------------------------------------------------------------------------------- /libtorrent/docs/tonidoplug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/tonidoplug.png -------------------------------------------------------------------------------- /libtorrent/docs/troubleshooting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/troubleshooting.png -------------------------------------------------------------------------------- /libtorrent/docs/tvblob.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/tvblob.jpg -------------------------------------------------------------------------------- /libtorrent/docs/tvitty.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/tvitty.jpg -------------------------------------------------------------------------------- /libtorrent/docs/unicode_support.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/unicode_support.png -------------------------------------------------------------------------------- /libtorrent/docs/write_disk_buffers.dot: -------------------------------------------------------------------------------- 1 | digraph downloading { 2 | label="" 3 | node [shape=box]; 4 | 5 | subgraph user_space { 6 | rank=same; 7 | "receive buffer" -> "plain text buffer" [label="decrypt in-place (no copy)" style=dashed]; 8 | "plain text buffer" -> "disk cache" [label="move buffer reference (no copy)" style=dashed] 9 | } 10 | 11 | subgraph kernel { 12 | rank=same; 13 | "socket kernel buffer"; 14 | "kernel page cache" 15 | } 16 | 17 | "socket kernel buffer" -> "receive buffer" [label="read() on socket (copy)"]; 18 | "disk cache" -> "kernel page cache" [label="write() to file (copy)"] 19 | } 20 | 21 | -------------------------------------------------------------------------------- /libtorrent/docs/write_disk_buffers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/write_disk_buffers.png -------------------------------------------------------------------------------- /libtorrent/docs/ziptorrent_thumb.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/ziptorrent_thumb.gif -------------------------------------------------------------------------------- /libtorrent/docs/zyxel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/libtorrent/docs/zyxel.png -------------------------------------------------------------------------------- /libtorrent/examples/Jamfile: -------------------------------------------------------------------------------- 1 | import modules ; 2 | 3 | BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ; 4 | 5 | use-project /torrent : .. ; 6 | 7 | if $(BOOST_ROOT) 8 | { 9 | use-project /boost : $(BOOST_ROOT) ; 10 | } 11 | 12 | project client_test 13 | : requirements 14 | multi /torrent//torrent 15 | : default-build 16 | static 17 | ; 18 | 19 | exe client_test : client_test.cpp ; 20 | 21 | exe simple_client : simple_client.cpp ; 22 | exe dump_torrent : dump_torrent.cpp ; 23 | exe make_torrent : make_torrent.cpp ; 24 | exe connection_tester : connection_tester.cpp ; 25 | exe fragmentation_test : fragmentation_test.cpp ; 26 | exe rss_reader : rss_reader.cpp ; 27 | exe upnp_test : upnp_test.cpp ; 28 | 29 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/invariant_check.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2004. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifndef TORRENT_INVARIANT_ACCESS_HPP_INCLUDED 6 | #define TORRENT_INVARIANT_ACCESS_HPP_INCLUDED 7 | 8 | #include "libtorrent/assert.hpp" 9 | 10 | namespace libtorrent 11 | { 12 | 13 | class invariant_access 14 | { 15 | public: 16 | template 17 | static void check_invariant(T const& self) 18 | { 19 | self.check_invariant(); 20 | } 21 | }; 22 | 23 | template 24 | void check_invariant(T const& x) 25 | { 26 | invariant_access::check_invariant(x); 27 | } 28 | 29 | struct invariant_checker {}; 30 | 31 | template 32 | struct invariant_checker_impl : invariant_checker 33 | { 34 | invariant_checker_impl(T const& self_) 35 | : self(self_) 36 | { 37 | try 38 | { 39 | check_invariant(self); 40 | } 41 | catch (...) 42 | { 43 | TORRENT_ASSERT(false); 44 | } 45 | } 46 | 47 | ~invariant_checker_impl() 48 | { 49 | try 50 | { 51 | check_invariant(self); 52 | } 53 | catch (...) 54 | { 55 | TORRENT_ASSERT(false); 56 | } 57 | } 58 | 59 | T const& self; 60 | }; 61 | 62 | template 63 | invariant_checker_impl make_invariant_checker(T const& x) 64 | { 65 | return invariant_checker_impl(x); 66 | } 67 | } 68 | 69 | #if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS 70 | #define INVARIANT_CHECK \ 71 | invariant_checker const& _invariant_check = make_invariant_checker(*this); \ 72 | (void)_invariant_check; \ 73 | do {} while (false) 74 | #else 75 | #define INVARIANT_CHECK do {} while (false) 76 | #endif 77 | 78 | #endif // TORRENT_INVARIANT_ACCESS_HPP_INCLUDED 79 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/puff.hpp: -------------------------------------------------------------------------------- 1 | /* puff.h 2 | Copyright (C) 2002, 2003 Mark Adler, all rights reserved 3 | version 1.7, 3 Mar 2002 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the author be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | Mark Adler madler@alumni.caltech.edu 22 | */ 23 | 24 | 25 | /* 26 | * See puff.c for purpose and usage. 27 | */ 28 | #include 29 | 30 | int puff(unsigned char *dest, /* pointer to destination pointer */ 31 | boost::uint32_t *destlen, /* amount of output space */ 32 | unsigned char *source, /* pointer to source data pointer */ 33 | boost::uint32_t *sourcelen); /* amount of input available */ 34 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/random.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2011-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include 34 | 35 | namespace libtorrent 36 | { 37 | void random_seed(boost::uint32_t v); 38 | boost::uint32_t random(); 39 | } 40 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/socket_type_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_SOCKET_TYPE_FWD_HPP 34 | #define TORRENT_SOCKET_TYPE_FWD_HPP 35 | 36 | namespace libtorrent 37 | { 38 | struct socket_type; 39 | } 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /libtorrent/libtorrent-rasterbar-cmake.pc.in: -------------------------------------------------------------------------------- 1 | Name: libtorrent-rasterbar 2 | Description: Bittorrent library. 3 | Version: @VERSION@ 4 | Libs: -L${CMAKE_INSTALL_PREFIX}/lib -ltorrent-rasterbar 5 | Cflags: -I${CMAKE_INSTALL_PREFIX}/include -I${CMAKE_INSTALL_PREFIX}/include/libtorrent @COMPILETIME_OPTIONS@ @CXX_DEFINES@ 6 | 7 | -------------------------------------------------------------------------------- /libtorrent/libtorrent-rasterbar.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | bindir=@bindir@ 4 | libdir=@libdir@ 5 | datarootdir=@datarootdir@ 6 | datadir=@datadir@ 7 | sysconfdir=@sysconfdir@ 8 | includedir=@includedir@ 9 | package=@PACKAGE@ 10 | 11 | Name: libtorrent-rasterbar 12 | Description: Bittorrent library. 13 | Version: @VERSION@ 14 | Libs: -L${libdir} -ltorrent-rasterbar 15 | Libs.private: @LIBS@ @BOOST_SYSTEM_LIB@ @PTHREAD_LIBS@ @OPENSSL_LIBS@ 16 | Cflags: -I${includedir} -I${includedir}/libtorrent @COMPILETIME_OPTIONS@ 17 | -------------------------------------------------------------------------------- /libtorrent/list_files.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # Copyright Arvid Norberg 2008. Use, modification and distribution is 3 | # subject to the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | import os 7 | import sys 8 | 9 | def list_directory(path): 10 | tree = os.walk(path) 11 | for i in tree: 12 | dirs = i[0].split('/') 13 | if 'CVS' in dirs: continue 14 | if '.svn' in dirs: continue 15 | 16 | for file in i[2]: 17 | if file.startswith('.#'): continue 18 | if file == '.DS_Store': continue 19 | print os.path.join(i[0], file) + ' \\' 20 | 21 | list_directory(sys.argv[1]) 22 | 23 | -------------------------------------------------------------------------------- /libtorrent/runme-android.sh: -------------------------------------------------------------------------------- 1 | export PATH=$HOME/android/android-ndk-r8b/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/:$PATH 2 | export NDK=$HOME/android/android-ndk-r8b 3 | export NDK_BASE=$NDK 4 | export SYSROOT=$NDK/platforms/android-9/arch-arm 5 | export BOOSTDIR=$HOME/android/Boost-for-Android/build/ 6 | 7 | if [ $1 == "configure" ]; then 8 | if [ ! -f configure ]; then 9 | ./bootstrap.sh 10 | fi 11 | ./configure --host=arm-linux-androideabi --enable-shared=no --enable-static=yes \ 12 | --enable-debug \ 13 | CPPFLAGS="-I$SYSROOT/usr/include/ -I$BOOSTDIR/include \ 14 | -I$NDK_BASE/sources/cxx-stl/gnu-libstdc++/4.6/include \ 15 | -I$NDK_BASE/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include \ 16 | -fexceptions -frtti -DANDROID" \ 17 | LDFLAGS="-Wl,-rpath-link=$SYSROOT/usr/lib/ -L$SYSROOT/usr/lib/ -L$BOOSTDIR/lib \ 18 | $BOOSTDIR/lib/libboost_system-gcc-mt-1_49.a $BOOSTDIR/lib/libboost_thread-gcc-mt-1_49.a \ 19 | $NDK_BASE/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_static.a" \ 20 | LIBS="-lc -lssl -lcrypto" CFLAGS="-nostdlib" --prefix="$SYSROOT/usr" \ 21 | --with-boost=$BOOSTDIR --with-boost-libdir=$BOOSTDIR/lib && make -j2 22 | fi 23 | 24 | make -j2 25 | 26 | -------------------------------------------------------------------------------- /libtorrent/sanity-checker.xml: -------------------------------------------------------------------------------- 1 | 2 | 0.16.2 3 | 4 | 5 | 6 | include/libtorrent 7 | 8 | 9 | 10 | include/ 11 | include/libtorrent/ 12 | /Users/arvid/Documents/dev/boost_1_47_0/ 13 | 14 | 15 | 16 | #define BOOST_ALL_NO_LIB 1 17 | #define BOOST_ASIO_DYN_LINK 1 18 | #define BOOST_ASIO_ENABLE_CANCELIO 1 19 | #define BOOST_ASIO_HASH_MAP_BUCKETS 1021 20 | #define BOOST_ASIO_SEPARATE_COMPILATION 1 21 | #define BOOST_ASIO_SOURCE 1 22 | #define BOOST_EXCEPTION_DISABLE 1 23 | #define BOOST_SYSTEM_SOURCE 1 24 | #define BOOST_SYSTEM_STATIC_LINK 1 25 | #define BOOST_THREAD_USE_LIB 1 26 | #define TORRENT_BUILDING_SHARED 1 27 | #define TORRENT_DEBUG 1 28 | #define TORRENT_DISABLE_GEO_IP 1 29 | #define TORRENT_USE_TOMMATH 1 30 | #define UNICODE 1 31 | #define _FILE_OFFSET_BITS 64 32 | #define _UNICODE 1 33 | #define TORRENT_USE_OPENSSL 1 34 | 35 | 36 | 37 | libtorrent::aux 38 | 39 | 40 | 41 | bin/darwin-4.2.1/debug/boost-source/threading-multi/libtorrent.dylib.0.16.1 42 | 43 | -------------------------------------------------------------------------------- /libtorrent/set_version.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | import os 3 | import sys 4 | import glob 5 | 6 | version = (int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4])) 7 | 8 | def substitute_file(name): 9 | subst = '' 10 | f = open(name) 11 | for l in f: 12 | if '#define LIBTORRENT_VERSION_MAJOR' in l and name.endswith('.hpp'): 13 | l = '#define LIBTORRENT_VERSION_MAJOR %d\n' % version[0] 14 | elif '#define LIBTORRENT_VERSION_MINOR' in l and name.endswith('.hpp'): 15 | l = '#define LIBTORRENT_VERSION_MINOR %d\n' % version[1] 16 | elif '#define LIBTORRENT_VERSION_TINY' in l and name.endswith('.hpp'): 17 | l = '#define LIBTORRENT_VERSION_TINY %d\n' % version[2] 18 | elif '#define LIBTORRENT_VERSION ' in l and name.endswith('.hpp'): 19 | l = '#define LIBTORRENT_VERSION "%d.%d.%d.%d"\n' % (version[0], version[1], version[2], version[3]) 20 | elif 'AC_INIT([libtorrent-rasterbar]' in l and name.endswith('.ac'): 21 | l = 'AC_INIT([libtorrent-rasterbar],[%d.%d.%d],[arvid@rasterbar.com],\n' % (version[0], version[1], version[2]) 22 | elif 'set (VERSION ' in l and name.endswith('.txt'): 23 | l = 'set (VERSION "%d.%d.%d")\n' % (version[0], version[1], version[2]) 24 | elif ':Version: ' in l and name.endswith('.rst'): 25 | l = ':Version: %d.%d.%d\n' % (version[0], version[1], version[2]) 26 | elif 'VERSION = ' in l and name.endswith('Jamfile'): 27 | l = 'VERSION = %d.%d.%d ;\n' % (version[0], version[1], version[2]) 28 | 29 | subst += l 30 | 31 | f.close() 32 | open(name, 'w+').write(subst) 33 | 34 | 35 | substitute_file('include/libtorrent/version.hpp') 36 | substitute_file('CMakeLists.txt') 37 | substitute_file('configure.ac') 38 | for i in glob.glob('docs/*.rst'): 39 | substitute_file(i) 40 | substitute_file('Jamfile') 41 | 42 | 43 | -------------------------------------------------------------------------------- /libtorrent/src/asio.cpp: -------------------------------------------------------------------------------- 1 | // builds all boost.asio source as a separate compilation unit 2 | #include 3 | 4 | #ifndef BOOST_ASIO_SOURCE 5 | #define BOOST_ASIO_SOURCE 6 | #endif 7 | 8 | #include "libtorrent/config.hpp" 9 | 10 | #define TORRENT_HAS_ASIO_DECL x ## BOOST_ASIO_DECL 11 | 12 | // only define BOOST_ASIO_DECL if it hasn't already been defined 13 | // or if it has been defined to an empty string 14 | #if TORRENT_HAS_ASIO_DECL == x 15 | #define BOOST_ASIO_DECL BOOST_SYMBOL_EXPORT 16 | #endif 17 | 18 | #if BOOST_VERSION >= 104500 19 | #include 20 | #elif BOOST_VERSION >= 104400 21 | #include 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /libtorrent/src/asio_ssl.cpp: -------------------------------------------------------------------------------- 1 | // builds all boost.asio SSL source as a separate compilation unit 2 | #include 3 | 4 | #ifdef __ANDROID__ 5 | #define OPENSSL_NO_ENGINE 1 6 | #endif 7 | 8 | #if BOOST_VERSION >= 104610 9 | #include 10 | #endif 11 | 12 | -------------------------------------------------------------------------------- /libtorrent/test/compile-dht.sh: -------------------------------------------------------------------------------- 1 | gcc -o test_dht test_dht.cpp -I../include/ -DBOOST_ASIO_SEPARATE_COMPILATION -lboost_system -lssl -lpthread .libs/libtest.a ../src/.libs/libtorrent-rasterbar.a -lrt 2 | -------------------------------------------------------------------------------- /libtorrent/tools/Jamfile: -------------------------------------------------------------------------------- 1 | import modules ; 2 | 3 | BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ; 4 | 5 | use-project /torrent : .. ; 6 | 7 | if $(BOOST_ROOT) 8 | { 9 | use-project /boost : $(BOOST_ROOT) ; 10 | } 11 | 12 | project tools 13 | : requirements 14 | multi /torrent//torrent 15 | : default-build 16 | static 17 | ; 18 | 19 | exe parse_hash_fails : parse_hash_fails.cpp ; 20 | exe parse_request_log : parse_request_log.cpp ; 21 | 22 | -------------------------------------------------------------------------------- /libtorrent/tools/Makefile.am: -------------------------------------------------------------------------------- 1 | tool_programs = \ 2 | parse_hash_fails 3 | 4 | if ENABLE_EXAMPLES 5 | bin_PROGRAMS = $(tool_programs) 6 | endif 7 | 8 | EXTRA_PROGRAMS = $(tool_programs) 9 | EXTRA_DIST = Jamfile 10 | 11 | parse_hash_fails_SOURCES = parse_hash_fails.cpp 12 | #client_test_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 13 | 14 | LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 15 | 16 | AM_CPPFLAGS = -ftemplate-depth-50 -I$(top_srcdir)/include @DEBUGFLAGS@ 17 | 18 | AM_LDFLAGS = @BOOST_SYSTEM_LIB@ 19 | #AM_LDFLAGS = $(LDFLAGS) @BOOST_SYSTEM_LIB@ @OPENSSL_LDFLAGS@ @OPENSSL_LIBS@ 20 | #AM_LDFLAGS = @OPENSSL_LDFLAGS@ 21 | -------------------------------------------------------------------------------- /libtorrent/tools/parse_bandwidth_log.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | import os, sys, time 3 | 4 | keys = [['upload rate', 'x1y1', 6], ['history entries', 'x1y2', 10], ['queue', 'x1y2', 4]] 5 | 6 | out = open('bandwidth.gnuplot', 'wb') 7 | print >>out, "set term png size 1200,700" 8 | print >>out, 'set output "bandwidth_manager.png"' 9 | print >>out, 'set xrange [0:*]' 10 | print >>out, 'set xlabel "time (ms)"' 11 | print >>out, 'set ylabel "Rate (B/s)"' 12 | print >>out, 'set ytics 10000' 13 | print >>out, 'set y2label "number"' 14 | print >>out, 'set y2range [0:*]' 15 | #print >>out, "set style data lines" 16 | print >>out, "set key box" 17 | print >>out, 'plot', 18 | for k, a, c in keys: 19 | print >>out, ' "%s" using 1:%d title "%s" axes %s with steps,' % (sys.argv[1], c, k, a), 20 | print >>out, 'x=0' 21 | out.close() 22 | 23 | os.system('gnuplot bandwidth.gnuplot'); 24 | 25 | -------------------------------------------------------------------------------- /libtorrent/tools/parse_dht_rtt.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | import sys 4 | import os 5 | 6 | quantize = 100 7 | max_rtt = 5000 8 | 9 | f = open(sys.argv[1]) 10 | distribution = {} 11 | num_messages = 0 12 | 13 | for i in range(0, max_rtt, quantize): 14 | distribution[i] = 0 15 | 16 | for line in f: 17 | time = int(line.split('\t')[1]) 18 | if (time < 0 or time > max_rtt - quantize): continue 19 | num_messages += 1 20 | time /= quantize 21 | time *= quantize 22 | distribution[time] += 1 23 | 24 | f = open('round_trip_distribution.log', 'w+') 25 | 26 | for k, v in distribution.items(): 27 | print >>f, '%f %d' % ((k + (quantize / 2)) / 1000.0, v) 28 | f.close(); 29 | 30 | f = open('round_trip_distribution.gnuplot', 'w+') 31 | 32 | f.write(''' 33 | set term png size 1200,700 34 | set title "Message round trip times" 35 | set terminal postscript 36 | set ylabel "# of requests" 37 | set xlabel "Round trip time (seconds)" 38 | set grid 39 | set style fill solid border -1 pattern 2 40 | set output "round_trip_distribution.ps" 41 | set boxwidth %f 42 | plot "round_trip_distribution.log" using 1:2 title "requests" with boxes 43 | 44 | set terminal png small 45 | set output "round_trip_distribution.png" 46 | replot 47 | ''' % (float(quantize) / 1000.0)) 48 | f.close() 49 | 50 | os.system('gnuplot round_trip_distribution.gnuplot'); 51 | 52 | -------------------------------------------------------------------------------- /libtorrent/tools/parse_dht_stats.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | import sys 3 | import os 4 | 5 | gnuplot_scripts = [] 6 | 7 | def gen_stats_gnuplot(name, y, lines): 8 | 9 | global gnuplot_scripts 10 | 11 | stat = open(sys.argv[1]) 12 | line = stat.readline() 13 | while not 'minute:' in line: 14 | line = stat.readline() 15 | 16 | names = line.strip().split(':') 17 | counter = 1 18 | for i in names: 19 | print '%d: %s' % (counter, i) 20 | counter += 1 21 | 22 | out = open('%s.gnuplot' % name, 'w+') 23 | out.write(''' 24 | set term png size 1200,700 small 25 | set output "%s.png" 26 | set title "%s" 27 | set ylabel "%s" 28 | set xlabel "time (minutes)" 29 | plot ''' % (name, name.strip('_'), y)) 30 | first = True 31 | for i in lines: 32 | if not first: 33 | out.write(', \\\n') 34 | first = False 35 | out.write('"%s" using 1:%d title "%s" with lines' % (sys.argv[1], names.index(i)+1, i)) 36 | out.write('\n') 37 | 38 | out.write('''set terminal postscript 39 | set output "%s.ps" 40 | replot 41 | ''' % (name)) 42 | out.close() 43 | gnuplot_scripts += [name] 44 | 45 | gen_stats_gnuplot('dht_routing_table_size', 'nodes', ['active nodes','passive nodes']) 46 | gen_stats_gnuplot('dht_tracker_table_size', '', ['num torrents', 'num peers']) 47 | gen_stats_gnuplot('dht_announces', 'messages per minute', ['announces per min', 'failed announces per min']) 48 | gen_stats_gnuplot('dht_clients', 'messages per minute', ['total msgs per min', 'az msgs per min', 'ut msgs per min', 'lt msgs per min', 'mp msgs per min', 'gr msgs per min']) 49 | gen_stats_gnuplot('dht_rate', 'bytes per second', ['bytes in per sec', 'bytes out per sec']) 50 | gen_stats_gnuplot('dht_errors', 'messages per minute', ['error replies sent', 'error queries recvd']) 51 | 52 | for i in gnuplot_scripts: 53 | os.system('gnuplot %s.gnuplot' % i); 54 | -------------------------------------------------------------------------------- /libtorrent/update_copyright.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | import os 3 | import sys 4 | import glob 5 | import datetime 6 | 7 | this_year = datetime.date.today().year 8 | print 'current year: %d' % this_year 9 | 10 | def update_file(name): 11 | subst = '' 12 | f = open(name) 13 | for l in f: 14 | if l.startswith('Copyright (c) '): 15 | first_year = int(l[14:18]) 16 | if first_year != this_year: 17 | if l[18] == '-': 18 | l = l[:19] + str(this_year) + l[23:] 19 | else: 20 | l = l[:18] + '-' + str(this_year) + l[18:] 21 | 22 | subst += l 23 | 24 | f.close() 25 | open(name, 'w+').write(subst) 26 | 27 | for i in glob.glob('src/*.cpp') + glob.glob('include/libtorrent/*.hpp') + \ 28 | glob.glob('include/libtorrent/kademlia/*.hpp') + glob.glob('src/kademlia/*.cpp'): 29 | update_file(i) 30 | 31 | -------------------------------------------------------------------------------- /share/applications/twister-control.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Encoding=UTF-8 4 | Name=twister Control Center 5 | GenericName=twister Control Center 6 | Comment=twister Control Center 7 | Exec=/usr/bin/twister-control --gui 8 | Terminal=false 9 | Icon=/usr/share/pixmaps/twister128.png 10 | Type=Application 11 | Categories=Network;P2P; 12 | -------------------------------------------------------------------------------- /share/applications/twister.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Encoding=UTF-8 4 | Name=twister 5 | GenericName=P2P microblogging 6 | Comment=P2P microblogging 7 | Exec=/usr/bin/twister-control --launch 8 | Terminal=false 9 | Icon=/usr/share/pixmaps/twister128.png 10 | Type=Application 11 | Categories=Network;P2P; 12 | -------------------------------------------------------------------------------- /share/genbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ $# -gt 0 ]; then 4 | FILE="$1" 5 | shift 6 | if [ -f "$FILE" ]; then 7 | INFO="$(head -n 1 "$FILE")" 8 | fi 9 | else 10 | echo "Usage: $0 " 11 | exit 1 12 | fi 13 | 14 | if [ -e "$(which git)" ]; then 15 | # clean 'dirty' status of touched files that haven't been modified 16 | git diff >/dev/null 2>/dev/null 17 | 18 | # get a string like "v0.6.0-66-g59887e8-dirty" 19 | DESC="$(git describe --dirty 2>/dev/null)" 20 | 21 | # get a string like "2012-04-10 16:27:19 +0200" 22 | TIME="$(git log -n 1 --format="%ci")" 23 | fi 24 | 25 | if [ -n "$DESC" ]; then 26 | NEWINFO="#define BUILD_DESC \"$DESC\"" 27 | else 28 | NEWINFO="// No build information available" 29 | fi 30 | 31 | # only update build.h if necessary 32 | if [ "$INFO" != "$NEWINFO" ]; then 33 | echo "$NEWINFO" >"$FILE" 34 | echo "#define BUILD_DATE \"$TIME\"" >>"$FILE" 35 | fi 36 | -------------------------------------------------------------------------------- /share/pixmaps/twister128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/share/pixmaps/twister128.png -------------------------------------------------------------------------------- /share/pixmaps/twister16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/share/pixmaps/twister16.png -------------------------------------------------------------------------------- /share/pixmaps/twister256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/share/pixmaps/twister256.png -------------------------------------------------------------------------------- /share/pixmaps/twister32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/share/pixmaps/twister32.png -------------------------------------------------------------------------------- /share/pixmaps/twister64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/share/pixmaps/twister64.png -------------------------------------------------------------------------------- /share/qt/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIconFile 6 | bitcoin.icns 7 | CFBundlePackageType 8 | APPL 9 | CFBundleGetInfoString 10 | $VERSION, Copyright © 2009-$YEAR The Bitcoin developers 11 | CFBundleShortVersionString 12 | $VERSION 13 | CFBundleVersion 14 | $VERSION 15 | CFBundleSignature 16 | ???? 17 | CFBundleExecutable 18 | Bitcoin-Qt 19 | CFBundleIdentifier 20 | org.bitcoinfoundation.Bitcoin-Qt 21 | CFBundleURLTypes 22 | 23 | 24 | CFBundleTypeRole 25 | Editor 26 | CFBundleURLName 27 | org.bitcoinfoundation.BitcoinPayment 28 | CFBundleURLSchemes 29 | 30 | bitcoin 31 | 32 | 33 | 34 | NSHighResolutionCapable 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /share/qt/clean_mac_info_plist.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Jonas Schnelli, 2013 3 | # make sure the Bitcoin-Qt.app contains the right plist (including the right version) 4 | # fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267) 5 | 6 | from string import Template 7 | from datetime import date 8 | 9 | bitcoinDir = "./"; 10 | 11 | inFile = bitcoinDir+"/share/qt/Info.plist" 12 | outFile = "Bitcoin-Qt.app/Contents/Info.plist" 13 | version = "unknown"; 14 | 15 | fileForGrabbingVersion = bitcoinDir+"bitcoin-qt.pro" 16 | for line in open(fileForGrabbingVersion): 17 | lineArr = line.replace(" ", "").split("="); 18 | if lineArr[0].startswith("VERSION"): 19 | version = lineArr[1].replace("\n", ""); 20 | 21 | fIn = open(inFile, "r") 22 | fileContent = fIn.read() 23 | s = Template(fileContent) 24 | newFileContent = s.substitute(VERSION=version,YEAR=date.today().year) 25 | 26 | fOut = open(outFile, "w"); 27 | fOut.write(newFileContent); 28 | 29 | print "Info.plist fresh created" -------------------------------------------------------------------------------- /share/qt/img/reload.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/share/qt/img/reload.xcf -------------------------------------------------------------------------------- /share/qt/make_spinner.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # W.J. van der Laan, 2011 3 | # Make spinning .mng animation from a .png 4 | # Requires imagemagick 6.7+ 5 | from __future__ import division 6 | from os import path 7 | from PIL import Image 8 | from subprocess import Popen 9 | 10 | SRC='img/reload_scaled.png' 11 | DST='../../src/qt/res/movies/update_spinner.mng' 12 | TMPDIR='/tmp' 13 | TMPNAME='tmp-%03i.png' 14 | NUMFRAMES=35 15 | FRAMERATE=10.0 16 | CONVERT='convert' 17 | CLOCKWISE=True 18 | DSIZE=(16,16) 19 | 20 | im_src = Image.open(SRC) 21 | 22 | if CLOCKWISE: 23 | im_src = im_src.transpose(Image.FLIP_LEFT_RIGHT) 24 | 25 | def frame_to_filename(frame): 26 | return path.join(TMPDIR, TMPNAME % frame) 27 | 28 | frame_files = [] 29 | for frame in xrange(NUMFRAMES): 30 | rotation = (frame + 0.5) / NUMFRAMES * 360.0 31 | if CLOCKWISE: 32 | rotation = -rotation 33 | im_new = im_src.rotate(rotation, Image.BICUBIC) 34 | im_new.thumbnail(DSIZE, Image.ANTIALIAS) 35 | outfile = frame_to_filename(frame) 36 | im_new.save(outfile, 'png') 37 | frame_files.append(outfile) 38 | 39 | p = Popen([CONVERT, "-delay", str(FRAMERATE), "-dispose", "2"] + frame_files + [DST]) 40 | p.communicate() 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /share/qt/make_windows_icon.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # create multiresolution windows icon 3 | ICON_SRC=../../src/qt/res/icons/bitcoin.png 4 | ICON_DST=../../src/qt/res/icons/bitcoin.ico 5 | convert ${ICON_SRC} -resize 16x16 bitcoin-16.png 6 | convert ${ICON_SRC} -resize 32x32 bitcoin-32.png 7 | convert ${ICON_SRC} -resize 48x48 bitcoin-48.png 8 | convert bitcoin-16.png bitcoin-32.png bitcoin-48.png ${ICON_DST} 9 | 10 | -------------------------------------------------------------------------------- /share/ui.rc: -------------------------------------------------------------------------------- 1 | bitcoin ICON "pixmaps/bitcoin.ico" 2 | 3 | #include "wx/msw/wx.rc" 4 | 5 | check ICON "pixmaps/check.ico" 6 | send16 BITMAP "pixmaps/send16.bmp" 7 | send16mask BITMAP "pixmaps/send16mask.bmp" 8 | send16masknoshadow BITMAP "pixmaps/send16masknoshadow.bmp" 9 | send20 BITMAP "pixmaps/send20.bmp" 10 | send20mask BITMAP "pixmaps/send20mask.bmp" 11 | addressbook16 BITMAP "pixmaps/addressbook16.bmp" 12 | addressbook16mask BITMAP "pixmaps/addressbook16mask.bmp" 13 | addressbook20 BITMAP "pixmaps/addressbook20.bmp" 14 | addressbook20mask BITMAP "pixmaps/addressbook20mask.bmp" 15 | favicon ICON "pixmaps/favicon.ico" 16 | -------------------------------------------------------------------------------- /src/checkpoints.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2012 The Bitcoin developers 2 | // Distributed under the MIT/X11 software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | #ifndef BITCOIN_CHECKPOINT_H 5 | #define BITCOIN_CHECKPOINT_H 6 | 7 | #include 8 | 9 | class uint256; 10 | class CBlockIndex; 11 | 12 | /** Block-chain checkpoints are compiled-in sanity checks. 13 | * They are updated every release or three. 14 | */ 15 | namespace Checkpoints 16 | { 17 | // Returns true if block passes checkpoint checks 18 | bool CheckBlock(int nHeight, const uint256& hash); 19 | 20 | // Return conservative estimate of total number of blocks, 0 if unknown 21 | int GetTotalBlocksEstimate(); 22 | 23 | // Returns last CBlockIndex* in mapBlockIndex that is a checkpoint 24 | CBlockIndex* GetLastCheckpoint(const std::map& mapBlockIndex); 25 | 26 | // Returns the height of the highest checkpoint 27 | int GetHighestCheckpoint(); 28 | 29 | double GuessVerificationProgress(CBlockIndex *pindex); 30 | 31 | extern bool fEnabled; 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/clientversion.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENTVERSION_H 2 | #define CLIENTVERSION_H 3 | 4 | // 5 | // client versioning and copyright year 6 | // 7 | 8 | // These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it 9 | #define CLIENT_VERSION_MAJOR 0 10 | #define CLIENT_VERSION_MINOR 9 11 | #define CLIENT_VERSION_REVISION 28 12 | #define CLIENT_VERSION_BUILD 0 13 | 14 | // Set to true for release, false for prerelease or test build 15 | #define CLIENT_VERSION_IS_RELEASE false 16 | 17 | // Copyright year (2009-this) 18 | // Todo: update this when changing our copyright comments in the source 19 | #define COPYRIGHT_YEAR 2013 20 | 21 | // Converts the parameter X to a string after macro replacement on X has been performed. 22 | // Don't merge these into one macro! 23 | #define STRINGIZE(X) DO_STRINGIZE(X) 24 | #define DO_STRINGIZE(X) #X 25 | 26 | #endif // CLIENTVERSION_H 27 | -------------------------------------------------------------------------------- /src/compat.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto 2 | // Copyright (c) 2009-2012 The Bitcoin developers 3 | // Distributed under the MIT/X11 software license, see the accompanying 4 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 5 | #ifndef _BITCOIN_COMPAT_H 6 | #define _BITCOIN_COMPAT_H 1 7 | 8 | #ifdef WIN32 9 | #define _WIN32_WINNT 0x0501 10 | #define WIN32_LEAN_AND_MEAN 1 11 | #ifndef NOMINMAX 12 | #define NOMINMAX 13 | #endif 14 | #define FD_SETSIZE 1024 // max number of fds in fd_set 15 | #include 16 | #include 17 | #include 18 | #else 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #ifndef __ANDROID__ 27 | #include 28 | #endif 29 | #endif 30 | 31 | #ifdef WIN32 32 | #define MSG_NOSIGNAL 0 33 | #define MSG_DONTWAIT 0 34 | typedef int socklen_t; 35 | #else 36 | typedef u_int SOCKET; 37 | #include "errno.h" 38 | #define WSAGetLastError() errno 39 | #define WSAEINVAL EINVAL 40 | #define WSAEALREADY EALREADY 41 | #define WSAEWOULDBLOCK EWOULDBLOCK 42 | #define WSAEMSGSIZE EMSGSIZE 43 | #define WSAEINTR EINTR 44 | #define WSAEINPROGRESS EINPROGRESS 45 | #define WSAEADDRINUSE EADDRINUSE 46 | #define WSAENOTSOCK EBADF 47 | #define INVALID_SOCKET (SOCKET)(~0) 48 | #define SOCKET_ERROR -1 49 | #endif 50 | 51 | inline int myclosesocket(SOCKET& hSocket) 52 | { 53 | if (hSocket == INVALID_SOCKET) 54 | return WSAENOTSOCK; 55 | #ifdef WIN32 56 | int ret = closesocket(hSocket); 57 | #else 58 | int ret = close(hSocket); 59 | #endif 60 | hSocket = INVALID_SOCKET; 61 | return ret; 62 | } 63 | #define closesocket(s) myclosesocket(s) 64 | 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/hash.cpp: -------------------------------------------------------------------------------- 1 | #include "hash.h" 2 | 3 | inline uint32_t ROTL32 ( uint32_t x, int8_t r ) 4 | { 5 | return (x << r) | (x >> (32 - r)); 6 | } 7 | 8 | unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector& vDataToHash) 9 | { 10 | // The following is MurmurHash3 (x86_32), see http://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp 11 | uint32_t h1 = nHashSeed; 12 | const uint32_t c1 = 0xcc9e2d51; 13 | const uint32_t c2 = 0x1b873593; 14 | 15 | const int nblocks = vDataToHash.size() / 4; 16 | 17 | //---------- 18 | // body 19 | const uint32_t * blocks = (const uint32_t *)(&vDataToHash[0] + nblocks*4); 20 | 21 | for(int i = -nblocks; i; i++) 22 | { 23 | uint32_t k1 = blocks[i]; 24 | 25 | k1 *= c1; 26 | k1 = ROTL32(k1,15); 27 | k1 *= c2; 28 | 29 | h1 ^= k1; 30 | h1 = ROTL32(h1,13); 31 | h1 = h1*5+0xe6546b64; 32 | } 33 | 34 | //---------- 35 | // tail 36 | const uint8_t * tail = (const uint8_t*)(&vDataToHash[0] + nblocks*4); 37 | 38 | uint32_t k1 = 0; 39 | 40 | switch(vDataToHash.size() & 3) 41 | { 42 | case 3: k1 ^= tail[2] << 16; 43 | case 2: k1 ^= tail[1] << 8; 44 | case 1: k1 ^= tail[0]; 45 | k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; 46 | }; 47 | 48 | //---------- 49 | // finalization 50 | h1 ^= vDataToHash.size(); 51 | h1 ^= h1 >> 16; 52 | h1 *= 0x85ebca6b; 53 | h1 ^= h1 >> 13; 54 | h1 *= 0xc2b2ae35; 55 | h1 ^= h1 >> 16; 56 | 57 | return h1; 58 | } 59 | -------------------------------------------------------------------------------- /src/init.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto 2 | // Copyright (c) 2009-2012 The Bitcoin developers 3 | // Distributed under the MIT/X11 software license, see the accompanying 4 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 5 | #ifndef BITCOIN_INIT_H 6 | #define BITCOIN_INIT_H 7 | 8 | #include "wallet.h" 9 | 10 | extern CWallet* pwalletMain; 11 | 12 | void StartShutdown(); 13 | bool ShutdownRequested(); 14 | void Shutdown(); 15 | bool AppInit2(boost::thread_group& threadGroup); 16 | std::string HelpMessage(); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/json/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2007 - 2009 John W. Wilkinson 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /src/json/json_spirit.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT 2 | #define JSON_SPIRIT 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include "json_spirit_value.h" 14 | #include "json_spirit_reader.h" 15 | #include "json_spirit_writer.h" 16 | #include "json_spirit_utils.h" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/json/json_spirit_error_position.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT_ERROR_POSITION 2 | #define JSON_SPIRIT_ERROR_POSITION 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include 14 | 15 | namespace json_spirit 16 | { 17 | // An Error_position exception is thrown by the "read_or_throw" functions below on finding an error. 18 | // Note the "read_or_throw" functions are around 3 times slower than the standard functions "read" 19 | // functions that return a bool. 20 | // 21 | struct Error_position 22 | { 23 | Error_position(); 24 | Error_position( unsigned int line, unsigned int column, const std::string& reason ); 25 | bool operator==( const Error_position& lhs ) const; 26 | unsigned int line_; 27 | unsigned int column_; 28 | std::string reason_; 29 | }; 30 | 31 | inline Error_position::Error_position() 32 | : line_( 0 ) 33 | , column_( 0 ) 34 | { 35 | } 36 | 37 | inline Error_position::Error_position( unsigned int line, unsigned int column, const std::string& reason ) 38 | : line_( line ) 39 | , column_( column ) 40 | , reason_( reason ) 41 | { 42 | } 43 | 44 | inline bool Error_position::operator==( const Error_position& lhs ) const 45 | { 46 | if( this == &lhs ) return true; 47 | 48 | return ( reason_ == lhs.reason_ ) && 49 | ( line_ == lhs.line_ ) && 50 | ( column_ == lhs.column_ ); 51 | } 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/json/json_spirit_utils.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT_UTILS 2 | #define JSON_SPIRIT_UTILS 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include "json_spirit_value.h" 14 | #include 15 | 16 | namespace json_spirit 17 | { 18 | template< class Obj_t, class Map_t > 19 | void obj_to_map( const Obj_t& obj, Map_t& mp_obj ) 20 | { 21 | mp_obj.clear(); 22 | 23 | for( typename Obj_t::const_iterator i = obj.begin(); i != obj.end(); ++i ) 24 | { 25 | mp_obj[ i->name_ ] = i->value_; 26 | } 27 | } 28 | 29 | template< class Obj_t, class Map_t > 30 | void map_to_obj( const Map_t& mp_obj, Obj_t& obj ) 31 | { 32 | obj.clear(); 33 | 34 | for( typename Map_t::const_iterator i = mp_obj.begin(); i != mp_obj.end(); ++i ) 35 | { 36 | obj.push_back( typename Obj_t::value_type( i->first, i->second ) ); 37 | } 38 | } 39 | 40 | typedef std::map< std::string, Value > Mapped_obj; 41 | 42 | #ifndef BOOST_NO_STD_WSTRING 43 | typedef std::map< std::wstring, wValue > wMapped_obj; 44 | #endif 45 | 46 | template< class Object_type, class String_type > 47 | const typename Object_type::value_type::Value_type& find_value( const Object_type& obj, const String_type& name ) 48 | { 49 | for( typename Object_type::const_iterator i = obj.begin(); i != obj.end(); ++i ) 50 | { 51 | if( i->name_ == name ) 52 | { 53 | return i->value_; 54 | } 55 | } 56 | 57 | return Object_type::value_type::Value_type::null; 58 | } 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/json/json_spirit_value.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 John W Wilkinson 2 | 3 | This source code can be used for any purpose as long as 4 | this comment is retained. */ 5 | 6 | // json spirit version 2.00 7 | 8 | #include "json_spirit_value.h" 9 | -------------------------------------------------------------------------------- /src/json/json_spirit_writer.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT_WRITER 2 | #define JSON_SPIRIT_WRITER 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include "json_spirit_value.h" 14 | #include 15 | 16 | namespace json_spirit 17 | { 18 | // functions to convert JSON Values to text, 19 | // the "formatted" versions add whitespace to format the output nicely 20 | 21 | void write ( const Value& value, std::ostream& os ); 22 | void write_formatted( const Value& value, std::ostream& os ); 23 | std::string write ( const Value& value ); 24 | std::string write_formatted( const Value& value ); 25 | 26 | #ifndef BOOST_NO_STD_WSTRING 27 | 28 | void write ( const wValue& value, std::wostream& os ); 29 | void write_formatted( const wValue& value, std::wostream& os ); 30 | std::wstring write ( const wValue& value ); 31 | std::wstring write_formatted( const wValue& value ); 32 | 33 | #endif 34 | 35 | void write ( const mValue& value, std::ostream& os ); 36 | void write_formatted( const mValue& value, std::ostream& os ); 37 | std::string write ( const mValue& value ); 38 | std::string write_formatted( const mValue& value ); 39 | 40 | #ifndef BOOST_NO_STD_WSTRING 41 | 42 | void write ( const wmValue& value, std::wostream& os ); 43 | void write_formatted( const wmValue& value, std::wostream& os ); 44 | std::wstring write ( const wmValue& value ); 45 | std::wstring write_formatted( const wmValue& value ); 46 | 47 | #endif 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/leveldb/.gitignore: -------------------------------------------------------------------------------- 1 | build_config.mk 2 | *.a 3 | *.o 4 | *.dylib* 5 | *.so 6 | *.so.* 7 | *_test 8 | db_bench 9 | Release 10 | Debug 11 | Benchmark 12 | vs2010.* 13 | -------------------------------------------------------------------------------- /src/leveldb/AUTHORS: -------------------------------------------------------------------------------- 1 | # Names should be added to this file like so: 2 | # Name or Organization 3 | 4 | Google Inc. 5 | 6 | # Initial version authors: 7 | Jeffrey Dean 8 | Sanjay Ghemawat 9 | -------------------------------------------------------------------------------- /src/leveldb/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /src/leveldb/NEWS: -------------------------------------------------------------------------------- 1 | Release 1.2 2011-05-16 2 | ---------------------- 3 | 4 | Fixes for larger databases (tested up to one billion 100-byte entries, 5 | i.e., ~100GB). 6 | 7 | (1) Place hard limit on number of level-0 files. This fixes errors 8 | of the form "too many open files". 9 | 10 | (2) Fixed memtable management. Before the fix, a heavy write burst 11 | could cause unbounded memory usage. 12 | 13 | A fix for a logging bug where the reader would incorrectly complain 14 | about corruption. 15 | 16 | Allow public access to WriteBatch contents so that users can easily 17 | wrap a DB. 18 | -------------------------------------------------------------------------------- /src/leveldb/TODO: -------------------------------------------------------------------------------- 1 | ss 2 | - Stats 3 | 4 | db 5 | - Maybe implement DB::BulkDeleteForRange(start_key, end_key) 6 | that would blow away files whose ranges are entirely contained 7 | within [start_key..end_key]? For Chrome, deletion of obsolete 8 | object stores, etc. can be done in the background anyway, so 9 | probably not that important. 10 | - There have been requests for MultiGet. 11 | 12 | After a range is completely deleted, what gets rid of the 13 | corresponding files if we do no future changes to that range. Make 14 | the conditions for triggering compactions fire in more situations? 15 | -------------------------------------------------------------------------------- /src/leveldb/WINDOWS.md: -------------------------------------------------------------------------------- 1 | # Building LevelDB On Windows 2 | 3 | ## Prereqs 4 | 5 | Install the [Windows Software Development Kit version 7.1](http://www.microsoft.com/downloads/dlx/en-us/listdetailsview.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b). 6 | 7 | Download and extract the [Snappy source distribution](http://snappy.googlecode.com/files/snappy-1.0.5.tar.gz) 8 | 9 | 1. Open the "Windows SDK 7.1 Command Prompt" : 10 | Start Menu -> "Microsoft Windows SDK v7.1" > "Windows SDK 7.1 Command Prompt" 11 | 2. Change the directory to the leveldb project 12 | 13 | ## Building the Static lib 14 | 15 | * 32 bit Version 16 | 17 | setenv /x86 18 | msbuild.exe /p:Configuration=Release /p:Platform=Win32 /p:Snappy=..\snappy-1.0.5 19 | 20 | * 64 bit Version 21 | 22 | setenv /x64 23 | msbuild.exe /p:Configuration=Release /p:Platform=x64 /p:Snappy=..\snappy-1.0.5 24 | 25 | 26 | ## Building and Running the Benchmark app 27 | 28 | * 32 bit Version 29 | 30 | setenv /x86 31 | msbuild.exe /p:Configuration=Benchmark /p:Platform=Win32 /p:Snappy=..\snappy-1.0.5 32 | Benchmark\leveldb.exe 33 | 34 | * 64 bit Version 35 | 36 | setenv /x64 37 | msbuild.exe /p:Configuration=Benchmark /p:Platform=x64 /p:Snappy=..\snappy-1.0.5 38 | x64\Benchmark\leveldb.exe 39 | 40 | -------------------------------------------------------------------------------- /src/leveldb/db/builder.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_DB_BUILDER_H_ 6 | #define STORAGE_LEVELDB_DB_BUILDER_H_ 7 | 8 | #include "leveldb/status.h" 9 | 10 | namespace leveldb { 11 | 12 | struct Options; 13 | struct FileMetaData; 14 | 15 | class Env; 16 | class Iterator; 17 | class TableCache; 18 | class VersionEdit; 19 | 20 | // Build a Table file from the contents of *iter. The generated file 21 | // will be named according to meta->number. On success, the rest of 22 | // *meta will be filled with metadata about the generated table. 23 | // If no data is present in *iter, meta->file_size will be set to 24 | // zero, and no Table file will be produced. 25 | extern Status BuildTable(const std::string& dbname, 26 | Env* env, 27 | const Options& options, 28 | TableCache* table_cache, 29 | Iterator* iter, 30 | FileMetaData* meta); 31 | 32 | } // namespace leveldb 33 | 34 | #endif // STORAGE_LEVELDB_DB_BUILDER_H_ 35 | -------------------------------------------------------------------------------- /src/leveldb/db/db_iter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_DB_DB_ITER_H_ 6 | #define STORAGE_LEVELDB_DB_DB_ITER_H_ 7 | 8 | #include 9 | #include "leveldb/db.h" 10 | #include "db/dbformat.h" 11 | 12 | namespace leveldb { 13 | 14 | // Return a new iterator that converts internal keys (yielded by 15 | // "*internal_iter") that were live at the specified "sequence" number 16 | // into appropriate user keys. 17 | extern Iterator* NewDBIterator( 18 | const std::string* dbname, 19 | Env* env, 20 | const Comparator* user_key_comparator, 21 | Iterator* internal_iter, 22 | const SequenceNumber& sequence); 23 | 24 | } // namespace leveldb 25 | 26 | #endif // STORAGE_LEVELDB_DB_DB_ITER_H_ 27 | -------------------------------------------------------------------------------- /src/leveldb/db/log_format.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // Log format information shared by reader and writer. 6 | // See ../doc/log_format.txt for more detail. 7 | 8 | #ifndef STORAGE_LEVELDB_DB_LOG_FORMAT_H_ 9 | #define STORAGE_LEVELDB_DB_LOG_FORMAT_H_ 10 | 11 | namespace leveldb { 12 | namespace log { 13 | 14 | enum RecordType { 15 | // Zero is reserved for preallocated files 16 | kZeroType = 0, 17 | 18 | kFullType = 1, 19 | 20 | // For fragments 21 | kFirstType = 2, 22 | kMiddleType = 3, 23 | kLastType = 4 24 | }; 25 | static const int kMaxRecordType = kLastType; 26 | 27 | static const int kBlockSize = 32768; 28 | 29 | // Header is checksum (4 bytes), type (1 byte), length (2 bytes). 30 | static const int kHeaderSize = 4 + 1 + 2; 31 | 32 | } // namespace log 33 | } // namespace leveldb 34 | 35 | #endif // STORAGE_LEVELDB_DB_LOG_FORMAT_H_ 36 | -------------------------------------------------------------------------------- /src/leveldb/db/log_writer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_DB_LOG_WRITER_H_ 6 | #define STORAGE_LEVELDB_DB_LOG_WRITER_H_ 7 | 8 | #include 9 | #include "db/log_format.h" 10 | #include "leveldb/slice.h" 11 | #include "leveldb/status.h" 12 | 13 | namespace leveldb { 14 | 15 | class WritableFile; 16 | 17 | namespace log { 18 | 19 | class Writer { 20 | public: 21 | // Create a writer that will append data to "*dest". 22 | // "*dest" must be initially empty. 23 | // "*dest" must remain live while this Writer is in use. 24 | explicit Writer(WritableFile* dest); 25 | ~Writer(); 26 | 27 | Status AddRecord(const Slice& slice); 28 | 29 | private: 30 | WritableFile* dest_; 31 | int block_offset_; // Current offset in block 32 | 33 | // crc32c values for all supported record types. These are 34 | // pre-computed to reduce the overhead of computing the crc of the 35 | // record type stored in the header. 36 | uint32_t type_crc_[kMaxRecordType + 1]; 37 | 38 | Status EmitPhysicalRecord(RecordType type, const char* ptr, size_t length); 39 | 40 | // No copying allowed 41 | Writer(const Writer&); 42 | void operator=(const Writer&); 43 | }; 44 | 45 | } // namespace log 46 | } // namespace leveldb 47 | 48 | #endif // STORAGE_LEVELDB_DB_LOG_WRITER_H_ 49 | -------------------------------------------------------------------------------- /src/leveldb/db/version_edit_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #include "db/version_edit.h" 6 | #include "util/testharness.h" 7 | 8 | namespace leveldb { 9 | 10 | static void TestEncodeDecode(const VersionEdit& edit) { 11 | std::string encoded, encoded2; 12 | edit.EncodeTo(&encoded); 13 | VersionEdit parsed; 14 | Status s = parsed.DecodeFrom(encoded); 15 | ASSERT_TRUE(s.ok()) << s.ToString(); 16 | parsed.EncodeTo(&encoded2); 17 | ASSERT_EQ(encoded, encoded2); 18 | } 19 | 20 | class VersionEditTest { }; 21 | 22 | TEST(VersionEditTest, EncodeDecode) { 23 | static const uint64_t kBig = 1ull << 50; 24 | 25 | VersionEdit edit; 26 | for (int i = 0; i < 4; i++) { 27 | TestEncodeDecode(edit); 28 | edit.AddFile(3, kBig + 300 + i, kBig + 400 + i, 29 | InternalKey("foo", kBig + 500 + i, kTypeValue), 30 | InternalKey("zoo", kBig + 600 + i, kTypeDeletion)); 31 | edit.DeleteFile(4, kBig + 700 + i); 32 | edit.SetCompactPointer(i, InternalKey("x", kBig + 900 + i, kTypeValue)); 33 | } 34 | 35 | edit.SetComparatorName("foo"); 36 | edit.SetLogNumber(kBig + 100); 37 | edit.SetNextFile(kBig + 200); 38 | edit.SetLastSequence(kBig + 1000); 39 | TestEncodeDecode(edit); 40 | } 41 | 42 | } // namespace leveldb 43 | 44 | int main(int argc, char** argv) { 45 | return leveldb::test::RunAllTests(); 46 | } 47 | -------------------------------------------------------------------------------- /src/leveldb/db/write_batch_internal.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_ 6 | #define STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_ 7 | 8 | #include "leveldb/write_batch.h" 9 | 10 | namespace leveldb { 11 | 12 | class MemTable; 13 | 14 | // WriteBatchInternal provides static methods for manipulating a 15 | // WriteBatch that we don't want in the public WriteBatch interface. 16 | class WriteBatchInternal { 17 | public: 18 | // Return the number of entries in the batch. 19 | static int Count(const WriteBatch* batch); 20 | 21 | // Set the count for the number of entries in the batch. 22 | static void SetCount(WriteBatch* batch, int n); 23 | 24 | // Return the seqeunce number for the start of this batch. 25 | static SequenceNumber Sequence(const WriteBatch* batch); 26 | 27 | // Store the specified number as the seqeunce number for the start of 28 | // this batch. 29 | static void SetSequence(WriteBatch* batch, SequenceNumber seq); 30 | 31 | static Slice Contents(const WriteBatch* batch) { 32 | return Slice(batch->rep_); 33 | } 34 | 35 | static size_t ByteSize(const WriteBatch* batch) { 36 | return batch->rep_.size(); 37 | } 38 | 39 | static void SetContents(WriteBatch* batch, const Slice& contents); 40 | 41 | static Status InsertInto(const WriteBatch* batch, MemTable* memtable); 42 | 43 | static void Append(WriteBatch* dst, const WriteBatch* src); 44 | }; 45 | 46 | } // namespace leveldb 47 | 48 | 49 | #endif // STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_ 50 | -------------------------------------------------------------------------------- /src/leveldb/doc/doc.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin-left: 0.5in; 3 | margin-right: 0.5in; 4 | background: white; 5 | color: black; 6 | } 7 | 8 | h1 { 9 | margin-left: -0.2in; 10 | font-size: 14pt; 11 | } 12 | h2 { 13 | margin-left: -0in; 14 | font-size: 12pt; 15 | } 16 | h3 { 17 | margin-left: -0in; 18 | } 19 | h4 { 20 | margin-left: -0in; 21 | } 22 | hr { 23 | margin-left: -0in; 24 | } 25 | 26 | /* Definition lists: definition term bold */ 27 | dt { 28 | font-weight: bold; 29 | } 30 | 31 | address { 32 | text-align: center; 33 | } 34 | code,samp,var { 35 | color: blue; 36 | } 37 | kbd { 38 | color: #600000; 39 | } 40 | div.note p { 41 | float: right; 42 | width: 3in; 43 | margin-right: 0%; 44 | padding: 1px; 45 | border: 2px solid #6060a0; 46 | background-color: #fffff0; 47 | } 48 | 49 | ul { 50 | margin-top: -0em; 51 | margin-bottom: -0em; 52 | } 53 | 54 | ol { 55 | margin-top: -0em; 56 | margin-bottom: -0em; 57 | } 58 | 59 | UL.nobullets { 60 | list-style-type: none; 61 | list-style-image: none; 62 | margin-left: -1em; 63 | } 64 | 65 | p { 66 | margin: 1em 0 1em 0; 67 | padding: 0 0 0 0; 68 | } 69 | 70 | pre { 71 | line-height: 1.3em; 72 | padding: 0.4em 0 0.8em 0; 73 | margin: 0 0 0 0; 74 | border: 0 0 0 0; 75 | color: blue; 76 | } 77 | 78 | .datatable { 79 | margin-left: auto; 80 | margin-right: auto; 81 | margin-top: 2em; 82 | margin-bottom: 2em; 83 | border: 1px solid; 84 | } 85 | 86 | .datatable td,th { 87 | padding: 0 0.5em 0 0.5em; 88 | text-align: right; 89 | } 90 | -------------------------------------------------------------------------------- /src/leveldb/helpers/memenv/memenv.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_HELPERS_MEMENV_MEMENV_H_ 6 | #define STORAGE_LEVELDB_HELPERS_MEMENV_MEMENV_H_ 7 | 8 | namespace leveldb { 9 | 10 | class Env; 11 | 12 | // Returns a new environment that stores its data in memory and delegates 13 | // all non-file-storage tasks to base_env. The caller must delete the result 14 | // when it is no longer needed. 15 | // *base_env must remain live while the result is in use. 16 | Env* NewMemEnv(Env* base_env); 17 | 18 | } // namespace leveldb 19 | 20 | #endif // STORAGE_LEVELDB_HELPERS_MEMENV_MEMENV_H_ 21 | -------------------------------------------------------------------------------- /src/leveldb/port/README: -------------------------------------------------------------------------------- 1 | This directory contains interfaces and implementations that isolate the 2 | rest of the package from platform details. 3 | 4 | Code in the rest of the package includes "port.h" from this directory. 5 | "port.h" in turn includes a platform specific "port_.h" file 6 | that provides the platform specific implementation. 7 | 8 | See port_posix.h for an example of what must be provided in a platform 9 | specific header file. 10 | 11 | -------------------------------------------------------------------------------- /src/leveldb/port/port.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_PORT_PORT_H_ 6 | #define STORAGE_LEVELDB_PORT_PORT_H_ 7 | 8 | #include 9 | 10 | // Include the appropriate platform specific file below. If you are 11 | // porting to a new platform, see "port_example.h" for documentation 12 | // of what the new port_.h file must provide. 13 | #if defined(LEVELDB_PLATFORM_POSIX) 14 | # include "port/port_posix.h" 15 | #elif defined(LEVELDB_PLATFORM_CHROMIUM) 16 | # include "port/port_chromium.h" 17 | #elif defined(LEVELDB_PLATFORM_WINDOWS) 18 | # include "port/port_win.h" 19 | #endif 20 | 21 | #endif // STORAGE_LEVELDB_PORT_PORT_H_ 22 | -------------------------------------------------------------------------------- /src/leveldb/port/port_posix.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #include "port/port_posix.h" 6 | 7 | #include 8 | #include 9 | #include 10 | #include "util/logging.h" 11 | 12 | namespace leveldb { 13 | namespace port { 14 | 15 | static void PthreadCall(const char* label, int result) { 16 | if (result != 0) { 17 | fprintf(stderr, "pthread %s: %s\n", label, strerror(result)); 18 | abort(); 19 | } 20 | } 21 | 22 | Mutex::Mutex() { PthreadCall("init mutex", pthread_mutex_init(&mu_, NULL)); } 23 | 24 | Mutex::~Mutex() { PthreadCall("destroy mutex", pthread_mutex_destroy(&mu_)); } 25 | 26 | void Mutex::Lock() { PthreadCall("lock", pthread_mutex_lock(&mu_)); } 27 | 28 | void Mutex::Unlock() { PthreadCall("unlock", pthread_mutex_unlock(&mu_)); } 29 | 30 | CondVar::CondVar(Mutex* mu) 31 | : mu_(mu) { 32 | PthreadCall("init cv", pthread_cond_init(&cv_, NULL)); 33 | } 34 | 35 | CondVar::~CondVar() { PthreadCall("destroy cv", pthread_cond_destroy(&cv_)); } 36 | 37 | void CondVar::Wait() { 38 | PthreadCall("wait", pthread_cond_wait(&cv_, &mu_->mu_)); 39 | } 40 | 41 | void CondVar::Signal() { 42 | PthreadCall("signal", pthread_cond_signal(&cv_)); 43 | } 44 | 45 | void CondVar::SignalAll() { 46 | PthreadCall("broadcast", pthread_cond_broadcast(&cv_)); 47 | } 48 | 49 | void InitOnce(OnceType* once, void (*initializer)()) { 50 | PthreadCall("once", pthread_once(once, initializer)); 51 | } 52 | 53 | } // namespace port 54 | } // namespace leveldb 55 | -------------------------------------------------------------------------------- /src/leveldb/port/thread_annotations.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_PORT_THREAD_ANNOTATIONS_H 6 | 7 | // Some environments provide custom macros to aid in static thread-safety 8 | // analysis. Provide empty definitions of such macros unless they are already 9 | // defined. 10 | 11 | #ifndef EXCLUSIVE_LOCKS_REQUIRED 12 | #define EXCLUSIVE_LOCKS_REQUIRED(...) 13 | #endif 14 | 15 | #ifndef SHARED_LOCKS_REQUIRED 16 | #define SHARED_LOCKS_REQUIRED(...) 17 | #endif 18 | 19 | #ifndef LOCKS_EXCLUDED 20 | #define LOCKS_EXCLUDED(...) 21 | #endif 22 | 23 | #ifndef LOCK_RETURNED 24 | #define LOCK_RETURNED(x) 25 | #endif 26 | 27 | #ifndef LOCKABLE 28 | #define LOCKABLE 29 | #endif 30 | 31 | #ifndef SCOPED_LOCKABLE 32 | #define SCOPED_LOCKABLE 33 | #endif 34 | 35 | #ifndef EXCLUSIVE_LOCK_FUNCTION 36 | #define EXCLUSIVE_LOCK_FUNCTION(...) 37 | #endif 38 | 39 | #ifndef SHARED_LOCK_FUNCTION 40 | #define SHARED_LOCK_FUNCTION(...) 41 | #endif 42 | 43 | #ifndef EXCLUSIVE_TRYLOCK_FUNCTION 44 | #define EXCLUSIVE_TRYLOCK_FUNCTION(...) 45 | #endif 46 | 47 | #ifndef SHARED_TRYLOCK_FUNCTION 48 | #define SHARED_TRYLOCK_FUNCTION(...) 49 | #endif 50 | 51 | #ifndef UNLOCK_FUNCTION 52 | #define UNLOCK_FUNCTION(...) 53 | #endif 54 | 55 | #ifndef NO_THREAD_SAFETY_ANALYSIS 56 | #define NO_THREAD_SAFETY_ANALYSIS 57 | #endif 58 | 59 | #endif // STORAGE_LEVELDB_PORT_THREAD_ANNOTATIONS_H 60 | -------------------------------------------------------------------------------- /src/leveldb/port/win/stdint.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | // MSVC didn't ship with this file until the 2010 version. 6 | 7 | #ifndef STORAGE_LEVELDB_PORT_WIN_STDINT_H_ 8 | #define STORAGE_LEVELDB_PORT_WIN_STDINT_H_ 9 | 10 | #if !defined(_MSC_VER) 11 | #error This file should only be included when compiling with MSVC. 12 | #endif 13 | 14 | // Define C99 equivalent types. 15 | typedef signed char int8_t; 16 | typedef signed short int16_t; 17 | typedef signed int int32_t; 18 | typedef signed long long int64_t; 19 | typedef unsigned char uint8_t; 20 | typedef unsigned short uint16_t; 21 | typedef unsigned int uint32_t; 22 | typedef unsigned long long uint64_t; 23 | 24 | #endif // STORAGE_LEVELDB_PORT_WIN_STDINT_H_ 25 | -------------------------------------------------------------------------------- /src/leveldb/table/block.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_TABLE_BLOCK_H_ 6 | #define STORAGE_LEVELDB_TABLE_BLOCK_H_ 7 | 8 | #include 9 | #include 10 | #include "leveldb/iterator.h" 11 | 12 | namespace leveldb { 13 | 14 | struct BlockContents; 15 | class Comparator; 16 | 17 | class Block { 18 | public: 19 | // Initialize the block with the specified contents. 20 | explicit Block(const BlockContents& contents); 21 | 22 | ~Block(); 23 | 24 | size_t size() const { return size_; } 25 | Iterator* NewIterator(const Comparator* comparator); 26 | 27 | private: 28 | uint32_t NumRestarts() const; 29 | 30 | const char* data_; 31 | size_t size_; 32 | uint32_t restart_offset_; // Offset in data_ of restart array 33 | bool owned_; // Block owns data_[] 34 | 35 | // No copying allowed 36 | Block(const Block&); 37 | void operator=(const Block&); 38 | 39 | class Iter; 40 | }; 41 | 42 | } // namespace leveldb 43 | 44 | #endif // STORAGE_LEVELDB_TABLE_BLOCK_H_ 45 | -------------------------------------------------------------------------------- /src/leveldb/table/merger.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_TABLE_MERGER_H_ 6 | #define STORAGE_LEVELDB_TABLE_MERGER_H_ 7 | 8 | namespace leveldb { 9 | 10 | class Comparator; 11 | class Iterator; 12 | 13 | // Return an iterator that provided the union of the data in 14 | // children[0,n-1]. Takes ownership of the child iterators and 15 | // will delete them when the result iterator is deleted. 16 | // 17 | // The result does no duplicate suppression. I.e., if a particular 18 | // key is present in K child iterators, it will be yielded K times. 19 | // 20 | // REQUIRES: n >= 0 21 | extern Iterator* NewMergingIterator( 22 | const Comparator* comparator, Iterator** children, int n); 23 | 24 | } // namespace leveldb 25 | 26 | #endif // STORAGE_LEVELDB_TABLE_MERGER_H_ 27 | -------------------------------------------------------------------------------- /src/leveldb/table/two_level_iterator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_ 6 | #define STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_ 7 | 8 | #include "leveldb/iterator.h" 9 | 10 | namespace leveldb { 11 | 12 | struct ReadOptions; 13 | 14 | // Return a new two level iterator. A two-level iterator contains an 15 | // index iterator whose values point to a sequence of blocks where 16 | // each block is itself a sequence of key,value pairs. The returned 17 | // two-level iterator yields the concatenation of all key/value pairs 18 | // in the sequence of blocks. Takes ownership of "index_iter" and 19 | // will delete it when no longer needed. 20 | // 21 | // Uses a supplied function to convert an index_iter value into 22 | // an iterator over the contents of the corresponding block. 23 | extern Iterator* NewTwoLevelIterator( 24 | Iterator* index_iter, 25 | Iterator* (*block_function)( 26 | void* arg, 27 | const ReadOptions& options, 28 | const Slice& index_value), 29 | void* arg, 30 | const ReadOptions& options); 31 | 32 | } // namespace leveldb 33 | 34 | #endif // STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_ 35 | -------------------------------------------------------------------------------- /src/leveldb/util/crc32c.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_UTIL_CRC32C_H_ 6 | #define STORAGE_LEVELDB_UTIL_CRC32C_H_ 7 | 8 | #include 9 | #include 10 | 11 | namespace leveldb { 12 | namespace crc32c { 13 | 14 | // Return the crc32c of concat(A, data[0,n-1]) where init_crc is the 15 | // crc32c of some string A. Extend() is often used to maintain the 16 | // crc32c of a stream of data. 17 | extern uint32_t Extend(uint32_t init_crc, const char* data, size_t n); 18 | 19 | // Return the crc32c of data[0,n-1] 20 | inline uint32_t Value(const char* data, size_t n) { 21 | return Extend(0, data, n); 22 | } 23 | 24 | static const uint32_t kMaskDelta = 0xa282ead8ul; 25 | 26 | // Return a masked representation of crc. 27 | // 28 | // Motivation: it is problematic to compute the CRC of a string that 29 | // contains embedded CRCs. Therefore we recommend that CRCs stored 30 | // somewhere (e.g., in files) should be masked before being stored. 31 | inline uint32_t Mask(uint32_t crc) { 32 | // Rotate right by 15 bits and add a constant. 33 | return ((crc >> 15) | (crc << 17)) + kMaskDelta; 34 | } 35 | 36 | // Return the crc whose masked representation is masked_crc. 37 | inline uint32_t Unmask(uint32_t masked_crc) { 38 | uint32_t rot = masked_crc - kMaskDelta; 39 | return ((rot >> 17) | (rot << 15)); 40 | } 41 | 42 | } // namespace crc32c 43 | } // namespace leveldb 44 | 45 | #endif // STORAGE_LEVELDB_UTIL_CRC32C_H_ 46 | -------------------------------------------------------------------------------- /src/leveldb/util/filter_policy.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #include "leveldb/filter_policy.h" 6 | 7 | namespace leveldb { 8 | 9 | FilterPolicy::~FilterPolicy() { } 10 | 11 | } // namespace leveldb 12 | -------------------------------------------------------------------------------- /src/leveldb/util/hash.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #include 6 | #include "util/coding.h" 7 | #include "util/hash.h" 8 | 9 | namespace leveldb { 10 | 11 | uint32_t Hash(const char* data, size_t n, uint32_t seed) { 12 | // Similar to murmur hash 13 | const uint32_t m = 0xc6a4a793; 14 | const uint32_t r = 24; 15 | const char* limit = data + n; 16 | uint32_t h = seed ^ (n * m); 17 | 18 | // Pick up four bytes at a time 19 | while (data + 4 <= limit) { 20 | uint32_t w = DecodeFixed32(data); 21 | data += 4; 22 | h += w; 23 | h *= m; 24 | h ^= (h >> 16); 25 | } 26 | 27 | // Pick up remaining bytes 28 | switch (limit - data) { 29 | case 3: 30 | h += data[2] << 16; 31 | // fall through 32 | case 2: 33 | h += data[1] << 8; 34 | // fall through 35 | case 1: 36 | h += data[0]; 37 | h *= m; 38 | h ^= (h >> r); 39 | break; 40 | } 41 | return h; 42 | } 43 | 44 | 45 | } // namespace leveldb 46 | -------------------------------------------------------------------------------- /src/leveldb/util/hash.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // Simple hash function used for internal data structures 6 | 7 | #ifndef STORAGE_LEVELDB_UTIL_HASH_H_ 8 | #define STORAGE_LEVELDB_UTIL_HASH_H_ 9 | 10 | #include 11 | #include 12 | 13 | namespace leveldb { 14 | 15 | extern uint32_t Hash(const char* data, size_t n, uint32_t seed); 16 | 17 | } 18 | 19 | #endif // STORAGE_LEVELDB_UTIL_HASH_H_ 20 | -------------------------------------------------------------------------------- /src/leveldb/util/histogram.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_UTIL_HISTOGRAM_H_ 6 | #define STORAGE_LEVELDB_UTIL_HISTOGRAM_H_ 7 | 8 | #include 9 | 10 | namespace leveldb { 11 | 12 | class Histogram { 13 | public: 14 | Histogram() { } 15 | ~Histogram() { } 16 | 17 | void Clear(); 18 | void Add(double value); 19 | void Merge(const Histogram& other); 20 | 21 | std::string ToString() const; 22 | 23 | private: 24 | double min_; 25 | double max_; 26 | double num_; 27 | double sum_; 28 | double sum_squares_; 29 | 30 | enum { kNumBuckets = 154 }; 31 | static const double kBucketLimit[kNumBuckets]; 32 | double buckets_[kNumBuckets]; 33 | 34 | double Median() const; 35 | double Percentile(double p) const; 36 | double Average() const; 37 | double StandardDeviation() const; 38 | }; 39 | 40 | } // namespace leveldb 41 | 42 | #endif // STORAGE_LEVELDB_UTIL_HISTOGRAM_H_ 43 | -------------------------------------------------------------------------------- /src/leveldb/util/logging.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // Must not be included from any .h files to avoid polluting the namespace 6 | // with macros. 7 | 8 | #ifndef STORAGE_LEVELDB_UTIL_LOGGING_H_ 9 | #define STORAGE_LEVELDB_UTIL_LOGGING_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include "port/port.h" 15 | 16 | namespace leveldb { 17 | 18 | class Slice; 19 | class WritableFile; 20 | 21 | // Append a human-readable printout of "num" to *str 22 | extern void AppendNumberTo(std::string* str, uint64_t num); 23 | 24 | // Append a human-readable printout of "value" to *str. 25 | // Escapes any non-printable characters found in "value". 26 | extern void AppendEscapedStringTo(std::string* str, const Slice& value); 27 | 28 | // Return a human-readable printout of "num" 29 | extern std::string NumberToString(uint64_t num); 30 | 31 | // Return a human-readable version of "value". 32 | // Escapes any non-printable characters found in "value". 33 | extern std::string EscapeString(const Slice& value); 34 | 35 | // If *in starts with "c", advances *in past the first character and 36 | // returns true. Otherwise, returns false. 37 | extern bool ConsumeChar(Slice* in, char c); 38 | 39 | // Parse a human-readable number from "*in" into *value. On success, 40 | // advances "*in" past the consumed number and sets "*val" to the 41 | // numeric value. Otherwise, returns false and leaves *in in an 42 | // unspecified state. 43 | extern bool ConsumeDecimalNumber(Slice* in, uint64_t* val); 44 | 45 | } // namespace leveldb 46 | 47 | #endif // STORAGE_LEVELDB_UTIL_LOGGING_H_ 48 | -------------------------------------------------------------------------------- /src/leveldb/util/mutexlock.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_UTIL_MUTEXLOCK_H_ 6 | #define STORAGE_LEVELDB_UTIL_MUTEXLOCK_H_ 7 | 8 | #include "port/port.h" 9 | #include "port/thread_annotations.h" 10 | 11 | namespace leveldb { 12 | 13 | // Helper class that locks a mutex on construction and unlocks the mutex when 14 | // the destructor of the MutexLock object is invoked. 15 | // 16 | // Typical usage: 17 | // 18 | // void MyClass::MyMethod() { 19 | // MutexLock l(&mu_); // mu_ is an instance variable 20 | // ... some complex code, possibly with multiple return paths ... 21 | // } 22 | 23 | class SCOPED_LOCKABLE MutexLock { 24 | public: 25 | explicit MutexLock(port::Mutex *mu) EXCLUSIVE_LOCK_FUNCTION(mu) 26 | : mu_(mu) { 27 | this->mu_->Lock(); 28 | } 29 | ~MutexLock() UNLOCK_FUNCTION() { this->mu_->Unlock(); } 30 | 31 | private: 32 | port::Mutex *const mu_; 33 | // No copying allowed 34 | MutexLock(const MutexLock&); 35 | void operator=(const MutexLock&); 36 | }; 37 | 38 | } // namespace leveldb 39 | 40 | 41 | #endif // STORAGE_LEVELDB_UTIL_MUTEXLOCK_H_ 42 | -------------------------------------------------------------------------------- /src/leveldb/util/options.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #include "leveldb/options.h" 6 | 7 | #include "leveldb/comparator.h" 8 | #include "leveldb/env.h" 9 | 10 | namespace leveldb { 11 | 12 | Options::Options() 13 | : comparator(BytewiseComparator()), 14 | create_if_missing(false), 15 | error_if_exists(false), 16 | paranoid_checks(false), 17 | env(Env::Default()), 18 | info_log(NULL), 19 | write_buffer_size(4<<20), 20 | max_open_files(1000), 21 | block_cache(NULL), 22 | block_size(4096), 23 | block_restart_interval(16), 24 | compression(kSnappyCompression), 25 | filter_policy(NULL) { 26 | } 27 | 28 | 29 | } // namespace leveldb 30 | -------------------------------------------------------------------------------- /src/leveldb/util/testutil.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #include "util/testutil.h" 6 | 7 | #include "util/random.h" 8 | 9 | namespace leveldb { 10 | namespace test { 11 | 12 | Slice RandomString(Random* rnd, int len, std::string* dst) { 13 | dst->resize(len); 14 | for (int i = 0; i < len; i++) { 15 | (*dst)[i] = static_cast(' ' + rnd->Uniform(95)); // ' ' .. '~' 16 | } 17 | return Slice(*dst); 18 | } 19 | 20 | std::string RandomKey(Random* rnd, int len) { 21 | // Make sure to generate a wide variety of characters so we 22 | // test the boundary conditions for short-key optimizations. 23 | static const char kTestChars[] = { 24 | '\0', '\1', 'a', 'b', 'c', 'd', 'e', '\xfd', '\xfe', '\xff' 25 | }; 26 | std::string result; 27 | for (int i = 0; i < len; i++) { 28 | result += kTestChars[rnd->Uniform(sizeof(kTestChars))]; 29 | } 30 | return result; 31 | } 32 | 33 | 34 | extern Slice CompressibleString(Random* rnd, double compressed_fraction, 35 | int len, std::string* dst) { 36 | int raw = static_cast(len * compressed_fraction); 37 | if (raw < 1) raw = 1; 38 | std::string raw_data; 39 | RandomString(rnd, raw, &raw_data); 40 | 41 | // Duplicate the random data until we have filled "len" bytes 42 | dst->clear(); 43 | while (dst->size() < len) { 44 | dst->append(raw_data); 45 | } 46 | dst->resize(len); 47 | return Slice(*dst); 48 | } 49 | 50 | } // namespace test 51 | } // namespace leveldb 52 | -------------------------------------------------------------------------------- /src/noui.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Satoshi Nakamoto 2 | // Copyright (c) 2009-2012 The Bitcoin developers 3 | // Distributed under the MIT/X11 software license, see the accompanying 4 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 5 | 6 | #include "ui_interface.h" 7 | #include "init.h" 8 | #include "bitcoinrpc.h" 9 | 10 | #include 11 | 12 | static bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style) 13 | { 14 | std::string strCaption; 15 | // Check for usage of predefined caption 16 | switch (style) { 17 | case CClientUIInterface::MSG_ERROR: 18 | strCaption += _("Error"); 19 | break; 20 | case CClientUIInterface::MSG_WARNING: 21 | strCaption += _("Warning"); 22 | break; 23 | case CClientUIInterface::MSG_INFORMATION: 24 | strCaption += _("Information"); 25 | break; 26 | default: 27 | strCaption += caption; // Use supplied caption (can be empty) 28 | } 29 | 30 | printf("%s: %s\n", strCaption.c_str(), message.c_str()); 31 | fprintf(stderr, "%s: %s\n", strCaption.c_str(), message.c_str()); 32 | return false; 33 | } 34 | 35 | static bool noui_ThreadSafeAskFee(int64 /*nFeeRequired*/) 36 | { 37 | return true; 38 | } 39 | 40 | static void noui_InitMessage(const std::string &message) 41 | { 42 | printf("init message: %s\n", message.c_str()); 43 | } 44 | 45 | void noui_connect() 46 | { 47 | // Connect bitcoind signal handlers 48 | uiInterface.ThreadSafeMessageBox.connect(noui_ThreadSafeMessageBox); 49 | uiInterface.ThreadSafeAskFee.connect(noui_ThreadSafeAskFee); 50 | uiInterface.InitMessage.connect(noui_InitMessage); 51 | } 52 | -------------------------------------------------------------------------------- /src/obj-test/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /src/obj/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /src/qt/aboutdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "aboutdialog.h" 2 | #include "ui_aboutdialog.h" 3 | 4 | #include "clientmodel.h" 5 | #include "clientversion.h" 6 | 7 | AboutDialog::AboutDialog(QWidget *parent) : 8 | QDialog(parent), 9 | ui(new Ui::AboutDialog) 10 | { 11 | ui->setupUi(this); 12 | 13 | // Set current copyright year 14 | ui->copyrightLabel->setText(tr("Copyright") + QString(" © 2009-%1 ").arg(COPYRIGHT_YEAR) + tr("The Bitcoin developers")); 15 | } 16 | 17 | void AboutDialog::setModel(ClientModel *model) 18 | { 19 | if(model) 20 | { 21 | ui->versionLabel->setText(model->formatFullVersion()); 22 | } 23 | } 24 | 25 | AboutDialog::~AboutDialog() 26 | { 27 | delete ui; 28 | } 29 | 30 | void AboutDialog::on_buttonBox_accepted() 31 | { 32 | close(); 33 | } 34 | -------------------------------------------------------------------------------- /src/qt/aboutdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef ABOUTDIALOG_H 2 | #define ABOUTDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class AboutDialog; 8 | } 9 | class ClientModel; 10 | 11 | /** "About" dialog box */ 12 | class AboutDialog : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit AboutDialog(QWidget *parent = 0); 18 | ~AboutDialog(); 19 | 20 | void setModel(ClientModel *model); 21 | 22 | private: 23 | Ui::AboutDialog *ui; 24 | 25 | private slots: 26 | void on_buttonBox_accepted(); 27 | }; 28 | 29 | #endif // ABOUTDIALOG_H 30 | -------------------------------------------------------------------------------- /src/qt/askpassphrasedialog.h: -------------------------------------------------------------------------------- 1 | #ifndef ASKPASSPHRASEDIALOG_H 2 | #define ASKPASSPHRASEDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class AskPassphraseDialog; 8 | } 9 | class WalletModel; 10 | 11 | /** Multifunctional dialog to ask for passphrases. Used for encryption, unlocking, and changing the passphrase. 12 | */ 13 | class AskPassphraseDialog : public QDialog 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | enum Mode { 19 | Encrypt, /**< Ask passphrase twice and encrypt */ 20 | Unlock, /**< Ask passphrase and unlock */ 21 | ChangePass, /**< Ask old passphrase + new passphrase twice */ 22 | Decrypt /**< Ask passphrase and decrypt wallet */ 23 | }; 24 | 25 | explicit AskPassphraseDialog(Mode mode, QWidget *parent = 0); 26 | ~AskPassphraseDialog(); 27 | 28 | void accept(); 29 | 30 | void setModel(WalletModel *model); 31 | 32 | private: 33 | Ui::AskPassphraseDialog *ui; 34 | Mode mode; 35 | WalletModel *model; 36 | bool fCapsLock; 37 | 38 | private slots: 39 | void textChanged(); 40 | bool event(QEvent *event); 41 | bool eventFilter(QObject *object, QEvent *event); 42 | }; 43 | 44 | #endif // ASKPASSPHRASEDIALOG_H 45 | -------------------------------------------------------------------------------- /src/qt/bitcoinaddressvalidator.h: -------------------------------------------------------------------------------- 1 | #ifndef BITCOINADDRESSVALIDATOR_H 2 | #define BITCOINADDRESSVALIDATOR_H 3 | 4 | #include 5 | 6 | /** Base48 entry widget validator. 7 | Corrects near-miss characters and refuses characters that are no part of base48. 8 | */ 9 | class BitcoinAddressValidator : public QValidator 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit BitcoinAddressValidator(QObject *parent = 0); 15 | 16 | State validate(QString &input, int &pos) const; 17 | 18 | static const int MaxAddressLength = 35; 19 | }; 20 | 21 | #endif // BITCOINADDRESSVALIDATOR_H 22 | -------------------------------------------------------------------------------- /src/qt/bitcoinamountfield.h: -------------------------------------------------------------------------------- 1 | #ifndef BITCOINAMOUNTFIELD_H 2 | #define BITCOINAMOUNTFIELD_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | class QDoubleSpinBox; 8 | class QValueComboBox; 9 | QT_END_NAMESPACE 10 | 11 | /** Widget for entering bitcoin amounts. 12 | */ 13 | class BitcoinAmountField: public QWidget 14 | { 15 | Q_OBJECT 16 | 17 | Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY textChanged USER true) 18 | 19 | public: 20 | explicit BitcoinAmountField(QWidget *parent = 0); 21 | 22 | qint64 value(bool *valid=0) const; 23 | void setValue(qint64 value); 24 | 25 | /** Mark current value as invalid in UI. */ 26 | void setValid(bool valid); 27 | /** Perform input validation, mark field as invalid if entered value is not valid. */ 28 | bool validate(); 29 | 30 | /** Change unit used to display amount. */ 31 | void setDisplayUnit(int unit); 32 | 33 | /** Make field empty and ready for new input. */ 34 | void clear(); 35 | 36 | /** Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907), 37 | in these cases we have to set it up manually. 38 | */ 39 | QWidget *setupTabChain(QWidget *prev); 40 | 41 | signals: 42 | void textChanged(); 43 | 44 | protected: 45 | /** Intercept focus-in event and ',' key presses */ 46 | bool eventFilter(QObject *object, QEvent *event); 47 | 48 | private: 49 | QDoubleSpinBox *amount; 50 | QValueComboBox *unit; 51 | int currentUnit; 52 | 53 | void setText(const QString &text); 54 | QString text() const; 55 | 56 | private slots: 57 | void unitChanged(int idx); 58 | 59 | }; 60 | 61 | #endif // BITCOINAMOUNTFIELD_H 62 | -------------------------------------------------------------------------------- /src/qt/csvmodelwriter.h: -------------------------------------------------------------------------------- 1 | #ifndef CSVMODELWRITER_H 2 | #define CSVMODELWRITER_H 3 | 4 | #include 5 | #include 6 | 7 | QT_BEGIN_NAMESPACE 8 | class QAbstractItemModel; 9 | QT_END_NAMESPACE 10 | 11 | /** Export a Qt table model to a CSV file. This is useful for analyzing or post-processing the data in 12 | a spreadsheet. 13 | */ 14 | class CSVModelWriter : public QObject 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | explicit CSVModelWriter(const QString &filename, QObject *parent = 0); 20 | 21 | void setModel(const QAbstractItemModel *model); 22 | void addColumn(const QString &title, int column, int role=Qt::EditRole); 23 | 24 | /** Perform export of the model to CSV. 25 | @returns true on success, false otherwise 26 | */ 27 | bool write(); 28 | 29 | private: 30 | QString filename; 31 | const QAbstractItemModel *model; 32 | 33 | struct Column 34 | { 35 | QString title; 36 | int column; 37 | int role; 38 | }; 39 | QList columns; 40 | }; 41 | 42 | #endif // CSVMODELWRITER_H 43 | -------------------------------------------------------------------------------- /src/qt/editaddressdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITADDRESSDIALOG_H 2 | #define EDITADDRESSDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class EditAddressDialog; 8 | } 9 | class AddressTableModel; 10 | 11 | QT_BEGIN_NAMESPACE 12 | class QDataWidgetMapper; 13 | QT_END_NAMESPACE 14 | 15 | /** Dialog for editing an address and associated information. 16 | */ 17 | class EditAddressDialog : public QDialog 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | enum Mode { 23 | NewReceivingAddress, 24 | NewSendingAddress, 25 | EditReceivingAddress, 26 | EditSendingAddress 27 | }; 28 | 29 | explicit EditAddressDialog(Mode mode, QWidget *parent = 0); 30 | ~EditAddressDialog(); 31 | 32 | void setModel(AddressTableModel *model); 33 | void loadRow(int row); 34 | 35 | QString getAddress() const; 36 | void setAddress(const QString &address); 37 | 38 | public slots: 39 | void accept(); 40 | 41 | private: 42 | bool saveCurrentRow(); 43 | 44 | Ui::EditAddressDialog *ui; 45 | QDataWidgetMapper *mapper; 46 | Mode mode; 47 | AddressTableModel *model; 48 | 49 | QString address; 50 | }; 51 | 52 | #endif // EDITADDRESSDIALOG_H 53 | -------------------------------------------------------------------------------- /src/qt/guiconstants.h: -------------------------------------------------------------------------------- 1 | #ifndef GUICONSTANTS_H 2 | #define GUICONSTANTS_H 3 | 4 | /* Milliseconds between model updates */ 5 | static const int MODEL_UPDATE_DELAY = 250; 6 | 7 | /* AskPassphraseDialog -- Maximum passphrase length */ 8 | static const int MAX_PASSPHRASE_SIZE = 1024; 9 | 10 | /* BitcoinGUI -- Size of icons in status bar */ 11 | static const int STATUSBAR_ICONSIZE = 16; 12 | 13 | /* Invalid field background style */ 14 | #define STYLE_INVALID "background:#FF8080" 15 | 16 | /* Transaction list -- unconfirmed transaction */ 17 | #define COLOR_UNCONFIRMED QColor(128, 128, 128) 18 | /* Transaction list -- negative amount */ 19 | #define COLOR_NEGATIVE QColor(255, 0, 0) 20 | /* Transaction list -- bare address (without label) */ 21 | #define COLOR_BAREADDRESS QColor(140, 140, 140) 22 | 23 | /* Tooltips longer than this (in characters) are converted into rich text, 24 | so that they can be word-wrapped. 25 | */ 26 | static const int TOOLTIP_WRAP_THRESHOLD = 80; 27 | 28 | /* Maximum allowed URI length */ 29 | static const int MAX_URI_LENGTH = 255; 30 | 31 | /* QRCodeDialog -- size of exported QR Code image */ 32 | #define EXPORT_IMAGE_SIZE 256 33 | 34 | #endif // GUICONSTANTS_H 35 | -------------------------------------------------------------------------------- /src/qt/macdockiconhandler.h: -------------------------------------------------------------------------------- 1 | #ifndef MACDOCKICONHANDLER_H 2 | #define MACDOCKICONHANDLER_H 3 | 4 | #include 5 | #include 6 | 7 | QT_BEGIN_NAMESPACE 8 | class QMenu; 9 | class QIcon; 10 | class QWidget; 11 | QT_END_NAMESPACE 12 | 13 | #ifdef __OBJC__ 14 | @class DockIconClickEventHandler; 15 | #else 16 | class DockIconClickEventHandler; 17 | #endif 18 | 19 | /** Macintosh-specific dock icon handler. 20 | */ 21 | class MacDockIconHandler : public QObject 22 | { 23 | Q_OBJECT 24 | 25 | public: 26 | ~MacDockIconHandler(); 27 | 28 | QMenu *dockMenu(); 29 | void setIcon(const QIcon &icon); 30 | void setMainWindow(QMainWindow *window); 31 | static MacDockIconHandler *instance(); 32 | 33 | void handleDockIconClickEvent(); 34 | 35 | signals: 36 | void dockIconClicked(); 37 | 38 | private: 39 | MacDockIconHandler(); 40 | 41 | DockIconClickEventHandler *m_dockIconClickEventHandler; 42 | QWidget *m_dummyWidget; 43 | QMenu *m_dockMenu; 44 | QMainWindow *mainWindow; 45 | }; 46 | 47 | #endif // MACDOCKICONCLICKHANDLER_H 48 | -------------------------------------------------------------------------------- /src/qt/macnotificationhandler.h: -------------------------------------------------------------------------------- 1 | #ifndef MACNOTIFICATIONHANDLER_H 2 | #define MACNOTIFICATIONHANDLER_H 3 | #include 4 | 5 | /** Macintosh-specific notification handler (supports UserNotificationCenter and Growl). 6 | */ 7 | class MacNotificationHandler : public QObject 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | /** shows a 10.8+ UserNotification in the UserNotificationCenter 13 | */ 14 | void showNotification(const QString &title, const QString &text); 15 | 16 | /** executes AppleScript */ 17 | void sendAppleScript(const QString &script); 18 | 19 | /** check if OS can handle UserNotifications */ 20 | bool hasUserNotificationCenterSupport(void); 21 | static MacNotificationHandler *instance(); 22 | }; 23 | 24 | 25 | #endif // MACNOTIFICATIONHANDLER_H 26 | -------------------------------------------------------------------------------- /src/qt/monitoreddatamapper.cpp: -------------------------------------------------------------------------------- 1 | #include "monitoreddatamapper.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | MonitoredDataMapper::MonitoredDataMapper(QObject *parent) : 8 | QDataWidgetMapper(parent) 9 | { 10 | } 11 | 12 | void MonitoredDataMapper::addMapping(QWidget *widget, int section) 13 | { 14 | QDataWidgetMapper::addMapping(widget, section); 15 | addChangeMonitor(widget); 16 | } 17 | 18 | void MonitoredDataMapper::addMapping(QWidget *widget, int section, const QByteArray &propertyName) 19 | { 20 | QDataWidgetMapper::addMapping(widget, section, propertyName); 21 | addChangeMonitor(widget); 22 | } 23 | 24 | void MonitoredDataMapper::addChangeMonitor(QWidget *widget) 25 | { 26 | // Watch user property of widget for changes, and connect 27 | // the signal to our viewModified signal. 28 | QMetaProperty prop = widget->metaObject()->userProperty(); 29 | int signal = prop.notifySignalIndex(); 30 | int method = this->metaObject()->indexOfMethod("viewModified()"); 31 | if(signal != -1 && method != -1) 32 | { 33 | QMetaObject::connect(widget, signal, this, method); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/qt/monitoreddatamapper.h: -------------------------------------------------------------------------------- 1 | #ifndef MONITOREDDATAMAPPER_H 2 | #define MONITOREDDATAMAPPER_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | class QWidget; 8 | QT_END_NAMESPACE 9 | 10 | /** Data to Widget mapper that watches for edits and notifies listeners when a field is edited. 11 | This can be used, for example, to enable a commit/apply button in a configuration dialog. 12 | */ 13 | class MonitoredDataMapper : public QDataWidgetMapper 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit MonitoredDataMapper(QObject *parent=0); 19 | 20 | void addMapping(QWidget *widget, int section); 21 | void addMapping(QWidget *widget, int section, const QByteArray &propertyName); 22 | 23 | private: 24 | void addChangeMonitor(QWidget *widget); 25 | 26 | signals: 27 | void viewModified(); 28 | }; 29 | 30 | #endif // MONITOREDDATAMAPPER_H 31 | -------------------------------------------------------------------------------- /src/qt/optionsdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef OPTIONSDIALOG_H 2 | #define OPTIONSDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class OptionsDialog; 8 | } 9 | class OptionsModel; 10 | class MonitoredDataMapper; 11 | class QValidatedLineEdit; 12 | 13 | /** Preferences dialog. */ 14 | class OptionsDialog : public QDialog 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | explicit OptionsDialog(QWidget *parent = 0); 20 | ~OptionsDialog(); 21 | 22 | void setModel(OptionsModel *model); 23 | void setMapper(); 24 | 25 | protected: 26 | bool eventFilter(QObject *object, QEvent *event); 27 | 28 | private slots: 29 | /* enable only apply button */ 30 | void enableApplyButton(); 31 | /* disable only apply button */ 32 | void disableApplyButton(); 33 | /* enable apply button and OK button */ 34 | void enableSaveButtons(); 35 | /* disable apply button and OK button */ 36 | void disableSaveButtons(); 37 | /* set apply button and OK button state (enabled / disabled) */ 38 | void setSaveButtonState(bool fState); 39 | void on_resetButton_clicked(); 40 | void on_okButton_clicked(); 41 | void on_cancelButton_clicked(); 42 | void on_applyButton_clicked(); 43 | 44 | void showRestartWarning_Proxy(); 45 | void showRestartWarning_Lang(); 46 | void updateDisplayUnit(); 47 | void handleProxyIpValid(QValidatedLineEdit *object, bool fState); 48 | 49 | signals: 50 | void proxyIpValid(QValidatedLineEdit *object, bool fValid); 51 | 52 | private: 53 | Ui::OptionsDialog *ui; 54 | OptionsModel *model; 55 | MonitoredDataMapper *mapper; 56 | bool fRestartWarningDisplayed_Proxy; 57 | bool fRestartWarningDisplayed_Lang; 58 | bool fProxyIpValid; 59 | }; 60 | 61 | #endif // OPTIONSDIALOG_H 62 | -------------------------------------------------------------------------------- /src/qt/overviewpage.h: -------------------------------------------------------------------------------- 1 | #ifndef OVERVIEWPAGE_H 2 | #define OVERVIEWPAGE_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class OverviewPage; 8 | } 9 | class ClientModel; 10 | class WalletModel; 11 | class TxViewDelegate; 12 | class TransactionFilterProxy; 13 | 14 | QT_BEGIN_NAMESPACE 15 | class QModelIndex; 16 | QT_END_NAMESPACE 17 | 18 | /** Overview ("home") page widget */ 19 | class OverviewPage : public QWidget 20 | { 21 | Q_OBJECT 22 | 23 | public: 24 | explicit OverviewPage(QWidget *parent = 0); 25 | ~OverviewPage(); 26 | 27 | void setClientModel(ClientModel *clientModel); 28 | void setWalletModel(WalletModel *walletModel); 29 | void showOutOfSyncWarning(bool fShow); 30 | 31 | public slots: 32 | void setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance); 33 | 34 | signals: 35 | void transactionClicked(const QModelIndex &index); 36 | 37 | private: 38 | Ui::OverviewPage *ui; 39 | ClientModel *clientModel; 40 | WalletModel *walletModel; 41 | qint64 currentBalance; 42 | qint64 currentUnconfirmedBalance; 43 | qint64 currentImmatureBalance; 44 | 45 | TxViewDelegate *txdelegate; 46 | TransactionFilterProxy *filter; 47 | 48 | private slots: 49 | void updateDisplayUnit(); 50 | void handleTransactionClicked(const QModelIndex &index); 51 | void updateAlerts(const QString &warnings); 52 | }; 53 | 54 | #endif // OVERVIEWPAGE_H 55 | -------------------------------------------------------------------------------- /src/qt/qrcodedialog.h: -------------------------------------------------------------------------------- 1 | #ifndef QRCODEDIALOG_H 2 | #define QRCODEDIALOG_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui { 8 | class QRCodeDialog; 9 | } 10 | class OptionsModel; 11 | 12 | class QRCodeDialog : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit QRCodeDialog(const QString &addr, const QString &label, bool enableReq, QWidget *parent = 0); 18 | ~QRCodeDialog(); 19 | 20 | void setModel(OptionsModel *model); 21 | 22 | private slots: 23 | void on_lnReqAmount_textChanged(); 24 | void on_lnLabel_textChanged(); 25 | void on_lnMessage_textChanged(); 26 | void on_btnSaveAs_clicked(); 27 | void on_chkReqPayment_toggled(bool fChecked); 28 | 29 | void updateDisplayUnit(); 30 | 31 | private: 32 | Ui::QRCodeDialog *ui; 33 | OptionsModel *model; 34 | QString address; 35 | QImage myImage; 36 | 37 | void genCode(); 38 | QString getURI(); 39 | }; 40 | 41 | #endif // QRCODEDIALOG_H 42 | -------------------------------------------------------------------------------- /src/qt/qvalidatedlineedit.cpp: -------------------------------------------------------------------------------- 1 | #include "qvalidatedlineedit.h" 2 | 3 | #include "guiconstants.h" 4 | 5 | QValidatedLineEdit::QValidatedLineEdit(QWidget *parent) : 6 | QLineEdit(parent), valid(true) 7 | { 8 | connect(this, SIGNAL(textChanged(QString)), this, SLOT(markValid())); 9 | } 10 | 11 | void QValidatedLineEdit::setValid(bool valid) 12 | { 13 | if(valid == this->valid) 14 | { 15 | return; 16 | } 17 | 18 | if(valid) 19 | { 20 | setStyleSheet(""); 21 | } 22 | else 23 | { 24 | setStyleSheet(STYLE_INVALID); 25 | } 26 | this->valid = valid; 27 | } 28 | 29 | void QValidatedLineEdit::focusInEvent(QFocusEvent *evt) 30 | { 31 | // Clear invalid flag on focus 32 | setValid(true); 33 | QLineEdit::focusInEvent(evt); 34 | } 35 | 36 | void QValidatedLineEdit::markValid() 37 | { 38 | setValid(true); 39 | } 40 | 41 | void QValidatedLineEdit::clear() 42 | { 43 | setValid(true); 44 | QLineEdit::clear(); 45 | } 46 | -------------------------------------------------------------------------------- /src/qt/qvalidatedlineedit.h: -------------------------------------------------------------------------------- 1 | #ifndef QVALIDATEDLINEEDIT_H 2 | #define QVALIDATEDLINEEDIT_H 3 | 4 | #include 5 | 6 | /** Line edit that can be marked as "invalid" to show input validation feedback. When marked as invalid, 7 | it will get a red background until it is focused. 8 | */ 9 | class QValidatedLineEdit : public QLineEdit 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit QValidatedLineEdit(QWidget *parent = 0); 15 | void clear(); 16 | 17 | protected: 18 | void focusInEvent(QFocusEvent *evt); 19 | 20 | private: 21 | bool valid; 22 | 23 | public slots: 24 | void setValid(bool valid); 25 | 26 | private slots: 27 | void markValid(); 28 | }; 29 | 30 | #endif // QVALIDATEDLINEEDIT_H 31 | -------------------------------------------------------------------------------- /src/qt/qvaluecombobox.cpp: -------------------------------------------------------------------------------- 1 | #include "qvaluecombobox.h" 2 | 3 | QValueComboBox::QValueComboBox(QWidget *parent) : 4 | QComboBox(parent), role(Qt::UserRole) 5 | { 6 | connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int))); 7 | } 8 | 9 | QVariant QValueComboBox::value() const 10 | { 11 | return itemData(currentIndex(), role); 12 | } 13 | 14 | void QValueComboBox::setValue(const QVariant &value) 15 | { 16 | setCurrentIndex(findData(value, role)); 17 | } 18 | 19 | void QValueComboBox::setRole(int role) 20 | { 21 | this->role = role; 22 | } 23 | 24 | void QValueComboBox::handleSelectionChanged(int idx) 25 | { 26 | emit valueChanged(); 27 | } 28 | -------------------------------------------------------------------------------- /src/qt/qvaluecombobox.h: -------------------------------------------------------------------------------- 1 | #ifndef QVALUECOMBOBOX_H 2 | #define QVALUECOMBOBOX_H 3 | 4 | #include 5 | #include 6 | 7 | /* QComboBox that can be used with QDataWidgetMapper to select ordinal values from a model. */ 8 | class QValueComboBox : public QComboBox 9 | { 10 | Q_OBJECT 11 | 12 | Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged USER true) 13 | 14 | public: 15 | explicit QValueComboBox(QWidget *parent = 0); 16 | 17 | QVariant value() const; 18 | void setValue(const QVariant &value); 19 | 20 | /** Specify model role to use as ordinal value (defaults to Qt::UserRole) */ 21 | void setRole(int role); 22 | 23 | signals: 24 | void valueChanged(); 25 | 26 | private: 27 | int role; 28 | 29 | private slots: 30 | void handleSelectionChanged(int idx); 31 | }; 32 | 33 | #endif // QVALUECOMBOBOX_H 34 | -------------------------------------------------------------------------------- /src/qt/res/icons/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/add.png -------------------------------------------------------------------------------- /src/qt/res/icons/address-book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/address-book.png -------------------------------------------------------------------------------- /src/qt/res/icons/bitcoin.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/bitcoin.icns -------------------------------------------------------------------------------- /src/qt/res/icons/bitcoin.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/bitcoin.ico -------------------------------------------------------------------------------- /src/qt/res/icons/bitcoin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/bitcoin.png -------------------------------------------------------------------------------- /src/qt/res/icons/bitcoin_testnet.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/bitcoin_testnet.ico -------------------------------------------------------------------------------- /src/qt/res/icons/bitcoin_testnet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/bitcoin_testnet.png -------------------------------------------------------------------------------- /src/qt/res/icons/clock1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/clock1.png -------------------------------------------------------------------------------- /src/qt/res/icons/clock2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/clock2.png -------------------------------------------------------------------------------- /src/qt/res/icons/clock3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/clock3.png -------------------------------------------------------------------------------- /src/qt/res/icons/clock4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/clock4.png -------------------------------------------------------------------------------- /src/qt/res/icons/clock5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/clock5.png -------------------------------------------------------------------------------- /src/qt/res/icons/configure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/configure.png -------------------------------------------------------------------------------- /src/qt/res/icons/connect0_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/connect0_16.png -------------------------------------------------------------------------------- /src/qt/res/icons/connect1_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/connect1_16.png -------------------------------------------------------------------------------- /src/qt/res/icons/connect2_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/connect2_16.png -------------------------------------------------------------------------------- /src/qt/res/icons/connect3_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/connect3_16.png -------------------------------------------------------------------------------- /src/qt/res/icons/connect4_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/connect4_16.png -------------------------------------------------------------------------------- /src/qt/res/icons/debugwindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/debugwindow.png -------------------------------------------------------------------------------- /src/qt/res/icons/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/edit.png -------------------------------------------------------------------------------- /src/qt/res/icons/editcopy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/editcopy.png -------------------------------------------------------------------------------- /src/qt/res/icons/editpaste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/editpaste.png -------------------------------------------------------------------------------- /src/qt/res/icons/export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/export.png -------------------------------------------------------------------------------- /src/qt/res/icons/filesave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/filesave.png -------------------------------------------------------------------------------- /src/qt/res/icons/history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/history.png -------------------------------------------------------------------------------- /src/qt/res/icons/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/key.png -------------------------------------------------------------------------------- /src/qt/res/icons/lock_closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/lock_closed.png -------------------------------------------------------------------------------- /src/qt/res/icons/lock_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/lock_open.png -------------------------------------------------------------------------------- /src/qt/res/icons/notsynced.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/notsynced.png -------------------------------------------------------------------------------- /src/qt/res/icons/overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/overview.png -------------------------------------------------------------------------------- /src/qt/res/icons/qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/qrcode.png -------------------------------------------------------------------------------- /src/qt/res/icons/quit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/quit.png -------------------------------------------------------------------------------- /src/qt/res/icons/receive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/receive.png -------------------------------------------------------------------------------- /src/qt/res/icons/remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/remove.png -------------------------------------------------------------------------------- /src/qt/res/icons/send.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/send.png -------------------------------------------------------------------------------- /src/qt/res/icons/synced.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/synced.png -------------------------------------------------------------------------------- /src/qt/res/icons/toolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/toolbar.png -------------------------------------------------------------------------------- /src/qt/res/icons/toolbar_testnet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/toolbar_testnet.png -------------------------------------------------------------------------------- /src/qt/res/icons/transaction0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/transaction0.png -------------------------------------------------------------------------------- /src/qt/res/icons/transaction2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/transaction2.png -------------------------------------------------------------------------------- /src/qt/res/icons/tx_inout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/tx_inout.png -------------------------------------------------------------------------------- /src/qt/res/icons/tx_input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/tx_input.png -------------------------------------------------------------------------------- /src/qt/res/icons/tx_mined.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/tx_mined.png -------------------------------------------------------------------------------- /src/qt/res/icons/tx_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/icons/tx_output.png -------------------------------------------------------------------------------- /src/qt/res/images/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/images/about.png -------------------------------------------------------------------------------- /src/qt/res/images/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/images/splash.png -------------------------------------------------------------------------------- /src/qt/res/images/splash_testnet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/images/splash_testnet.png -------------------------------------------------------------------------------- /src/qt/res/movies/update_spinner.mng: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XX-net/twister-core/02086a0f015425007856e7761f799da23aba6efd/src/qt/res/movies/update_spinner.mng -------------------------------------------------------------------------------- /src/qt/rpcconsole.h: -------------------------------------------------------------------------------- 1 | #ifndef RPCCONSOLE_H 2 | #define RPCCONSOLE_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class RPCConsole; 8 | } 9 | class ClientModel; 10 | 11 | /** Local Bitcoin RPC console. */ 12 | class RPCConsole: public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit RPCConsole(QWidget *parent = 0); 18 | ~RPCConsole(); 19 | 20 | void setClientModel(ClientModel *model); 21 | 22 | enum MessageClass { 23 | MC_ERROR, 24 | MC_DEBUG, 25 | CMD_REQUEST, 26 | CMD_REPLY, 27 | CMD_ERROR 28 | }; 29 | 30 | protected: 31 | virtual bool eventFilter(QObject* obj, QEvent *event); 32 | 33 | private slots: 34 | void on_lineEdit_returnPressed(); 35 | void on_tabWidget_currentChanged(int index); 36 | /** open the debug.log from the current datadir */ 37 | void on_openDebugLogfileButton_clicked(); 38 | /** display messagebox with program parameters (same as bitcoin-qt --help) */ 39 | void on_showCLOptionsButton_clicked(); 40 | 41 | public slots: 42 | void clear(); 43 | void message(int category, const QString &message, bool html = false); 44 | /** Set number of connections shown in the UI */ 45 | void setNumConnections(int count); 46 | /** Set number of blocks shown in the UI */ 47 | void setNumBlocks(int count, int countOfPeers); 48 | /** Go forward or back in history */ 49 | void browseHistory(int offset); 50 | /** Scroll console view to end */ 51 | void scrollToEnd(); 52 | signals: 53 | // For RPC command executor 54 | void stopExecutor(); 55 | void cmdRequest(const QString &command); 56 | 57 | private: 58 | Ui::RPCConsole *ui; 59 | ClientModel *clientModel; 60 | QStringList history; 61 | int historyPtr; 62 | 63 | void startExecutor(); 64 | }; 65 | 66 | #endif // RPCCONSOLE_H 67 | -------------------------------------------------------------------------------- /src/qt/sendcoinsdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef SENDCOINSDIALOG_H 2 | #define SENDCOINSDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class SendCoinsDialog; 8 | } 9 | class WalletModel; 10 | class SendCoinsEntry; 11 | class SendCoinsRecipient; 12 | 13 | QT_BEGIN_NAMESPACE 14 | class QUrl; 15 | QT_END_NAMESPACE 16 | 17 | /** Dialog for sending bitcoins */ 18 | class SendCoinsDialog : public QDialog 19 | { 20 | Q_OBJECT 21 | 22 | public: 23 | explicit SendCoinsDialog(QWidget *parent = 0); 24 | ~SendCoinsDialog(); 25 | 26 | void setModel(WalletModel *model); 27 | 28 | /** Set up the tab chain manually, as Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907). 29 | */ 30 | QWidget *setupTabChain(QWidget *prev); 31 | 32 | void setAddress(const QString &address); 33 | void pasteEntry(const SendCoinsRecipient &rv); 34 | bool handleURI(const QString &uri); 35 | 36 | public slots: 37 | void clear(); 38 | void reject(); 39 | void accept(); 40 | SendCoinsEntry *addEntry(); 41 | void updateRemoveEnabled(); 42 | void setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance); 43 | 44 | private: 45 | Ui::SendCoinsDialog *ui; 46 | WalletModel *model; 47 | bool fNewRecipientAllowed; 48 | 49 | private slots: 50 | void on_sendButton_clicked(); 51 | void removeEntry(SendCoinsEntry* entry); 52 | void updateDisplayUnit(); 53 | }; 54 | 55 | #endif // SENDCOINSDIALOG_H 56 | -------------------------------------------------------------------------------- /src/qt/sendcoinsentry.h: -------------------------------------------------------------------------------- 1 | #ifndef SENDCOINSENTRY_H 2 | #define SENDCOINSENTRY_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class SendCoinsEntry; 8 | } 9 | class WalletModel; 10 | class SendCoinsRecipient; 11 | 12 | /** A single entry in the dialog for sending bitcoins. */ 13 | class SendCoinsEntry : public QFrame 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit SendCoinsEntry(QWidget *parent = 0); 19 | ~SendCoinsEntry(); 20 | 21 | void setModel(WalletModel *model); 22 | bool validate(); 23 | SendCoinsRecipient getValue(); 24 | 25 | /** Return whether the entry is still empty and unedited */ 26 | bool isClear(); 27 | 28 | void setValue(const SendCoinsRecipient &value); 29 | void setAddress(const QString &address); 30 | 31 | /** Set up the tab chain manually, as Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907). 32 | */ 33 | QWidget *setupTabChain(QWidget *prev); 34 | 35 | void setFocus(); 36 | 37 | public slots: 38 | void setRemoveEnabled(bool enabled); 39 | void clear(); 40 | 41 | signals: 42 | void removeEntry(SendCoinsEntry *entry); 43 | 44 | private slots: 45 | void on_deleteButton_clicked(); 46 | void on_payTo_textChanged(const QString &address); 47 | void on_addressBookButton_clicked(); 48 | void on_pasteButton_clicked(); 49 | void updateDisplayUnit(); 50 | 51 | private: 52 | Ui::SendCoinsEntry *ui; 53 | WalletModel *model; 54 | }; 55 | 56 | #endif // SENDCOINSENTRY_H 57 | -------------------------------------------------------------------------------- /src/qt/signverifymessagedialog.h: -------------------------------------------------------------------------------- 1 | #ifndef SIGNVERIFYMESSAGEDIALOG_H 2 | #define SIGNVERIFYMESSAGEDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class SignVerifyMessageDialog; 8 | } 9 | class WalletModel; 10 | 11 | class SignVerifyMessageDialog : public QDialog 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit SignVerifyMessageDialog(QWidget *parent = 0); 17 | ~SignVerifyMessageDialog(); 18 | 19 | void setModel(WalletModel *model); 20 | void setAddress_SM(const QString &address); 21 | void setAddress_VM(const QString &address); 22 | 23 | void showTab_SM(bool fShow); 24 | void showTab_VM(bool fShow); 25 | 26 | protected: 27 | bool eventFilter(QObject *object, QEvent *event); 28 | 29 | private: 30 | Ui::SignVerifyMessageDialog *ui; 31 | WalletModel *model; 32 | 33 | private slots: 34 | /* sign message */ 35 | void on_addressBookButton_SM_clicked(); 36 | void on_pasteButton_SM_clicked(); 37 | void on_signMessageButton_SM_clicked(); 38 | void on_copySignatureButton_SM_clicked(); 39 | void on_clearButton_SM_clicked(); 40 | /* verify message */ 41 | void on_addressBookButton_VM_clicked(); 42 | void on_verifyMessageButton_VM_clicked(); 43 | void on_clearButton_VM_clicked(); 44 | }; 45 | 46 | #endif // SIGNVERIFYMESSAGEDIALOG_H 47 | -------------------------------------------------------------------------------- /src/qt/splashscreen.h: -------------------------------------------------------------------------------- 1 | #ifndef SPLASHSCREEN_H 2 | #define SPLASHSCREEN_H 3 | 4 | #include 5 | 6 | /** class for the splashscreen with information of the running client 7 | */ 8 | class SplashScreen : public QSplashScreen 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit SplashScreen(const QPixmap &pixmap = QPixmap(), Qt::WindowFlags f = 0); 14 | }; 15 | 16 | #endif // SPLASHSCREEN_H 17 | -------------------------------------------------------------------------------- /src/qt/test/test_main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "uritests.h" 5 | 6 | // This is all you need to run all the tests 7 | int main(int argc, char *argv[]) 8 | { 9 | bool fInvalid = false; 10 | 11 | URITests test1; 12 | if (QTest::qExec(&test1) != 0) 13 | fInvalid = true; 14 | 15 | return fInvalid; 16 | } 17 | -------------------------------------------------------------------------------- /src/qt/test/uritests.h: -------------------------------------------------------------------------------- 1 | #ifndef URITESTS_H 2 | #define URITESTS_H 3 | 4 | #include 5 | #include 6 | 7 | class URITests : public QObject 8 | { 9 | Q_OBJECT 10 | 11 | private slots: 12 | void uriTests(); 13 | }; 14 | 15 | #endif // URITESTS_H 16 | -------------------------------------------------------------------------------- /src/qt/transactiondesc.h: -------------------------------------------------------------------------------- 1 | #ifndef TRANSACTIONDESC_H 2 | #define TRANSACTIONDESC_H 3 | 4 | #include 5 | #include 6 | 7 | class CWallet; 8 | class CWalletTx; 9 | 10 | /** Provide a human-readable extended HTML description of a transaction. 11 | */ 12 | class TransactionDesc: public QObject 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | static QString toHTML(CWallet *wallet, CWalletTx &wtx); 18 | 19 | private: 20 | TransactionDesc() {} 21 | 22 | static QString FormatTxStatus(const CWalletTx& wtx); 23 | }; 24 | 25 | #endif // TRANSACTIONDESC_H 26 | -------------------------------------------------------------------------------- /src/qt/transactiondescdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "transactiondescdialog.h" 2 | #include "ui_transactiondescdialog.h" 3 | 4 | #include "transactiontablemodel.h" 5 | 6 | #include 7 | 8 | TransactionDescDialog::TransactionDescDialog(const QModelIndex &idx, QWidget *parent) : 9 | QDialog(parent), 10 | ui(new Ui::TransactionDescDialog) 11 | { 12 | ui->setupUi(this); 13 | QString desc = idx.data(TransactionTableModel::LongDescriptionRole).toString(); 14 | ui->detailText->setHtml(desc); 15 | } 16 | 17 | TransactionDescDialog::~TransactionDescDialog() 18 | { 19 | delete ui; 20 | } 21 | -------------------------------------------------------------------------------- /src/qt/transactiondescdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef TRANSACTIONDESCDIALOG_H 2 | #define TRANSACTIONDESCDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class TransactionDescDialog; 8 | } 9 | 10 | QT_BEGIN_NAMESPACE 11 | class QModelIndex; 12 | QT_END_NAMESPACE 13 | 14 | /** Dialog showing transaction details. */ 15 | class TransactionDescDialog : public QDialog 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | explicit TransactionDescDialog(const QModelIndex &idx, QWidget *parent = 0); 21 | ~TransactionDescDialog(); 22 | 23 | private: 24 | Ui::TransactionDescDialog *ui; 25 | }; 26 | 27 | #endif // TRANSACTIONDESCDIALOG_H 28 | -------------------------------------------------------------------------------- /src/qt/transactionfilterproxy.h: -------------------------------------------------------------------------------- 1 | #ifndef TRANSACTIONFILTERPROXY_H 2 | #define TRANSACTIONFILTERPROXY_H 3 | 4 | #include 5 | #include 6 | 7 | /** Filter the transaction list according to pre-specified rules. */ 8 | class TransactionFilterProxy : public QSortFilterProxyModel 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit TransactionFilterProxy(QObject *parent = 0); 14 | 15 | /** Earliest date that can be represented (far in the past) */ 16 | static const QDateTime MIN_DATE; 17 | /** Last date that can be represented (far in the future) */ 18 | static const QDateTime MAX_DATE; 19 | /** Type filter bit field (all types) */ 20 | static const quint32 ALL_TYPES = 0xFFFFFFFF; 21 | 22 | static quint32 TYPE(int type) { return 1< 4 | #include 5 | static const int SCRYPT_SCRATCHPAD_SIZE = 131072 + 63; 6 | 7 | void scrypt_1024_1_1_256(const char *input, char *output); 8 | void scrypt_1024_1_1_256_sp_generic(const char *input, char *output, char *scratchpad); 9 | 10 | #if defined(USE_SSE2) 11 | extern void scrypt_detect_sse2(unsigned int cpuid_edx); 12 | void scrypt_1024_1_1_256_sp_sse2(const char *input, char *output, char *scratchpad); 13 | extern void (*scrypt_1024_1_1_256_sp)(const char *input, char *output, char *scratchpad); 14 | #endif 15 | 16 | void 17 | PBKDF2_SHA256(const uint8_t *passwd, size_t passwdlen, const uint8_t *salt, 18 | size_t saltlen, uint64_t c, uint8_t *buf, size_t dkLen); 19 | 20 | # ifndef __FreeBSD__ 21 | /* Allready defined in sys/endian.h */ 22 | static inline uint32_t le32dec(const void *pp) 23 | { 24 | const uint8_t *p = (uint8_t const *)pp; 25 | return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) + 26 | ((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24)); 27 | } 28 | 29 | static inline void le32enc(void *pp, uint32_t x) 30 | { 31 | uint8_t *p = (uint8_t *)pp; 32 | p[0] = x & 0xff; 33 | p[1] = (x >> 8) & 0xff; 34 | p[2] = (x >> 16) & 0xff; 35 | p[3] = (x >> 24) & 0xff; 36 | } 37 | # endif 38 | #endif 39 | -------------------------------------------------------------------------------- /src/softcheckpoint.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Miguel Freitas 2 | 3 | #ifndef SOFT_CHECKPOINT_H 4 | #define SOFT_CHECKPOINT_H 5 | 6 | #define SOFT_CHECKPOINT_PERIOD 6 7 | 8 | #include "serialize.h" 9 | #include "net.h" 10 | #include "uint256.h" 11 | 12 | #include 13 | 14 | class CSoftCheckpoint; 15 | 16 | /** Block-chain checkpoints are compiled-in sanity checks. 17 | * They are updated every release or three. 18 | */ 19 | namespace SoftCheckpoints 20 | { 21 | extern bool fEnabled; 22 | 23 | // Returns true if block passes checkpoint checks 24 | bool CheckBlock(int nHeight, const uint256& hash); 25 | 26 | void NewBlockAccepted(); 27 | 28 | // returns true if vote is to be restransmitted 29 | bool CastVoteSoftCheckpoint(int height, const uint256 &hash, const std::string &username, const std::string &sign); 30 | 31 | void RelayCP(const CSoftCheckpoint& cp, CNode* pfrom); 32 | 33 | void RelayLastCPToNode(CNode* pnode); 34 | 35 | bool GetLastCPVotes(int &height, uint256 &hash, std::set &usernames); 36 | } 37 | 38 | class CSoftCheckpoint 39 | { 40 | public: 41 | int nHeight; 42 | uint256 blockHash; 43 | std::vector vchUsername; 44 | std::vector vchSign; 45 | 46 | CSoftCheckpoint() 47 | { 48 | SetNull(); 49 | } 50 | 51 | IMPLEMENT_SERIALIZE 52 | ( 53 | READWRITE(nHeight); 54 | READWRITE(blockHash); 55 | READWRITE(vchUsername); 56 | READWRITE(vchSign); 57 | ) 58 | 59 | void SetNull() 60 | { 61 | nHeight = 0; 62 | blockHash = uint256(); 63 | vchUsername.clear(); 64 | vchSign.clear(); 65 | } 66 | 67 | bool IsNull() const 68 | { 69 | return !nHeight; 70 | } 71 | }; 72 | 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /src/test/Checkpoints_tests.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Unit tests for block-chain checkpoints 3 | // 4 | #include // for 'map_list_of()' 5 | #include 6 | #include 7 | 8 | #include "../checkpoints.h" 9 | #include "../util.h" 10 | 11 | using namespace std; 12 | 13 | BOOST_AUTO_TEST_SUITE(Checkpoints_tests) 14 | 15 | BOOST_AUTO_TEST_CASE(sanity) 16 | { 17 | uint256 p11111 = uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"); 18 | uint256 p134444 = uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"); 19 | BOOST_CHECK(Checkpoints::CheckBlock(11111, p11111)); 20 | BOOST_CHECK(Checkpoints::CheckBlock(134444, p134444)); 21 | 22 | 23 | // Wrong hashes at checkpoints should fail: 24 | BOOST_CHECK(!Checkpoints::CheckBlock(11111, p134444)); 25 | BOOST_CHECK(!Checkpoints::CheckBlock(134444, p11111)); 26 | 27 | // ... but any hash not at a checkpoint should succeed: 28 | BOOST_CHECK(Checkpoints::CheckBlock(11111+1, p134444)); 29 | BOOST_CHECK(Checkpoints::CheckBlock(134444+1, p11111)); 30 | 31 | BOOST_CHECK(Checkpoints::GetTotalBlocksEstimate() >= 134444); 32 | } 33 | 34 | BOOST_AUTO_TEST_SUITE_END() 35 | -------------------------------------------------------------------------------- /src/test/README: -------------------------------------------------------------------------------- 1 | The sources in this directory are unit test cases. Boost includes a 2 | unit testing framework, and since bitcoin already uses boost, it makes 3 | sense to simply use this framework rather than require developers to 4 | configure some other framework (we want as few impediments to creating 5 | unit tests as possible). 6 | 7 | The build system is setup to compile an executable called "test_bitcoin" 8 | that runs all of the unit tests. The main source file is called 9 | test_bitcoin.cpp, which simply includes other files that contain the 10 | actual unit tests (outside of a couple required preprocessor 11 | directives). The pattern is to create one test file for each class or 12 | source file for which you want to create unit tests. The file naming 13 | convention is "_tests.cpp" and such files should wrap 14 | their tests in a test suite called "_tests". For an 15 | examples of this pattern, examine uint160_tests.cpp and 16 | uint256_tests.cpp. 17 | 18 | For further reading, I found the following website to be helpful in 19 | explaining how the boost unit test framework works: 20 | 21 | http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/ 22 | -------------------------------------------------------------------------------- /src/test/base32_tests.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "util.h" 4 | 5 | BOOST_AUTO_TEST_SUITE(base32_tests) 6 | 7 | BOOST_AUTO_TEST_CASE(base32_testvectors) 8 | { 9 | static const std::string vstrIn[] = {"","f","fo","foo","foob","fooba","foobar"}; 10 | static const std::string vstrOut[] = {"","my======","mzxq====","mzxw6===","mzxw6yq=","mzxw6ytb","mzxw6ytboi======"}; 11 | for (unsigned int i=0; i 2 | 3 | #include "main.h" 4 | #include "wallet.h" 5 | #include "util.h" 6 | 7 | BOOST_AUTO_TEST_SUITE(base64_tests) 8 | 9 | BOOST_AUTO_TEST_CASE(base64_testvectors) 10 | { 11 | static const std::string vstrIn[] = {"","f","fo","foo","foob","fooba","foobar"}; 12 | static const std::string vstrOut[] = {"","Zg==","Zm8=","Zm9v","Zm9vYg==","Zm9vYmE=","Zm9vYmFy"}; 13 | for (unsigned int i=0; i 2 | 3 | #include 4 | #include 5 | 6 | #include "serialize.h" 7 | 8 | using namespace std; 9 | 10 | BOOST_AUTO_TEST_SUITE(serialize_tests) 11 | 12 | BOOST_AUTO_TEST_CASE(varints) 13 | { 14 | // encode 15 | 16 | CDataStream ss(SER_DISK, 0); 17 | CDataStream::size_type size = 0; 18 | for (int i = 0; i < 100000; i++) { 19 | ss << VARINT(i); 20 | size += ::GetSerializeSize(VARINT(i), 0, 0); 21 | BOOST_CHECK(size == ss.size()); 22 | } 23 | 24 | for (uint64 i = 0; i < 100000000000ULL; i += 999999937) { 25 | ss << VARINT(i); 26 | size += ::GetSerializeSize(VARINT(i), 0, 0); 27 | BOOST_CHECK(size == ss.size()); 28 | } 29 | 30 | // decode 31 | for (int i = 0; i < 100000; i++) { 32 | int j = -1; 33 | ss >> VARINT(j); 34 | BOOST_CHECK_MESSAGE(i == j, "decoded:" << j << " expected:" << i); 35 | } 36 | 37 | for (uint64 i = 0; i < 100000000000ULL; i += 999999937) { 38 | uint64 j = -1; 39 | ss >> VARINT(j); 40 | BOOST_CHECK_MESSAGE(i == j, "decoded:" << j << " expected:" << i); 41 | } 42 | 43 | } 44 | 45 | BOOST_AUTO_TEST_SUITE_END() 46 | -------------------------------------------------------------------------------- /src/test/sigopcount_tests.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "script.h" 6 | #include "key.h" 7 | 8 | using namespace std; 9 | 10 | // Helpers: 11 | static std::vector 12 | Serialize(const CScript& s) 13 | { 14 | std::vector sSerialized(s); 15 | return sSerialized; 16 | } 17 | 18 | BOOST_AUTO_TEST_SUITE(sigopcount_tests) 19 | 20 | BOOST_AUTO_TEST_CASE(GetSigOpCount) 21 | { 22 | // Test CScript::GetSigOpCount() 23 | CScript s1; 24 | BOOST_CHECK_EQUAL(s1.GetSigOpCount(false), 0U); 25 | BOOST_CHECK_EQUAL(s1.GetSigOpCount(true), 0U); 26 | 27 | uint160 dummy; 28 | s1 << OP_1 << dummy << dummy << OP_2 << OP_CHECKMULTISIG; 29 | BOOST_CHECK_EQUAL(s1.GetSigOpCount(true), 2U); 30 | s1 << OP_IF << OP_CHECKSIG << OP_ENDIF; 31 | BOOST_CHECK_EQUAL(s1.GetSigOpCount(true), 3U); 32 | BOOST_CHECK_EQUAL(s1.GetSigOpCount(false), 21U); 33 | 34 | CScript p2sh; 35 | p2sh.SetDestination(s1.GetID()); 36 | CScript scriptSig; 37 | scriptSig << OP_0 << Serialize(s1); 38 | BOOST_CHECK_EQUAL(p2sh.GetSigOpCount(scriptSig), 3U); 39 | 40 | std::vector keys; 41 | for (int i = 0; i < 3; i++) 42 | { 43 | CKey k; 44 | k.MakeNewKey(true); 45 | keys.push_back(k.GetPubKey()); 46 | } 47 | CScript s2; 48 | s2.SetMultisig(1, keys); 49 | BOOST_CHECK_EQUAL(s2.GetSigOpCount(true), 3U); 50 | BOOST_CHECK_EQUAL(s2.GetSigOpCount(false), 20U); 51 | 52 | p2sh.SetDestination(s2.GetID()); 53 | BOOST_CHECK_EQUAL(p2sh.GetSigOpCount(true), 0U); 54 | BOOST_CHECK_EQUAL(p2sh.GetSigOpCount(false), 0U); 55 | CScript scriptSig2; 56 | scriptSig2 << OP_1 << dummy << dummy << Serialize(s2); 57 | BOOST_CHECK_EQUAL(p2sh.GetSigOpCount(scriptSig2), 3U); 58 | } 59 | 60 | BOOST_AUTO_TEST_SUITE_END() 61 | -------------------------------------------------------------------------------- /src/test/test_bitcoin.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE Bitcoin Test Suite 2 | #include 3 | #include 4 | 5 | #include "db.h" 6 | #include "txdb.h" 7 | #include "main.h" 8 | #include "wallet.h" 9 | #include "util.h" 10 | 11 | CWallet* pwalletMain; 12 | CClientUIInterface uiInterface; 13 | 14 | extern bool fPrintToConsole; 15 | extern void noui_connect(); 16 | 17 | struct TestingSetup { 18 | CCoinsViewDB *pcoinsdbview; 19 | boost::filesystem::path pathTemp; 20 | boost::thread_group threadGroup; 21 | 22 | TestingSetup() { 23 | fPrintToDebugger = true; // don't want to write to debug.log file 24 | noui_connect(); 25 | bitdb.MakeMock(); 26 | pathTemp = GetTempPath() / strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000))); 27 | boost::filesystem::create_directories(pathTemp); 28 | mapArgs["-datadir"] = pathTemp.string(); 29 | pblocktree = new CBlockTreeDB(1 << 20, true); 30 | pcoinsdbview = new CCoinsViewDB(1 << 23, true); 31 | pcoinsTip = new CCoinsViewCache(*pcoinsdbview); 32 | InitBlockIndex(); 33 | bool fFirstRun; 34 | pwalletMain = new CWallet("wallet.dat"); 35 | pwalletMain->LoadWallet(fFirstRun); 36 | RegisterWallet(pwalletMain); 37 | } 38 | ~TestingSetup() 39 | { 40 | threadGroup.interrupt_all(); 41 | threadGroup.join_all(); 42 | delete pwalletMain; 43 | pwalletMain = NULL; 44 | delete pcoinsTip; 45 | delete pcoinsdbview; 46 | delete pblocktree; 47 | bitdb.Flush(true); 48 | boost::filesystem::remove_all(pathTemp); 49 | } 50 | }; 51 | 52 | BOOST_GLOBAL_FIXTURE(TestingSetup); 53 | 54 | void Shutdown(void* parg) 55 | { 56 | exit(0); 57 | } 58 | 59 | void StartShutdown() 60 | { 61 | exit(0); 62 | } 63 | 64 | -------------------------------------------------------------------------------- /src/test/uint160_tests.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "uint256.h" 4 | 5 | BOOST_AUTO_TEST_SUITE(uint160_tests) 6 | 7 | BOOST_AUTO_TEST_CASE(uint160_equality) 8 | { 9 | uint160 num1 = 10; 10 | uint160 num2 = 11; 11 | BOOST_CHECK(num1+1 == num2); 12 | 13 | uint64 num3 = 10; 14 | BOOST_CHECK(num1 == num3); 15 | BOOST_CHECK(num1+num2 == num3+num2); 16 | } 17 | 18 | BOOST_AUTO_TEST_SUITE_END() 19 | -------------------------------------------------------------------------------- /src/test/uint256_tests.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "uint256.h" 4 | 5 | BOOST_AUTO_TEST_SUITE(uint256_tests) 6 | 7 | BOOST_AUTO_TEST_CASE(uint256_equality) 8 | { 9 | uint256 num1 = 10; 10 | uint256 num2 = 11; 11 | BOOST_CHECK(num1+1 == num2); 12 | 13 | uint64 num3 = 10; 14 | BOOST_CHECK(num1 == num3); 15 | BOOST_CHECK(num1+num2 == num3+num2); 16 | } 17 | 18 | BOOST_AUTO_TEST_SUITE_END() 19 | -------------------------------------------------------------------------------- /src/twister_rss.h: -------------------------------------------------------------------------------- 1 | #ifndef TWISTER_RSS_H 2 | #define TWISTER_RSS_H 3 | 4 | #include "json/json_spirit.h" 5 | #include 6 | #include 7 | 8 | enum RSSResultCode 9 | { 10 | RSS_OK = 0, 11 | RSS_ERROR_NO_ACCOUNT = -1, 12 | RSS_ERROR_BAD_ACCOUNT = -2, 13 | RSS_ERROR_NOT_A_NUMBER = -3, 14 | RSS_ERROR_BOOST_REGEX = -4 15 | }; 16 | 17 | extern bool sortByTime (json_spirit::Object i,json_spirit::Object j); 18 | extern void encodeXmlCharacters (std::string& data); 19 | #ifdef HAVE_BOOST_REGEX 20 | extern std::map parseQuery(const std::string& query); 21 | #endif 22 | extern int generateRSS(std::string uri, std::string *output); 23 | 24 | #endif // TWISTER_RSS_H 25 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Bitcoin developers 2 | // Distributed under the MIT/X11 software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | #ifndef BITCOIN_VERSION_H 5 | #define BITCOIN_VERSION_H 6 | 7 | #include "clientversion.h" 8 | #include 9 | 10 | // 11 | // client versioning 12 | // 13 | 14 | static const int CLIENT_VERSION = 15 | 1000000 * CLIENT_VERSION_MAJOR 16 | + 10000 * CLIENT_VERSION_MINOR 17 | + 100 * CLIENT_VERSION_REVISION 18 | + 1 * CLIENT_VERSION_BUILD; 19 | 20 | extern const std::string CLIENT_NAME; 21 | extern const std::string CLIENT_BUILD; 22 | extern const std::string CLIENT_DATE; 23 | 24 | // 25 | // network protocol versioning 26 | // 27 | 28 | static const int PROTOCOL_VERSION = 70003; 29 | 30 | // earlier versions not supported as of Feb 2012, and are disconnected 31 | static const int MIN_PROTO_VERSION = 209; 32 | 33 | // nTime field added to CAddress, starting with this version; 34 | // if possible, avoid requesting addresses nodes older than this 35 | static const int CADDR_TIME_VERSION = 31402; 36 | 37 | // only request blocks from nodes outside this range of versions 38 | static const int NOBLKS_VERSION_START = 32000; 39 | static const int NOBLKS_VERSION_END = 32400; 40 | 41 | // BIP 0031, pong message, is enabled for all versions AFTER this one 42 | static const int BIP0031_VERSION = 60000; 43 | 44 | // soft checkpoint min version 45 | static const int SOFT_CHECKPOINT_VERSION = 70002; 46 | 47 | // dht proxy min version 48 | static const int DHT_PROXY_VERSION = 70003; 49 | 50 | // "mempool" command, enhanced "getdata" behavior starts with this version: 51 | static const int MEMPOOL_GD_VERSION = 60002; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /twister-on-docker: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Build or run a docker image of twister 4 | # 5 | 6 | ACTION=${1:-run} 7 | MODE=${2:---local} 8 | 9 | IMAGE_NAME=twister 10 | REMOTE_IMAGE_NAME=miguelfreitas/twister 11 | 12 | set -e 13 | 14 | shift 15 | 16 | case $ACTION in 17 | 18 | build) 19 | echo Building $IMAGE_NAME 20 | docker build -t $IMAGE_NAME . 21 | ;; 22 | 23 | run) 24 | if [ "$MODE" = "--remote" ]; then 25 | shift 26 | IMAGE_NAME=$REMOTE_IMAGE_NAME 27 | echo Pulling new version of $IMAGE_NAME 28 | docker pull $IMAGE_NAME 29 | fi 30 | echo Running $IMAGE_NAME 31 | docker run -d -p 28332:28332 -v $HOME/.twister:/root/.twister $IMAGE_NAME "$@" 32 | echo "Twister should now be running at http://localhost:28332 (access with \"user\" / \"pwd\")" 33 | ;; 34 | 35 | stop) 36 | CID=$(docker ps | grep twister | awk '{print $1}') 37 | if [ "$CID" ]; then 38 | echo Stopping container $CID 39 | docker stop $CID 40 | docker rm $CID 41 | fi 42 | ;; 43 | 44 | *) 45 | echo Usage: 46 | echo " $0 run [ARGS FOR TWISTERD..]" 47 | echo " Run twister from a local docker build (default)" 48 | echo 49 | echo " $0 run --remote [ARGS FOR TWISTERD..]" 50 | echo " Run twister from the remote docker build at \"$REMOTE_IMAGE_NAME\"" 51 | echo 52 | echo " $0 build" 53 | echo " Build a local docker image for twister" 54 | 55 | exit 2 56 | 57 | esac 58 | --------------------------------------------------------------------------------