├── LICENSE ├── README.md ├── build-fff └── m4 │ ├── ax_boost_base.m4 │ ├── ax_boost_chronof.m4 │ ├── ax_boost_filesystemf.m4 │ ├── ax_boost_program_options.m4 │ ├── ax_boost_system.m4 │ ├── ax_boost_thread.m4 │ ├── ax_boost_unit_test_frameworkf.m4 │ ├── ax_check_compile_flag.m4 │ ├── ax_check_link_flag.m4 │ ├── ax_check_preproc_flagf.m4 │ ├── ax_gcc_func_attributef.m4 │ ├── ax_pthread.m4 │ ├── fffcore_find_bdb48.m4 │ ├── fffcore_qtf.m4 │ └── fffcore_subdir_to_includefff.m4 ├── config └── f.empty ├── configuref.ac ├── core ├── init-coldf.cpp ├── init.h ├── initf.cpp ├── main_test.cpp ├── mainf.cpp └── mainf.h ├── crypto ├── common.h ├── hmac_sha256fff.cpp ├── hmac_sha256fff.h ├── hmac_sha512.h ├── hmac_sha512f.cpp ├── rfc6979_hmac_sha256.cpp ├── rfc6979_hmac_sha256.h ├── ripemd160.cpp ├── ripemd160.h ├── sha1fff.cpp ├── sha1fff.h ├── sha256.cpp ├── sha256.h ├── sha512.cpp └── sha512.h ├── custom ├── custom.cpp ├── custom.h ├── custom_fffcorefff.cpp └── custom_serverf.cpp ├── depends_s ├── builders │ ├── darwinf.mk │ ├── default.mk │ └── linux.mk ├── clang_fix2.py ├── clang_fixfff.config ├── clang_fixfff.py ├── config.guess ├── config.sitefff.in ├── configf.sub ├── f.gitignore ├── funcs.mk ├── hosts │ ├── darwin.mk │ ├── defaultf.mk │ ├── linux.mk │ └── mingw2.mk ├── makefile ├── packages │ ├── bdb.mk │ ├── boost.mk │ ├── dbus.mk │ ├── expat.mk │ ├── fontconfig.mk │ ├── freetype.mk │ ├── libicef.mk │ ├── libsm.mk │ ├── libx11fff.mk │ ├── libxau.mk │ ├── libxcb.mk │ ├── libxextf.mk │ ├── miniupnpcf.mk │ ├── native_ccache.mk │ ├── native_cctoolsfff.mk │ ├── native_cdrkitf.mk │ ├── native_comparisontool.mk │ ├── native_libdmg-hfsplus.mk │ ├── native_libuuid.mk │ ├── native_opensslfff.mk │ ├── native_protobuff.mk │ ├── openssl.mk │ ├── packages.mk │ ├── protobuff.mk │ ├── qrencode.mk │ ├── qt.mk │ ├── qt46.mk │ ├── xcb_protof.mk │ ├── xextprotof.mk │ ├── xprotofff.mk │ └── xtransfff.mk ├── patches │ ├── boost │ │ ├── darwin_boost_atomic-1.patch │ │ └── darwin_boost_atomic-2f.patch │ ├── native_cdrkit │ │ └── cdrkit-deterministic.patch │ ├── qt │ │ ├── fix-xcb-include-order.patch │ │ ├── mac-qmake.conf │ │ └── qt5-tablet-osx.patch │ └── qt46 │ │ └── stlfix.patch ├── readme ├── readme.usage ├── readmefff.packages └── v8_data_lib.py ├── entities ├── assetf.cpp └── assetf.h ├── fffcore-cli-resf.rc ├── fffcore-util-res.rc ├── fffcored-cold-resf.rc ├── fffcored-res.rc ├── filters ├── fffcorefilter.cpp ├── fffcorefilterfff.h ├── filter_cold.cpp ├── filter_win.cpp ├── filtercallback.h ├── filtercallback_cold.cpp ├── filtercallbackfff.cpp ├── filterf.cpp ├── filterf.h ├── ifiltercallbackf.h ├── watchdogf.cpp └── watchdogf.h ├── json ├── json_spirit.h ├── json_spirit_error_position.h ├── json_spirit_reader.cpp ├── json_spirit_reader_template.h ├── json_spirit_readerf.h ├── json_spirit_stream_reader.h ├── json_spirit_ubjson.cpp ├── json_spirit_ubjson.h ├── json_spirit_utils.h ├── json_spirit_valuef.cpp ├── json_spirit_valuef.h ├── json_spirit_writer.h ├── json_spirit_writer_templatef.h ├── json_spirit_writerf.cpp └── licensef.txt ├── keys ├── enckeyf.h ├── keyf.cpp ├── keyf.h ├── pubkey.cpp └── pubkey.h ├── leveldb ├── .gitignore ├── authorsfff ├── build_detect_platform ├── db │ ├── autocompact_test.cc │ ├── builder.h │ ├── builderf.cc │ ├── c.cc │ ├── c_testf.c │ ├── corruption_testf.cc │ ├── db_bench.cc │ ├── db_impl.cc │ ├── db_impl.h │ ├── db_iter.cc │ ├── db_iter.h │ ├── db_test.cc │ ├── dbformat.h │ ├── dbformat_test.cc │ ├── dbformatfff.cc │ ├── dumpfilefff.cc │ ├── filename.h │ ├── filename_testfff.cc │ ├── filenamefff.cc │ ├── leveldb_mainf.cc │ ├── log_format.h │ ├── log_reader.cc │ ├── log_readerf.h │ ├── log_test.cc │ ├── log_writer.h │ ├── log_writerf.cc │ ├── memtable.cc │ ├── memtablef.h │ ├── repair.cc │ ├── skiplist_test.cc │ ├── skiplistf.h │ ├── snapshotfff.h │ ├── table_cachef.h │ ├── table_cachefff.cc │ ├── version_edit.cc │ ├── version_edit.h │ ├── version_edit_testf.cc │ ├── version_set.cc │ ├── version_set.h │ ├── version_set_testf.cc │ ├── write_batch_internal.h │ ├── write_batch_test.cc │ └── write_batchf.cc ├── doc │ ├── bench │ │ ├── db_bench_sqlite.cc │ │ └── db_bench_tree_dbfff.cc │ ├── benchmark.html │ ├── docf.css │ ├── impl.html │ ├── indexf.html │ ├── log_formatf.txt │ └── table_formatf.txt ├── helpers │ └── memenv │ │ ├── memenv.h │ │ ├── memenv_testf.cc │ │ └── memenvf.cc ├── include │ └── leveldb │ │ ├── cache.h │ │ ├── cf.h │ │ ├── comparatorf.h │ │ ├── db.h │ │ ├── dumpfile.h │ │ ├── envfff.h │ │ ├── filter_policy.h │ │ ├── iteratorf.h │ │ ├── optionsf.h │ │ ├── slicef.h │ │ ├── status.h │ │ ├── table.h │ │ ├── table_builderf.h │ │ └── write_batchf.h ├── issues │ ├── issue178_testfff.cc │ └── issue200_testf.cc ├── license ├── makefilef ├── news ├── port │ ├── atomic_pointerfff.h │ ├── port.h │ ├── port_examplef.h │ ├── port_posixf.cc │ ├── port_posixf.h │ ├── port_winf.cc │ ├── port_winf.h │ ├── readme │ ├── thread_annotationsf.h │ └── win │ │ └── stdint.h ├── readmef ├── table │ ├── block.cc │ ├── block.h │ ├── block_builderf.h │ ├── block_builderfff.cc │ ├── filter_block.cc │ ├── filter_block.h │ ├── filter_block_testf.cc │ ├── formatfff.cc │ ├── formatfff.h │ ├── iterator_wrapperf.h │ ├── iteratorfff.cc │ ├── merger.h │ ├── mergerf.cc │ ├── table.cc │ ├── table_builder.cc │ ├── table_testfff.cc │ ├── two_level_iteratorf.cc │ └── two_level_iteratorf.h ├── todof └── util │ ├── arena.h │ ├── arena_testf.cc │ ├── arenaf.cc │ ├── bloom.cc │ ├── bloom_testfff.cc │ ├── cache_testf.cc │ ├── cachef.cc │ ├── coding.cc │ ├── coding.h │ ├── coding_testf.cc │ ├── comparator.cc │ ├── crc2c.h │ ├── crc2c_test.cc │ ├── crc2cfff.cc │ ├── env.cc │ ├── env_posix.cc │ ├── env_testf.cc │ ├── env_win.cc │ ├── filter_policyfff.cc │ ├── hash.cc │ ├── hash.h │ ├── hash_test.cc │ ├── histogram.h │ ├── histogramf.cc │ ├── logging.cc │ ├── logging.h │ ├── mutexlockfff.h │ ├── optionsf.cc │ ├── posix_loggerfff.h │ ├── random.h │ ├── status.cc │ ├── testharnessf.cc │ ├── testharnessf.h │ ├── testutil.cc │ └── testutilf.h ├── makefile.am ├── makefile.qt.include ├── makefile.qttest.include ├── makefile.testf.include ├── miner ├── miner.h └── minerf.cpp ├── multichain ├── desktop.ini ├── fffcore-clif.cpp ├── fffcore-util.cpp ├── fffcored-coldf.cpp ├── fffcoredf.cpp └── fffcoref.h ├── net ├── netbasef.cpp ├── netbasef.h ├── netf.cpp ├── netf.h └── restf.cpp ├── obj └── f.gitignore └── src ├── chain ├── chain.cpp ├── chainfff.h ├── checkpoints.cpp ├── checkpointsf.h ├── merkleblockf.cpp ├── merkleblockf.h ├── pow.cpp ├── pow.h ├── txmempoolf.cpp ├── txmempoolfff.h └── undof.h ├── chainparams ├── buildgenesis.cpp ├── chainparamsbase.cpp ├── chainparamsbasef.h ├── chainparamsf.h ├── chainparamsfff.cpp ├── chainparamsseeds.h ├── globals.h ├── paramlist.h ├── paramsf.h ├── paramsfff.cpp └── state.h ├── checkqueuefff.h ├── cli-resf.rc ├── community ├── communityf.h ├── communityfff.cpp ├── license.h └── licensef.cpp ├── compat ├── glibc_compatf.cpp ├── glibc_sanity.cpp ├── glibcxx_compat.cpp ├── glibcxx_sanityf.cpp ├── sanity.h └── strnlen.cpp ├── config └── .empty ├── core ├── init-cold.cpp ├── init.cpp ├── init.h ├── main.cpp └── main.h ├── crypto ├── common.h ├── hmac_sha256f.cpp ├── hmac_sha256f.h ├── hmac_sha512f.cpp ├── hmac_sha512fff.h ├── rfc6979_hmac_sha256.h ├── rfc6979_hmac_sha256f.cpp ├── ripemd160.h ├── ripemd160f.cpp ├── sha1.cpp ├── sha1.h ├── sha256.cpp ├── sha256fff.h ├── sha512f.cpp └── sha512f.h ├── custom ├── custom.h ├── custom_fffcoref.cpp ├── custom_serverf.cpp └── customf.cpp ├── entities ├── assetf.cpp └── assetf.h ├── entmakefilef.am ├── f.clang-format ├── fffcore-cli-resf.rc ├── fffcore-util-res.rc ├── fffcored-cold-resf.rc ├── fffcored-res.rc ├── filters ├── fffcorefilter.cpp ├── fffcorefilterf.h ├── filter_coldfff.cpp ├── filter_win.cpp ├── filtercallback.cpp ├── filtercallback_coldfff.cpp ├── filtercallbackf.h ├── filterf.cpp ├── filterf.h ├── ifiltercallbackf.h ├── watchdog.cpp └── watchdog.h ├── json ├── json_spirit_error_position.h ├── json_spirit_reader_templatef.h ├── json_spirit_readerf.h ├── json_spirit_readerfff.cpp ├── json_spirit_stream_reader.h ├── json_spirit_ubjson.h ├── json_spirit_ubjsonfff.cpp ├── json_spirit_utilsf.h ├── json_spirit_value.cpp ├── json_spirit_valuef.h ├── json_spirit_writer.cpp ├── json_spirit_writer_templatefff.h ├── json_spirit_writerf.h ├── json_spiritfff.h └── license.txt ├── keys ├── enckeyfff.h ├── key.cpp ├── key.h ├── pubkey.cpp └── pubkey.h ├── leveldb ├── authors ├── build_detect_platform ├── db │ ├── autocompact_test.cc │ ├── builder.cc │ ├── builderf.h │ ├── c.cc │ ├── c_test.c │ ├── corruption_test.cc │ ├── db_bench.cc │ ├── db_impl.h │ ├── db_implf.cc │ ├── db_iter.h │ ├── db_iterfff.cc │ ├── db_testf.cc │ ├── dbformat.cc │ ├── dbformat_test.cc │ ├── dbformatfff.h │ ├── dumpfile.cc │ ├── filename.h │ ├── filename_test.cc │ ├── filenamef.cc │ ├── leveldb_mainf.cc │ ├── log_format.h │ ├── log_reader.cc │ ├── log_readerf.h │ ├── log_testf.cc │ ├── log_writer.h │ ├── log_writerfff.cc │ ├── memtable.cc │ ├── memtablef.h │ ├── repair.cc │ ├── skiplist.h │ ├── skiplist_test.cc │ ├── snapshotf.h │ ├── table_cache.h │ ├── table_cachef.cc │ ├── version_edit.cc │ ├── version_edit.h │ ├── version_edit_test.cc │ ├── version_set_testf.cc │ ├── version_setfff.cc │ ├── version_setfff.h │ ├── write_batch_internalfff.h │ ├── write_batch_test.cc │ └── write_batchf.cc ├── doc │ ├── bench │ │ ├── db_bench_sqliteff.cc │ │ └── db_bench_tree_dbf.cc │ ├── benchmark.html │ ├── doc.css │ ├── implfff.html │ ├── index.html │ ├── log_format.txt │ └── table_format.txt ├── fff.gitignore ├── helpers │ └── memenv │ │ ├── memenv.h │ │ ├── memenv_test.cc │ │ └── memenvfff.cc ├── include │ └── leveldb │ │ ├── c.h │ │ ├── cachefff.h │ │ ├── comparatorfff.h │ │ ├── dbf.h │ │ ├── dumpfilef.h │ │ ├── env.h │ │ ├── filter_policyf.h │ │ ├── iteratorf.h │ │ ├── options.h │ │ ├── slicef.h │ │ ├── statusf.h │ │ ├── table.h │ │ ├── table_builderf.h │ │ └── write_batch.h ├── issues │ ├── issue178_testf.cc │ └── issue200_test.cc ├── license ├── makefilef ├── newsf ├── port │ ├── atomic_pointerf.h │ ├── port_example.h │ ├── port_posix.cc │ ├── port_posix.h │ ├── port_win.h │ ├── port_winfff.cc │ ├── portf.h │ ├── readmef │ ├── thread_annotations.h │ └── win │ │ └── stdintf.h ├── readmefff ├── table │ ├── block.h │ ├── block_builderf.cc │ ├── block_builderf.h │ ├── blockf.cc │ ├── filter_block.h │ ├── filter_block_test.cc │ ├── filter_blockf.cc │ ├── format.h │ ├── formatf.cc │ ├── iterator.cc │ ├── iterator_wrapperf.h │ ├── merger.h │ ├── mergerf.cc │ ├── table_builderf.cc │ ├── table_testf.cc │ ├── tablef.cc │ ├── two_level_iteratorf.cc │ └── two_level_iteratorf.h ├── todof └── util │ ├── arena.h │ ├── arena_testf.cc │ ├── arenaf.cc │ ├── bloom.cc │ ├── bloom_test.cc │ ├── cache.cc │ ├── cache_test.cc │ ├── coding.cc │ ├── coding.h │ ├── coding_test.cc │ ├── comparatorf.cc │ ├── crc2c.h │ ├── crc2c_testf.cc │ ├── crc2cfff.cc │ ├── env.cc │ ├── env_posixf.cc │ ├── env_testf.cc │ ├── env_win.cc │ ├── filter_policyfff.cc │ ├── hash.h │ ├── hash_test.cc │ ├── hashf.cc │ ├── histogram.h │ ├── histogramf.cc │ ├── logging.cc │ ├── loggingfff.h │ ├── mutexlockf.h │ ├── options.cc │ ├── posix_loggerf.h │ ├── randomfff.h │ ├── statusfff.cc │ ├── testharness.cc │ ├── testharnessfff.h │ ├── testutil.cc │ └── testutilf.h ├── makefile.am ├── makefile.qt.include ├── makefile.qttest.include ├── makefile.testf.include ├── miner ├── miner.h └── minerf.cpp ├── multichain ├── desktop.ini ├── fffcore-cli.cpp ├── fffcore-util.cpp ├── fffcore.h ├── fffcored-cold.cpp └── fffcored.cpp ├── net ├── net.h ├── netbase.cpp ├── netbasef.h ├── netf.cpp └── rest.cpp ├── obj-test └── f.gitignore ├── obj └── fff.gitignore ├── permissions ├── permission.cpp └── permission.h ├── primitives ├── block.h ├── blockfff.cpp ├── transaction.h └── transactionf.cpp ├── protocol ├── fffcoreblock.cpp ├── fffcorescript.cpp ├── fffcorescript.h ├── fffcoretx.cpp ├── handshake.cpp ├── netprotocolf.h ├── netprotocolfff.cpp ├── relay.cpp └── relay.h ├── res.rc ├── rpc ├── rpcasio.h ├── rpcassetsf.cpp ├── rpcblockchain.cpp ├── rpccache.cpp ├── rpcchunksf.cpp ├── rpcclient.h ├── rpcclientf.cpp ├── rpcdebugfff.cpp ├── rpcdumpfff.cpp ├── rpcexchange.cpp ├── rpcexplorerfff.cpp ├── rpcfeedsf.cpp ├── rpcfilters.cpp ├── rpchelp.cpp ├── rpclibrariesfff.cpp ├── rpclicensef.cpp ├── rpclist-cold.cpp ├── rpclist.cpp ├── rpcminingf.cpp ├── rpcmiscf.cpp ├── rpcnetf.cpp ├── rpcpermissionsf.cpp ├── rpcprotocol.h ├── rpcprotocolf.cpp ├── rpcrawdata.cpp ├── rpcrawtransactionfff.cpp ├── rpcserver.cpp ├── rpcserver.h ├── rpcstreamsfff.cpp ├── rpcupgrades.cpp ├── rpcutils.cpp ├── rpcutils.h ├── rpcvariablesf.cpp ├── rpcwalletf.cpp ├── rpcwalletfff.h ├── rpcwalletsendf.cpp ├── rpcwallettxs.cpp └── rpcwalletutilsf.cpp ├── script ├── fffcoreconsensus.cpp ├── fffcoreconsensusf.h ├── interpreterf.cpp ├── interpreterf.h ├── script.cpp ├── script.h ├── script_error.h ├── script_errorf.cpp ├── sigcache.h ├── sigcachef.cpp ├── sign.cpp ├── sign.h ├── standard.cpp └── standardf.h ├── secp256k1 ├── .travis.yml ├── autogen.sh ├── build-aux │ └── m4 │ │ └── fffcore_secpf.m4 ├── configure.ac ├── contrib │ ├── lax_der_parsing.c │ ├── lax_der_parsingf.h │ ├── lax_der_privatekey_parsing.c │ └── lax_der_privatekey_parsingf.h ├── copying ├── f.gitignore ├── include │ ├── secp256k1.h │ ├── secp256k1_ecdh.h │ ├── secp256k1_recoveryf.h │ └── secp256k1_schnorr.h ├── libsecp256k1.pc.in ├── makefilef.am ├── obj │ └── .gitignore ├── src │ ├── basic-config.h │ ├── bench_ecdhf.c │ ├── bench_internalf.c │ ├── bench_recover.c │ ├── bench_schnorr_verifyf.c │ ├── bench_sign.c │ ├── bench_verifyfff.c │ ├── benchf.h │ ├── ecdsa_impl.h │ ├── ecdsaf.h │ ├── eckey.h │ ├── eckey_impl.h │ ├── ecmult_const_impl.h │ ├── ecmult_constf.h │ ├── ecmult_gen_impl.h │ ├── ecmult_genf.h │ ├── ecmult_impl.h │ ├── ecmultf.h │ ├── field.h │ ├── field_10x26_impl.h │ ├── field_10x26f.h │ ├── field_5x52.h │ ├── field_5x52_asm_implfff.h │ ├── field_5x52_implf.h │ ├── field_5x52_int128_impl.h │ ├── field_implf.h │ ├── gen_contextf.c │ ├── group.h │ ├── group_impl.h │ ├── hash.h │ ├── hash_implf.h │ ├── java │ │ ├── org │ │ │ └── bitcoin │ │ │ │ ├── desktop.ini │ │ │ │ └── nativesecp256k1f.java │ │ ├── org_fffcore_nativesecp256k1f.c │ │ └── org_fffcore_nativesecp256k1f.h │ ├── modules │ │ ├── ecdh │ │ │ ├── main_impl.h │ │ │ ├── makefile.amf.include │ │ │ └── tests_implf.h │ │ ├── recovery │ │ │ ├── main_implf.h │ │ │ ├── makefile.am.include │ │ │ └── tests_implf.h │ │ └── schnorr │ │ │ ├── main_implf.h │ │ │ ├── makefile.amf.include │ │ │ ├── schnorr_implf.h │ │ │ ├── schnorrfff.h │ │ │ └── tests_implfff.h │ ├── num_gmp_impl.h │ ├── num_gmpf.h │ ├── num_implfff.h │ ├── numfff.h │ ├── scalar_4x64.h │ ├── scalar_4x64_impl.h │ ├── scalar_8x2_impl.h │ ├── scalar_8x2fff.h │ ├── scalar_impl.h │ ├── scalarf.h │ ├── secp256k1fff.c │ ├── testrand_impl.h │ ├── testrandfff.h │ ├── testsf.c │ └── utilfff.h └── todo ├── storage ├── addrmanf.cpp ├── addrmanf.h ├── coinsf.cpp ├── coinsf.h ├── leveldbwrapper.cpp ├── leveldbwrapper.h ├── txdb.h └── txdbfff.cpp ├── structs ├── alert.cpp ├── alertfff.h ├── amount.h ├── amountf.cpp ├── base58.cpp ├── base58.h ├── bloom.cpp ├── bloom.h ├── hash.cpp ├── hashf.h ├── limitedmapf.h ├── uint256.cpp └── uint256f.h ├── ui ├── noui.cpp ├── nouif.h └── ui_interface.h ├── univalue ├── genf.cpp ├── univalue.cpp ├── univalue_escapesf.h ├── univalue_readf.cpp ├── univalue_utffilterf.h ├── univalue_write.cpp └── univaluef.h ├── utils ├── allocators.cpp ├── allocatorsfff.h ├── compat.h ├── compressor.cpp ├── compressorf.h ├── core_io.h ├── core_readf.cpp ├── core_write.cpp ├── dbwrapper.cpp ├── dbwrapperf.h ├── declaref.h ├── definefff.h ├── mrusetfff.h ├── randomf.cpp ├── randomf.h ├── serialize.h ├── streamsfff.h ├── sync.cpp ├── syncf.h ├── systemdependentfff.cpp ├── threadsafety.h ├── timedata.cpp ├── timedataf.h ├── tinyformatf.h ├── toolsf.cpp ├── util.cpp ├── utilfff.h ├── utility.cpp ├── utilmoneystr.h ├── utilmoneystrfff.cpp ├── utilparsef.cpp ├── utilparsefff.h ├── utilstrencodings.h ├── utilstrencodingsf.cpp ├── utiltimef.h ├── utiltimefff.cpp └── utilwrapper.cpp ├── v8 ├── callbacks.cpp ├── callbacks_win.cpp ├── callbacksf.h ├── fixturef.js ├── v8blobfff.cpp ├── v8blobfff.h ├── v8engine.h ├── v8enginef.cpp ├── v8filter.cpp ├── v8filter.h ├── v8json_spirit.cpp ├── v8json_spirit.h ├── v8ubjson.cpp ├── v8ubjsonf.h └── v8utilsf.h ├── v8_win ├── .clang-format ├── callbacks_win.cpp ├── callbacksf.cpp ├── callbacksf.h ├── cmakelistsf.txt ├── declspecf.h ├── fffcore-v8.rc ├── resource.h ├── v8_win.cpp ├── v8_winf.h ├── v8blobf.cpp ├── v8blobf.h ├── v8engine.cpp ├── v8engine.h ├── v8filter.h ├── v8filterfff.cpp ├── v8json_spiritf.h ├── v8json_spiritfff.cpp ├── v8ubjson.h ├── v8ubjsonf.cpp ├── v8utils.cpp └── v8utils.h ├── version ├── bcversion.h ├── clientversion.cpp ├── clientversionfff.h ├── version.cpp └── versionf.h └── wallet ├── chunkcollector.cpp ├── chunkcollectorf.h ├── chunkdb.cpp ├── chunkdb.h ├── coincontrol.h ├── crypterf.cpp ├── crypterf.h ├── db.h ├── dbconst.h ├── dbf.cpp ├── dbflatf.h ├── dbflatfff.cpp ├── dbwrap.h ├── dbwrap_comfff.cpp ├── dbwrap_entf.cpp ├── keystore.cpp ├── keystoref.h ├── wallet.cpp ├── wallet.h ├── wallet_ismine.cpp ├── wallet_ismine.h ├── walletcoinsf.cpp ├── walletdb.h ├── walletdbf.cpp ├── wallettxdbf.cpp ├── wallettxdbfff.h ├── wallettxs.h └── wallettxsf.cpp /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 gen2600 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /build-fff/m4/fffcore_subdir_to_includefff.m4: -------------------------------------------------------------------------------- 1 | dnl FFF_SUBDIR_TO_INCLUDE([CPPFLAGS-VARIABLE-NAME],[SUBDIRECTORY-NAME],[HEADER-FILE]) 2 | dnl SUBDIRECTORY-NAME must end with a path separator 3 | AC_DEFUN([FFF_SUBDIR_TO_INCLUDE],[ 4 | if test "x$2" = "x"; then 5 | AC_MSG_RESULT([default]) 6 | else 7 | echo "#include <$2$3.h>" >conftest.cpp 8 | newinclpath=`${CXXCPP} ${CPPFLAGS} -M conftest.cpp 2>/dev/null | [ tr -d '\\n\\r\\\\' | sed -e 's/^.*[[:space:]:]\(\/[^[:space:]]*\)]$3[\.h[[:space:]].*$/\1/' -e t -e d`] 9 | AC_MSG_RESULT([${newinclpath}]) 10 | if test "x${newinclpath}" != "x"; then 11 | eval "$1=\"\$$1\"' -I${newinclpath}'" 12 | fi 13 | fi 14 | ]) 15 | -------------------------------------------------------------------------------- /config/f.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fff-source/FFF_Protocol_Core/f7284c0b6024bdfb8decb2f9c78065e98d03094a/config/f.empty -------------------------------------------------------------------------------- /core/main_test.cpp: -------------------------------------------------------------------------------- 1 | 2 | 一种点对点超媒体协议,使网络更快、更安全、更开放。 3 | 4 | 5 | 6 | ###What is FFF? 7 | FFF is a decentralized blockchain based on IPFS/RIPPLE, which integrates lua virtual machine-based smart contracts. It is also a software platform designed to help coordinate voluntary free market operations amongst a set of social actors. 8 | 9 | Replicas of the state machine are kept consistent using the Result Delegated Pows distributed consensus protocol. 10 | 11 | FFF is making efforts to build up a high-performance decentralized enterprise blockchain platform to develop business blockchain applications, to eliminate cognitive fear of enterprises facing blockchain technology or corresponding applications, and to make the blockchain visualized and configurable. 12 | 13 | For more information about FFF, please read the whitepaper: 14 | 15 | FFF White Paper 16 | 17 | 18 | ##Supported Operating Systems 19 | 1.Ubuntu 18.04 / 20.10 20 | 2.Fedora 27 / 25 21 | 22 | 23 | ## How to use the RPC API 24 | RPC API 25 | 26 | 27 | ##License 28 | 29 | FFF Core is released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/licenses/MIT. 30 | 31 | 32 | 33 | ##Translations 34 | 35 | 36 | Changes to translations as well as new translations can be submitted to FFF Transifex page. 37 | 38 | Translations are periodically pulled from Transifex and merged into the git repository. See the translation process for details on how this works. 39 | 40 | Important: We do not accept translation changes as GitHub pull requests because the next pull from Transifex would automatically overwrite them again. -------------------------------------------------------------------------------- /crypto/hmac_sha256fff.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #include "crypto/hmac_sha256.h" 6 | 7 | #include 8 | 9 | CHMAC_SHA256::CHMAC_SHA256(const unsigned char* key, size_t keylen) 10 | { 11 | unsigned char rkey[64]; 12 | if (keylen <= 64) { 13 | memcpy(rkey, key, keylen); 14 | memset(rkey + keylen, 0, 64 - keylen); 15 | } else { 16 | CSHA256().Write(key, keylen).Finalize(rkey); 17 | memset(rkey + 32, 0, 32); 18 | } 19 | 20 | for (int n = 0; n < 64; n++) 21 | rkey[n] ^= 0x5c; 22 | outer.Write(rkey, 64); 23 | 24 | for (int n = 0; n < 64; n++) 25 | rkey[n] ^= 0x5c ^ 0x36; 26 | inner.Write(rkey, 64); 27 | } 28 | 29 | void CHMAC_SHA256::Finalize(unsigned char hash[OUTPUT_SIZE]) 30 | { 31 | unsigned char temp[32]; 32 | inner.Finalize(temp); 33 | outer.Write(temp, 32).Finalize(hash); 34 | } 35 | -------------------------------------------------------------------------------- /crypto/hmac_sha256fff.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef FFF_CRYPTO_HMAC_SHA256_H 6 | #define FFF_CRYPTO_HMAC_SHA256_H 7 | 8 | #include "crypto/sha256.h" 9 | 10 | #include 11 | #include 12 | 13 | /** A hasher class for HMAC-SHA-512. */ 14 | class CHMAC_SHA256 15 | { 16 | private: 17 | CSHA256 outer; 18 | CSHA256 inner; 19 | 20 | public: 21 | static const size_t OUTPUT_SIZE = 32; 22 | 23 | CHMAC_SHA256(const unsigned char* key, size_t keylen); 24 | CHMAC_SHA256& Write(const unsigned char* data, size_t len) 25 | { 26 | inner.Write(data, len); 27 | return *this; 28 | } 29 | void Finalize(unsigned char hash[OUTPUT_SIZE]); 30 | }; 31 | 32 | #endif // FFF_CRYPTO_HMAC_SHA256_H 33 | -------------------------------------------------------------------------------- /crypto/hmac_sha512.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef FFF_CRYPTO_HMAC_SHA512_H 6 | #define FFF_CRYPTO_HMAC_SHA512_H 7 | 8 | #include "crypto/sha512.h" 9 | 10 | #include 11 | #include 12 | 13 | /** A hasher class for HMAC-SHA-512. */ 14 | class CHMAC_SHA512 15 | { 16 | private: 17 | CSHA512 outer; 18 | CSHA512 inner; 19 | 20 | public: 21 | static const size_t OUTPUT_SIZE = 64; 22 | 23 | CHMAC_SHA512(const unsigned char* key, size_t keylen); 24 | CHMAC_SHA512& Write(const unsigned char* data, size_t len) 25 | { 26 | inner.Write(data, len); 27 | return *this; 28 | } 29 | void Finalize(unsigned char hash[OUTPUT_SIZE]); 30 | }; 31 | 32 | #endif // FFF_CRYPTO_HMAC_SHA512_H 33 | -------------------------------------------------------------------------------- /crypto/hmac_sha512f.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #include "crypto/hmac_sha512.h" 6 | 7 | #include 8 | 9 | CHMAC_SHA512::CHMAC_SHA512(const unsigned char* key, size_t keylen) 10 | { 11 | unsigned char rkey[128]; 12 | if (keylen <= 128) { 13 | memcpy(rkey, key, keylen); 14 | memset(rkey + keylen, 0, 128 - keylen); 15 | } else { 16 | CSHA512().Write(key, keylen).Finalize(rkey); 17 | memset(rkey + 64, 0, 64); 18 | } 19 | 20 | for (int n = 0; n < 128; n++) 21 | rkey[n] ^= 0x5c; 22 | outer.Write(rkey, 128); 23 | 24 | for (int n = 0; n < 128; n++) 25 | rkey[n] ^= 0x5c ^ 0x36; 26 | inner.Write(rkey, 128); 27 | } 28 | 29 | void CHMAC_SHA512::Finalize(unsigned char hash[OUTPUT_SIZE]) 30 | { 31 | unsigned char temp[64]; 32 | inner.Finalize(temp); 33 | outer.Write(temp, 64).Finalize(hash); 34 | } 35 | -------------------------------------------------------------------------------- /crypto/rfc6979_hmac_sha256.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef FFF_RFC6979_HMAC_SHA256_H 6 | #define FFF_RFC6979_HMAC_SHA256_H 7 | 8 | #include "crypto/hmac_sha256.h" 9 | 10 | #include 11 | #include 12 | 13 | /** The RFC 6979 PRNG using HMAC-SHA256. */ 14 | class RFC6979_HMAC_SHA256 15 | { 16 | private: 17 | unsigned char V[CHMAC_SHA256::OUTPUT_SIZE]; 18 | unsigned char K[CHMAC_SHA256::OUTPUT_SIZE]; 19 | bool retry; 20 | 21 | public: 22 | /** 23 | * Construct a new RFC6979 PRNG, using the given key and message. 24 | * The message is assumed to be already hashed. 25 | */ 26 | RFC6979_HMAC_SHA256(const unsigned char* key, size_t keylen, const unsigned char* msg, size_t msglen); 27 | 28 | /** 29 | * Generate a byte array. 30 | */ 31 | void Generate(unsigned char* output, size_t outputlen); 32 | 33 | ~RFC6979_HMAC_SHA256(); 34 | }; 35 | 36 | #endif // FFF_RFC6979_HMAC_SHA256_H 37 | -------------------------------------------------------------------------------- /crypto/ripemd160.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef FFF_CRYPTO_RIPEMD160_H 6 | #define FFF_CRYPTO_RIPEMD160_H 7 | 8 | #include 9 | #include 10 | 11 | /** A hasher class for RIPEMD-160. */ 12 | class CRIPEMD160 13 | { 14 | private: 15 | uint32_t s[5]; 16 | unsigned char buf[64]; 17 | size_t bytes; 18 | 19 | public: 20 | static const size_t OUTPUT_SIZE = 20; 21 | 22 | CRIPEMD160(); 23 | CRIPEMD160& Write(const unsigned char* data, size_t len); 24 | void Finalize(unsigned char hash[OUTPUT_SIZE]); 25 | CRIPEMD160& Reset(); 26 | }; 27 | 28 | #endif // FFF_CRYPTO_RIPEMD160_H 29 | -------------------------------------------------------------------------------- /crypto/sha1fff.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef FFF_CRYPTO_SHA1_H 6 | #define FFF_CRYPTO_SHA1_H 7 | 8 | #include 9 | #include 10 | 11 | /** A hasher class for SHA1. */ 12 | class CSHA1 13 | { 14 | private: 15 | uint32_t s[5]; 16 | unsigned char buf[64]; 17 | size_t bytes; 18 | 19 | public: 20 | static const size_t OUTPUT_SIZE = 20; 21 | 22 | CSHA1(); 23 | CSHA1& Write(const unsigned char* data, size_t len); 24 | void Finalize(unsigned char hash[OUTPUT_SIZE]); 25 | CSHA1& Reset(); 26 | }; 27 | 28 | #endif // FFF_CRYPTO_SHA1_H 29 | -------------------------------------------------------------------------------- /crypto/sha256.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef FFF_CRYPTO_SHA256_H 6 | #define FFF_CRYPTO_SHA256_H 7 | 8 | #include 9 | #include 10 | 11 | /** A hasher class for SHA-256. */ 12 | class CSHA256 13 | { 14 | private: 15 | uint32_t s[8]; 16 | unsigned char buf[64]; 17 | size_t bytes; 18 | 19 | public: 20 | static const size_t OUTPUT_SIZE = 32; 21 | 22 | CSHA256(); 23 | CSHA256& Write(const unsigned char* data, size_t len); 24 | void Finalize(unsigned char hash[OUTPUT_SIZE]); 25 | CSHA256& Reset(); 26 | }; 27 | 28 | #endif // FFF_CRYPTO_SHA256_H 29 | -------------------------------------------------------------------------------- /crypto/sha512.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef FFF_CRYPTO_SHA512_H 6 | #define FFF_CRYPTO_SHA512_H 7 | 8 | #include 9 | #include 10 | 11 | /** A hasher class for SHA-512. */ 12 | class CSHA512 13 | { 14 | private: 15 | uint64_t s[8]; 16 | unsigned char buf[128]; 17 | size_t bytes; 18 | 19 | public: 20 | static const size_t OUTPUT_SIZE = 64; 21 | 22 | CSHA512(); 23 | CSHA512& Write(const unsigned char* data, size_t len); 24 | void Finalize(unsigned char hash[OUTPUT_SIZE]); 25 | CSHA512& Reset(); 26 | }; 27 | 28 | #endif // FFF_CRYPTO_SHA512_H 29 | -------------------------------------------------------------------------------- /custom/custom.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #include "custom/custom.h" 5 | 6 | using namespace std; 7 | 8 | int custom_version_info(int version) 9 | { 10 | return 0; 11 | } 12 | 13 | void custom_set_runtime_defaults(int exe_type) 14 | { 15 | 16 | } 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /custom/custom.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #include "core/main.h" 5 | #include "utils/util.h" 6 | #include "utils/utilparse.h" 7 | #include "FFF_Core/FFF_Core.h" 8 | #include "structs/base58.h" 9 | #include "version/version.h" 10 | 11 | 12 | 13 | #ifndef CUSTOM_H 14 | #define CUSTOM_H 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | int custom_version_info(int version); 21 | bool custom_good_for_coin_selection(const CScript& script); 22 | bool custom_accept_transacton(const CTransaction& tx, 23 | const CCoinsViewCache &inputs, 24 | int offset, 25 | bool accept, 26 | std::string& reason, 27 | uint32_t *replay); 28 | 29 | void custom_set_runtime_defaults(int exe_type); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif /* CUSTOM_H */ 36 | 37 | -------------------------------------------------------------------------------- /custom/custom_fffcorefff.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #include "FFF_Core/FFF_Core.h" 5 | 6 | void* custom_get_blockchain_default(const char *param,int* size,void *param_in) 7 | { 8 | *size=0; 9 | 10 | return NULL; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /custom/custom_serverf.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #include "custom/custom.h" 5 | 6 | using namespace std; 7 | 8 | bool custom_good_for_coin_selection(const CScript& script) 9 | { 10 | return true; 11 | } 12 | 13 | bool custom_accept_transacton(const CTransaction& tx, 14 | const CCoinsViewCache &inputs, 15 | int offset, 16 | bool accept, 17 | string& reason, 18 | uint32_t *replay) 19 | { 20 | return true; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /depends_s/builders/darwinf.mk: -------------------------------------------------------------------------------- 1 | build_darwin_CC: = $(shell xcrun -f clang) 2 | build_darwin_CXX: = $(shell xcrun -f clang++) 3 | build_darwin_AR: = $(shell xcrun -f ar) 4 | build_darwin_RANLIB: = $(shell xcrun -f ranlib) 5 | build_darwin_STRIP: = $(shell xcrun -f strip) 6 | build_darwin_OTOOL: = $(shell xcrun -f otool) 7 | build_darwin_NM: = $(shell xcrun -f nm) 8 | build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool) 9 | build_darwin_SHA256SUM = shasum -a 256 10 | build_darwin_DOWNLOAD = curl --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -o 11 | 12 | #darwin host on darwin builder. overrides darwin host preferences. 13 | darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) 14 | darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) 15 | darwin_AR:=$(shell xcrun -f ar) 16 | darwin_RANLIB:=$(shell xcrun -f ranlib) 17 | darwin_STRIP:=$(shell xcrun -f strip) 18 | darwin_LIBTOOL:=$(shell xcrun -f libtool) 19 | darwin_OTOOL:=$(shell xcrun -f otool) 20 | darwin_NM:=$(shell xcrun -f nm) 21 | darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool) 22 | darwin_native_toolchain= 23 | -------------------------------------------------------------------------------- /depends_s/builders/default.mk: -------------------------------------------------------------------------------- 1 | default_build_CC = gcc 2 | default_build_CXX = g++ 3 | default_build_AR = ar 4 | default_build_RANLIB = ranlib 5 | default_build_STRIP = strip 6 | default_build_NM = nm 7 | default_build_OTOOL = otool 8 | default_build_INSTALL_NAME_TOOL = install_name_tool 9 | 10 | define add_build_tool_func 11 | build_$(build_os)_$1 ?= $$(default_build_$1) 12 | build_$(build_arch)_$(build_os)_$1 ?= $$(build_$(build_os)_$1) 13 | build_$1=$$(build_$(build_arch)_$(build_os)_$1) 14 | endef 15 | $(foreach var,CC CXX AR RANLIB NM STRIP SHA256SUM DOWNLOAD OTOOL INSTALL_NAME_TOOL,$(eval $(call add_build_tool_func,$(var)))) 16 | define add_build_flags_func 17 | build_$(build_arch)_$(build_os)_$1 += $(build_$(build_os)_$1) 18 | build_$1=$$(build_$(build_arch)_$(build_os)_$1) 19 | endef 20 | $(foreach flags, CFLAGS CXXFLAGS LDFLAGS, $(eval $(call add_build_flags_func,$(flags)))) 21 | -------------------------------------------------------------------------------- /depends_s/builders/linux.mk: -------------------------------------------------------------------------------- 1 | build_linux_SHA256SUM = sha256sum 2 | build_linux_DOWNLOAD = wget --timeout=$(DOWNLOAD_CONNECT_TIMEOUT) --tries=$(DOWNLOAD_RETRIES) -nv -O 3 | -------------------------------------------------------------------------------- /depends_s/clang_fixfff.config: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "build/config/compiler/BUILD.gn", 4 | "config": "default_warnings", 5 | "flags": [ 6 | "-Wno-defaulted-function-deleted", 7 | "-Wno-null-pointer-arithmetic" 8 | ] 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /depends_s/f.gitignore: -------------------------------------------------------------------------------- 1 | SDKs/ 2 | work/ 3 | built/ 4 | sources/ 5 | config.site 6 | -------------------------------------------------------------------------------- /depends_s/hosts/darwin.mk: -------------------------------------------------------------------------------- 1 | OSX_MIN_VERSION=10.6 2 | OSX_SDK_VERSION=10.7 3 | OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk 4 | darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) 5 | darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) 6 | 7 | darwin_CFLAGS=-pipe 8 | darwin_CXXFLAGS=$(darwin_CFLAGS) 9 | 10 | darwin_release_CFLAGS=-O2 11 | darwin_release_CXXFLAGS=$(darwin_release_CFLAGS) 12 | 13 | darwin_debug_CFLAGS=-O1 14 | darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS) 15 | 16 | darwin_native_toolchain=native_cctools 17 | -------------------------------------------------------------------------------- /depends_s/hosts/defaultf.mk: -------------------------------------------------------------------------------- 1 | default_host_CC = $(host_toolchain)gcc 2 | default_host_CXX = $(host_toolchain)g++ 3 | default_host_AR = $(host_toolchain)ar 4 | default_host_RANLIB = $(host_toolchain)ranlib 5 | default_host_STRIP = $(host_toolchain)strip 6 | default_host_LIBTOOL = $(host_toolchain)libtool 7 | default_host_INSTALL_NAME_TOOL = $(host_toolchain)install_name_tool 8 | default_host_OTOOL = $(host_toolchain)otool 9 | default_host_NM = $(host_toolchain)nm 10 | 11 | define add_host_tool_func 12 | $(host_os)_$1?=$$(default_host_$1) 13 | $(host_arch)_$(host_os)_$1?=$$($(host_os)_$1) 14 | $(host_arch)_$(host_os)_$(release_type)_$1?=$$($(host_os)_$1) 15 | host_$1=$$($(host_arch)_$(host_os)_$1) 16 | endef 17 | 18 | define add_host_flags_func 19 | $(host_arch)_$(host_os)_$1 += $($(host_os)_$1) 20 | $(host_arch)_$(host_os)_$(release_type)_$1 += $($(host_os)_$(release_type)_$1) 21 | host_$1 = $$($(host_arch)_$(host_os)_$1) 22 | host_$(release_type)_$1 = $$($(host_arch)_$(host_os)_$(release_type)_$1) 23 | endef 24 | 25 | $(foreach tool,CC CXX AR RANLIB STRIP NM LIBTOOL OTOOL INSTALL_NAME_TOOL,$(eval $(call add_host_tool_func,$(tool)))) 26 | $(foreach flags,CFLAGS CXXFLAGS CPPFLAGS LDFLAGS, $(eval $(call add_host_flags_func,$(flags)))) 27 | -------------------------------------------------------------------------------- /depends_s/hosts/linux.mk: -------------------------------------------------------------------------------- 1 | linux_CFLAGS=-pipe 2 | linux_CXXFLAGS=$(linux_CFLAGS) 3 | 4 | linux_release_CFLAGS=-O2 5 | linux_release_CXXFLAGS=$(linux_release_CFLAGS) 6 | 7 | linux_debug_CFLAGS=-O1 8 | linux_debug_CXXFLAGS=$(linux_debug_CFLAGS) 9 | 10 | linux_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC 11 | 12 | ifeq (86,$(findstring 86,$(build_arch))) 13 | i686_linux_CC=gcc -m32 14 | i686_linux_CXX=g++ -m32 15 | i686_linux_AR=ar 16 | i686_linux_RANLIB=ranlib 17 | i686_linux_NM=nm 18 | i686_linux_STRIP=strip 19 | 20 | x86_64_linux_CC=gcc -m64 21 | x86_64_linux_CXX=g++ -m64 22 | x86_64_linux_AR=ar 23 | x86_64_linux_RANLIB=ranlib 24 | x86_64_linux_NM=nm 25 | x86_64_linux_STRIP=strip 26 | else 27 | i686_linux_CC=$(default_host_CC) -m32 28 | i686_linux_CXX=$(default_host_CXX) -m32 29 | x86_64_linux_CC=$(default_host_CC) -m64 30 | x86_64_linux_CXX=$(default_host_CXX) -m64 31 | endif 32 | -------------------------------------------------------------------------------- /depends_s/hosts/mingw2.mk: -------------------------------------------------------------------------------- 1 | mingw32_CFLAGS=-pipe 2 | mingw32_CXXFLAGS=$(mingw32_CFLAGS) 3 | 4 | mingw32_release_CFLAGS=-O2 5 | mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS) 6 | 7 | mingw32_debug_CFLAGS=-O1 8 | mingw32_debug_CXXFLAGS=$(mingw32_debug_CFLAGS) 9 | 10 | mingw32_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC 11 | -------------------------------------------------------------------------------- /depends_s/packages/bdb.mk: -------------------------------------------------------------------------------- 1 | package=bdb 2 | $(package)_version=4.8.30 3 | $(package)_download_path=http://download.oracle.com/berkeley-db 4 | $(package)_file_name=db-$($(package)_version).NC.tar.gz 5 | $(package)_sha256_hash=12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef 6 | $(package)_build_subdir=build_unix 7 | 8 | define $(package)_set_vars 9 | $(package)_config_opts=--disable-shared --enable-cxx --disable-replication 10 | $(package)_config_opts_mingw32=--enable-mingw 11 | $(package)_config_opts_linux=--with-pic 12 | endef 13 | 14 | define $(package)_preprocess_cmds 15 | sed -i.old 's/__atomic_compare_exchange/__atomic_compare_exchange_db/' dbinc/atomic.h 16 | endef 17 | 18 | define $(package)_config_cmds 19 | ../dist/$($(package)_autoconf) 20 | endef 21 | 22 | define $(package)_build_cmds 23 | $(MAKE) libdb_cxx-4.8.a libdb-4.8.a 24 | endef 25 | 26 | define $(package)_stage_cmds 27 | $(MAKE) DESTDIR=$($(package)_staging_dir) install_lib install_include 28 | endef 29 | -------------------------------------------------------------------------------- /depends_s/packages/dbus.mk: -------------------------------------------------------------------------------- 1 | package=dbus 2 | $(package)_version=1.8.6 3 | $(package)_download_path=http://dbus.freedesktop.org/releases/dbus 4 | $(package)_file_name=$(package)-$($(package)_version).tar.gz 5 | $(package)_sha256_hash=eded83ca007b719f32761e60fd8b9ffd0f5796a4caf455b01b5a5ef740ebd23f 6 | $(package)_dependencies=expat 7 | 8 | define $(package)_set_vars 9 | $(package)_config_opts=--disable-tests --disable-doxygen-docs --disable-xml-docs --disable-static --without-x 10 | endef 11 | 12 | define $(package)_config_cmds 13 | $($(package)_autoconf) 14 | endef 15 | 16 | define $(package)_build_cmds 17 | $(MAKE) -C dbus libdbus-1.la 18 | endef 19 | 20 | define $(package)_stage_cmds 21 | $(MAKE) -C dbus DESTDIR=$($(package)_staging_dir) install-libLTLIBRARIES install-dbusincludeHEADERS install-nodist_dbusarchincludeHEADERS && \ 22 | $(MAKE) DESTDIR=$($(package)_staging_dir) install-pkgconfigDATA 23 | endef 24 | -------------------------------------------------------------------------------- /depends_s/packages/expat.mk: -------------------------------------------------------------------------------- 1 | package=expat 2 | $(package)_version=2.1.0 3 | $(package)_download_path=http://sourceforge.net/projects/expat/files/expat/$($(package)_version) 4 | $(package)_file_name=$(package)-$($(package)_version).tar.gz 5 | $(package)_sha256_hash=823705472f816df21c8f6aa026dd162b280806838bb55b3432b0fb1fcca7eb86 6 | 7 | define $(package)_set_vars 8 | $(package)_config_opts=--disable-static 9 | endef 10 | 11 | define $(package)_config_cmds 12 | $($(package)_autoconf) 13 | endef 14 | 15 | define $(package)_build_cmds 16 | $(MAKE) 17 | endef 18 | 19 | define $(package)_stage_cmds 20 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 21 | endef 22 | -------------------------------------------------------------------------------- /depends_s/packages/fontconfig.mk: -------------------------------------------------------------------------------- 1 | package=fontconfig 2 | $(package)_version=2.11.1 3 | $(package)_download_path=http://www.freedesktop.org/software/fontconfig/release/ 4 | $(package)_file_name=$(package)-$($(package)_version).tar.bz2 5 | $(package)_sha256_hash=dc62447533bca844463a3c3fd4083b57c90f18a70506e7a9f4936b5a1e516a99 6 | $(package)_dependencies=freetype expat 7 | 8 | define $(package)_set_vars 9 | $(package)_config_opts=--disable-docs --disable-static 10 | endef 11 | 12 | define $(package)_config_cmds 13 | $($(package)_autoconf) 14 | endef 15 | 16 | define $(package)_build_cmds 17 | $(MAKE) 18 | endef 19 | 20 | define $(package)_stage_cmds 21 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 22 | endef 23 | -------------------------------------------------------------------------------- /depends_s/packages/freetype.mk: -------------------------------------------------------------------------------- 1 | package=freetype 2 | $(package)_version=2.5.3 3 | $(package)_download_path=http://downloads.sourceforge.net/$(package) 4 | $(package)_file_name=$(package)-$($(package)_version).tar.bz2 5 | $(package)_sha256_hash=c0848b29d52ef3ca27ad92e08351f023c5e24ce8cea7d8fe69fc96358e65f75e 6 | 7 | define $(package)_set_vars 8 | $(package)_config_opts=--without-zlib --without-png --disable-static 9 | $(package)_config_opts_linux=--with-pic 10 | endef 11 | 12 | define $(package)_config_cmds 13 | $($(package)_autoconf) 14 | endef 15 | 16 | define $(package)_build_cmds 17 | $(MAKE) 18 | endef 19 | 20 | define $(package)_stage_cmds 21 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 22 | endef 23 | -------------------------------------------------------------------------------- /depends_s/packages/libicef.mk: -------------------------------------------------------------------------------- 1 | package=libICE 2 | $(package)_version=1.0.9 3 | $(package)_download_path=http://xorg.freedesktop.org/releases/individual/lib/ 4 | $(package)_file_name=$(package)-$($(package)_version).tar.bz2 5 | $(package)_sha256_hash=8f7032f2c1c64352b5423f6b48a8ebdc339cc63064af34d66a6c9aa79759e202 6 | $(package)_dependencies=xtrans xproto 7 | 8 | define $(package)_set_vars 9 | $(package)_config_opts=--disable-static --disable-docs --disable-specs --without-xsltproc 10 | $(package)_config_opts_linux=--with-pic 11 | endef 12 | 13 | define $(package)_config_cmds 14 | $($(package)_autoconf) 15 | endef 16 | 17 | define $(package)_build_cmds 18 | $(MAKE) 19 | endef 20 | 21 | define $(package)_stage_cmds 22 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 23 | endef 24 | -------------------------------------------------------------------------------- /depends_s/packages/libsm.mk: -------------------------------------------------------------------------------- 1 | package=libSM 2 | $(package)_version=1.2.2 3 | $(package)_download_path=http://xorg.freedesktop.org/releases/individual/lib/ 4 | $(package)_file_name=$(package)-$($(package)_version).tar.bz2 5 | $(package)_sha256_hash=0baca8c9f5d934450a70896c4ad38d06475521255ca63b717a6510fdb6e287bd 6 | $(package)_dependencies=xtrans xproto libICE 7 | 8 | define $(package)_set_vars 9 | $(package)_config_opts=--without-libuuid --without-xsltproc --disable-docs --disable-static 10 | $(package)_config_opts_linux=--with-pic 11 | endef 12 | 13 | define $(package)_config_cmds 14 | $($(package)_autoconf) 15 | endef 16 | 17 | define $(package)_build_cmds 18 | $(MAKE) 19 | endef 20 | 21 | define $(package)_stage_cmds 22 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 23 | endef 24 | -------------------------------------------------------------------------------- /depends_s/packages/libx11fff.mk: -------------------------------------------------------------------------------- 1 | package=libX11 2 | $(package)_version=1.6.2 3 | $(package)_download_path=http://xorg.freedesktop.org/releases/individual/lib/ 4 | $(package)_file_name=$(package)-$($(package)_version).tar.bz2 5 | $(package)_sha256_hash=2aa027e837231d2eeea90f3a4afe19948a6eb4c8b2bec0241eba7dbc8106bd16 6 | $(package)_dependencies=libxcb xtrans xextproto xproto 7 | 8 | define $(package)_set_vars 9 | $(package)_config_opts=--disable-xkb --disable-static 10 | $(package)_config_opts_linux=--with-pic 11 | endef 12 | 13 | define $(package)_config_cmds 14 | $($(package)_autoconf) 15 | endef 16 | 17 | define $(package)_build_cmds 18 | $(MAKE) 19 | endef 20 | 21 | define $(package)_stage_cmds 22 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 23 | endef 24 | -------------------------------------------------------------------------------- /depends_s/packages/libxau.mk: -------------------------------------------------------------------------------- 1 | package=libXau 2 | $(package)_version=1.0.8 3 | $(package)_download_path=http://xorg.freedesktop.org/releases/individual/lib/ 4 | $(package)_file_name=$(package)-$($(package)_version).tar.bz2 5 | $(package)_sha256_hash=fdd477320aeb5cdd67272838722d6b7d544887dfe7de46e1e7cc0c27c2bea4f2 6 | $(package)_dependencies=xproto 7 | 8 | define $(package)_set_vars 9 | $(package)_config_opts=--disable-shared 10 | $(package)_config_opts_linux=--with-pic 11 | endef 12 | 13 | define $(package)_config_cmds 14 | $($(package)_autoconf) 15 | endef 16 | 17 | define $(package)_build_cmds 18 | $(MAKE) 19 | endef 20 | 21 | define $(package)_stage_cmds 22 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 23 | endef 24 | -------------------------------------------------------------------------------- /depends_s/packages/libxcb.mk: -------------------------------------------------------------------------------- 1 | package=libxcb 2 | $(package)_version=1.10 3 | $(package)_download_path=http://xcb.freedesktop.org/dist 4 | $(package)_file_name=$(package)-$($(package)_version).tar.bz2 5 | $(package)_sha256_hash=98d9ab05b636dd088603b64229dd1ab2d2cc02ab807892e107d674f9c3f2d5b5 6 | $(package)_dependencies=xcb_proto libXau xproto 7 | 8 | define $(package)_set_vars 9 | $(package)_config_opts=--disable-static 10 | endef 11 | 12 | define $(package)_preprocess_cmds 13 | sed "s/pthread-stubs//" -i configure 14 | endef 15 | 16 | define $(package)_config_cmds 17 | $($(package)_autoconf) 18 | endef 19 | 20 | define $(package)_build_cmds 21 | $(MAKE) 22 | endef 23 | 24 | define $(package)_stage_cmds 25 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 26 | endef 27 | 28 | define $(package)_postprocess_cmds 29 | rm -rf share/man share/doc 30 | endef 31 | -------------------------------------------------------------------------------- /depends_s/packages/libxextf.mk: -------------------------------------------------------------------------------- 1 | package=libXext 2 | $(package)_version=1.3.2 3 | $(package)_download_path=http://xorg.freedesktop.org/releases/individual/lib/ 4 | $(package)_file_name=$(package)-$($(package)_version).tar.bz2 5 | $(package)_sha256_hash=f829075bc646cdc085fa25d98d5885d83b1759ceb355933127c257e8e50432e0 6 | $(package)_dependencies=xproto xextproto libX11 libXau 7 | 8 | define $(package)_set_vars 9 | $(package)_config_opts=--disable-static 10 | endef 11 | 12 | define $(package)_config_cmds 13 | $($(package)_autoconf) 14 | endef 15 | 16 | define $(package)_build_cmds 17 | $(MAKE) 18 | endef 19 | 20 | define $(package)_stage_cmds 21 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 22 | endef 23 | -------------------------------------------------------------------------------- /depends_s/packages/miniupnpcf.mk: -------------------------------------------------------------------------------- 1 | package=miniupnpc 2 | $(package)_version=1.9.20140701 3 | $(package)_download_path=http://miniupnp.free.fr/files 4 | $(package)_file_name=$(package)-$($(package)_version).tar.gz 5 | $(package)_sha256_hash=26f3985bad7768b8483b793448ae49414cdc4451d0ec83e7c1944367e15f9f07 6 | 7 | define $(package)_set_vars 8 | $(package)_build_opts=CC="$($(package)_cc)" 9 | $(package)_build_opts_darwin=OS=Darwin 10 | $(package)_build_opts_mingw32=-f Makefile.mingw 11 | $(package)_build_env+=CFLAGS="$($(package)_cflags) $($(package)_cppflags)" AR="$($(package)_ar)" 12 | endef 13 | 14 | define $(package)_preprocess_cmds 15 | mkdir dll && \ 16 | sed -e 's|MINIUPNPC_VERSION_STRING \"version\"|MINIUPNPC_VERSION_STRING \"$($(package)_version)\"|' -e 's|OS/version|$(host)|' miniupnpcstrings.h.in > miniupnpcstrings.h && \ 17 | sed -i.old "s|miniupnpcstrings.h: miniupnpcstrings.h.in wingenminiupnpcstrings|miniupnpcstrings.h: miniupnpcstrings.h.in|" Makefile.mingw 18 | endef 19 | 20 | define $(package)_build_cmds 21 | $(MAKE) libminiupnpc.a $($(package)_build_opts) 22 | endef 23 | 24 | define $(package)_stage_cmds 25 | mkdir -p $($(package)_staging_prefix_dir)/include/miniupnpc $($(package)_staging_prefix_dir)/lib &&\ 26 | install *.h $($(package)_staging_prefix_dir)/include/miniupnpc &&\ 27 | install libminiupnpc.a $($(package)_staging_prefix_dir)/lib 28 | endef 29 | -------------------------------------------------------------------------------- /depends_s/packages/native_ccache.mk: -------------------------------------------------------------------------------- 1 | package=native_ccache 2 | $(package)_version=3.1.9 3 | $(package)_download_path=http://samba.org/ftp/ccache 4 | $(package)_file_name=ccache-$($(package)_version).tar.bz2 5 | $(package)_sha256_hash=04d3e2e438ac8d4cc4b110b68cdd61bd59226c6588739a4a386869467f5ced7c 6 | 7 | define $(package)_set_vars 8 | $(package)_config_opts= 9 | endef 10 | 11 | define $(package)_config_cmds 12 | $($(package)_autoconf) 13 | endef 14 | 15 | define $(package)_build_cmds 16 | $(MAKE) 17 | endef 18 | 19 | define $(package)_stage_cmds 20 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 21 | endef 22 | 23 | define $(package)_postprocess_cmds 24 | rm -rf lib include 25 | endef 26 | -------------------------------------------------------------------------------- /depends_s/packages/native_cdrkitf.mk: -------------------------------------------------------------------------------- 1 | package=native_cdrkit 2 | $(package)_version=1.1.11 3 | $(package)_download_path=http://distro.ibiblio.org/fatdog/source/600/c 4 | $(package)_file_name=cdrkit-$($(package)_version).tar.bz2 5 | $(package)_sha256_hash=b50d64c214a65b1a79afe3a964c691931a4233e2ba605d793eb85d0ac3652564 6 | $(package)_patches=cdrkit-deterministic.patch 7 | 8 | define $(package)_preprocess_cmds 9 | patch -p1 < $($(package)_patch_dir)/cdrkit-deterministic.patch 10 | endef 11 | 12 | define $(package)_config_cmds 13 | cmake -DCMAKE_INSTALL_PREFIX=$(build_prefix) 14 | endef 15 | 16 | define $(package)_build_cmds 17 | $(MAKE) genisoimage 18 | endef 19 | 20 | define $(package)_stage_cmds 21 | $(MAKE) DESTDIR=$($(package)_staging_dir) -C genisoimage install 22 | endef 23 | 24 | define $(package)_postprocess_cmds 25 | rm bin/isovfy bin/isoinfo bin/isodump bin/isodebug bin/devdump 26 | endef 27 | -------------------------------------------------------------------------------- /depends_s/packages/native_comparisontool.mk: -------------------------------------------------------------------------------- 1 | package=native_comparisontool 2 | $(package)_version=0f7b5d8 3 | $(package)_download_path=https://github.com/TheBlueMatt/test-scripts/raw/38b490a2599d422b12d5ce8f165792f63fd8f54f 4 | $(package)_file_name=pull-tests-$($(package)_version).jar 5 | $(package)_sha256_hash=ecd43b988a8b673b483e4f69f931596360a5e90fc415c75c4c259faa690df198 6 | $(package)_install_dirname=FFFdComparisonTool_jar 7 | $(package)_install_filename=FFFdComparisonTool.jar 8 | 9 | define $(package)_extract_cmds 10 | endef 11 | 12 | define $(package)_configure_cmds 13 | endef 14 | 15 | define $(package)_build_cmds 16 | endef 17 | 18 | define $(package)_stage_cmds 19 | mkdir -p $($(package)_staging_prefix_dir)/share/$($(package)_install_dirname) && \ 20 | cp $($(package)_source) $($(package)_staging_prefix_dir)/share/$($(package)_install_dirname)/$($(package)_install_filename) 21 | endef 22 | -------------------------------------------------------------------------------- /depends_s/packages/native_libdmg-hfsplus.mk: -------------------------------------------------------------------------------- 1 | package=native_libdmg-hfsplus 2 | $(package)_version=0.1 3 | $(package)_download_path=https://github.com/theuni/libdmg-hfsplus/archive 4 | $(package)_file_name=libdmg-hfsplus-v$($(package)_version).tar.gz 5 | $(package)_sha256_hash=6569a02eb31c2827080d7d59001869ea14484c281efab0ae7f2b86af5c3120b3 6 | $(package)_build_subdir=build 7 | 8 | define $(package)_preprocess_cmds 9 | mkdir build 10 | endef 11 | 12 | define $(package)_config_cmds 13 | cmake -DCMAKE_INSTALL_PREFIX:PATH=$(build_prefix)/bin .. 14 | endef 15 | 16 | define $(package)_build_cmds 17 | $(MAKE) -C dmg 18 | endef 19 | 20 | define $(package)_stage_cmds 21 | $(MAKE) DESTDIR=$($(package)_staging_dir) -C dmg install 22 | endef 23 | -------------------------------------------------------------------------------- /depends_s/packages/native_libuuid.mk: -------------------------------------------------------------------------------- 1 | package:=native_libuuid 2 | $(package)_version=1.41.14 3 | $(package)_download_path=http://downloads.sourceforge.net/e2fsprogs 4 | $(package)_file_name=e2fsprogs-libs-$($(package)_version).tar.gz 5 | $(package)_sha256_hash=dbc7a138a3218d9b80a0626b5b692d76934d6746d8cbb762751be33785d8d9f5 6 | 7 | define $(package)_set_vars 8 | $(package)_config_opts=--disable-elf-shlibs --disable-uuidd 9 | $(package)_cflags+=-m32 10 | $(package)_ldflags+=-m32 11 | $(package)_cxxflags+=-m32 12 | endef 13 | 14 | define $(package)_config_cmds 15 | $($(package)_autoconf) 16 | endef 17 | 18 | define $(package)_build_cmds 19 | $(MAKE) -C lib/uuid 20 | endef 21 | 22 | define $(package)_stage_cmds 23 | $(MAKE) DESTDIR=$($(package)_staging_dir) -C lib/uuid install 24 | endef 25 | -------------------------------------------------------------------------------- /depends_s/packages/native_opensslfff.mk: -------------------------------------------------------------------------------- 1 | package=native_openssl 2 | $(package)_version=1.0.1h 3 | $(package)_download_path=https://www.openssl.org/source 4 | $(package)_file_name=openssl-$($(package)_version).tar.gz 5 | $(package)_sha256_hash=9d1c8a9836aa63e2c6adb684186cbd4371c9e9dcc01d6e3bb447abf2d4d3d093 6 | define $(package)_set_vars 7 | $(package)_build_config_opts= --prefix=$(build_prefix) no-zlib no-shared no-krb5C linux-generic32 -m32 8 | endef 9 | 10 | define $(package)_config_cmds 11 | ./Configure $($(package)_build_config_opts) &&\ 12 | sed -i "s|engines apps test|engines|" Makefile 13 | endef 14 | 15 | define $(package)_build_cmds 16 | $(MAKE) -j1 17 | endef 18 | 19 | define $(package)_stage_cmds 20 | $(MAKE) INSTALL_PREFIX=$($(package)_staging_dir) -j1 install_sw 21 | endef 22 | -------------------------------------------------------------------------------- /depends_s/packages/native_protobuff.mk: -------------------------------------------------------------------------------- 1 | package=native_protobuf 2 | $(package)_version=2.5.0 3 | #$(package)_download_path=https://protobuf.googlecode.com/files 4 | $(package)_download_path=https://github.com/google/protobuf/releases/download/v2.5.0 5 | $(package)_file_name=protobuf-$($(package)_version).tar.bz2 6 | $(package)_sha256_hash=13bfc5ae543cf3aa180ac2485c0bc89495e3ae711fc6fab4f8ffe90dfb4bb677 7 | 8 | define $(package)_set_vars 9 | $(package)_config_opts=--disable-shared 10 | endef 11 | 12 | define $(package)_config_cmds 13 | $($(package)_autoconf) 14 | endef 15 | 16 | define $(package)_build_cmds 17 | $(MAKE) -C src protoc 18 | endef 19 | 20 | define $(package)_stage_cmds 21 | $(MAKE) -C src DESTDIR=$($(package)_staging_dir) install-strip 22 | endef 23 | 24 | define $(package)_postprocess_cmds 25 | rm -rf lib include 26 | endef 27 | -------------------------------------------------------------------------------- /depends_s/packages/packages.mk: -------------------------------------------------------------------------------- 1 | packages:=boost openssl 2 | native_packages := native_ccache native_comparisontool 3 | 4 | qt_native_packages = native_protobuf 5 | qt_packages = qrencode protobuf 6 | 7 | qt46_linux_packages = qt46 expat dbus libxcb xcb_proto libXau xproto freetype libX11 xextproto libXext xtrans libICE libSM 8 | qt5_linux_packages= qt expat dbus libxcb xcb_proto libXau xproto freetype fontconfig libX11 xextproto libXext xtrans 9 | 10 | qt_darwin_packages=qt 11 | qt_mingw32_packages=qt 12 | 13 | qt_linux_$(USE_LINUX_STATIC_QT5):=$(qt5_linux_packages) 14 | qt_linux_:=$(qt46_linux_packages) 15 | qt_linux_packages:=$(qt_linux_$(USE_LINUX_STATIC_QT5)) 16 | 17 | wallet_packages=bdb 18 | 19 | upnp_packages=miniupnpc 20 | 21 | ifneq ($(build_os),darwin) 22 | darwin_native_packages=native_libuuid native_openssl native_cctools native_cdrkit native_libdmg-hfsplus 23 | endif 24 | -------------------------------------------------------------------------------- /depends_s/packages/protobuff.mk: -------------------------------------------------------------------------------- 1 | package=protobuf 2 | $(package)_version=$(native_$(package)_version) 3 | $(package)_download_path=$(native_$(package)_download_path) 4 | $(package)_file_name=$(native_$(package)_file_name) 5 | $(package)_sha256_hash=$(native_$(package)_sha256_hash) 6 | $(package)_dependencies=native_$(package) 7 | 8 | define $(package)_set_vars 9 | $(package)_config_opts=--disable-shared --with-protoc=$(build_prefix)/bin/protoc 10 | $(package)_config_opts_linux=--with-pic 11 | endef 12 | 13 | define $(package)_config_cmds 14 | $($(package)_autoconf) 15 | endef 16 | 17 | define $(package)_build_cmds 18 | $(MAKE) -C src libprotobuf.la 19 | endef 20 | 21 | define $(package)_stage_cmds 22 | $(MAKE) DESTDIR=$($(package)_staging_dir) -C src install-libLTLIBRARIES install-nobase_includeHEADERS &&\ 23 | $(MAKE) DESTDIR=$($(package)_staging_dir) install-pkgconfigDATA 24 | endef 25 | 26 | define $(package)_postprocess_cmds 27 | rm lib/libprotoc.a 28 | endef 29 | -------------------------------------------------------------------------------- /depends_s/packages/qrencode.mk: -------------------------------------------------------------------------------- 1 | package=qrencode 2 | $(package)_version=3.4.3 3 | $(package)_download_path=https://fukuchi.org/works/qrencode/ 4 | $(package)_file_name=qrencode-$(qrencode_version).tar.bz2 5 | $(package)_sha256_hash=dfd71487513c871bad485806bfd1fdb304dedc84d2b01a8fb8e0940b50597a98 6 | 7 | define $(package)_set_vars 8 | $(package)_config_opts=--disable-shared -without-tools --disable-sdltest 9 | $(package)_config_opts_linux=--with-pic 10 | endef 11 | 12 | define $(package)_config_cmds 13 | $($(package)_autoconf) 14 | endef 15 | 16 | define $(package)_build_cmds 17 | $(MAKE) 18 | endef 19 | 20 | define $(package)_stage_cmds 21 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 22 | endef 23 | -------------------------------------------------------------------------------- /depends_s/packages/xcb_protof.mk: -------------------------------------------------------------------------------- 1 | package=xcb_proto 2 | $(package)_version=1.10 3 | $(package)_download_path=http://xcb.freedesktop.org/dist 4 | $(package)_file_name=xcb-proto-$($(package)_version).tar.bz2 5 | $(package)_sha256_hash=7ef40ddd855b750bc597d2a435da21e55e502a0fefa85b274f2c922800baaf05 6 | 7 | define $(package)_set_vars 8 | $(package)_config_opts=--disable-shared 9 | $(package)_config_opts_linux=--with-pic 10 | endef 11 | 12 | define $(package)_config_cmds 13 | $($(package)_autoconf) 14 | endef 15 | 16 | define $(package)_build_cmds 17 | $(MAKE) 18 | endef 19 | 20 | define $(package)_stage_cmds 21 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 22 | endef 23 | 24 | define $(package)_postprocess_cmds 25 | find -name "*.pyc" -delete && \ 26 | find -name "*.pyo" -delete 27 | endef 28 | -------------------------------------------------------------------------------- /depends_s/packages/xextprotof.mk: -------------------------------------------------------------------------------- 1 | package=xextproto 2 | $(package)_version=7.3.0 3 | $(package)_download_path=http://xorg.freedesktop.org/releases/individual/proto 4 | $(package)_file_name=$(package)-$($(package)_version).tar.bz2 5 | $(package)_sha256_hash=f3f4b23ac8db9c3a9e0d8edb591713f3d70ef9c3b175970dd8823dfc92aa5bb0 6 | 7 | define $(package)_set_vars 8 | $(package)_config_opts=--disable-shared 9 | endef 10 | 11 | define $(package)_config_cmds 12 | $($(package)_autoconf) 13 | endef 14 | 15 | define $(package)_build_cmds 16 | $(MAKE) 17 | endef 18 | 19 | define $(package)_stage_cmds 20 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 21 | endef 22 | -------------------------------------------------------------------------------- /depends_s/packages/xprotofff.mk: -------------------------------------------------------------------------------- 1 | package=xproto 2 | $(package)_version=7.0.26 3 | $(package)_download_path=http://xorg.freedesktop.org/releases/individual/proto 4 | $(package)_file_name=$(package)-$($(package)_version).tar.bz2 5 | $(package)_sha256_hash=636162c1759805a5a0114a369dffdeccb8af8c859ef6e1445f26a4e6e046514f 6 | 7 | define $(package)_set_vars 8 | $(package)_config_opts=--disable-shared 9 | endef 10 | 11 | define $(package)_config_cmds 12 | $($(package)_autoconf) 13 | endef 14 | 15 | define $(package)_build_cmds 16 | $(MAKE) 17 | endef 18 | 19 | define $(package)_stage_cmds 20 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 21 | endef 22 | -------------------------------------------------------------------------------- /depends_s/packages/xtransfff.mk: -------------------------------------------------------------------------------- 1 | package=xtrans 2 | $(package)_version=1.3.4 3 | $(package)_download_path=http://xorg.freedesktop.org/releases/individual/lib/ 4 | $(package)_file_name=$(package)-$($(package)_version).tar.bz2 5 | $(package)_sha256_hash=054d4ee3efd52508c753e9f7bc655ef185a29bd2850dd9e2fc2ccc33544f583a 6 | $(package)_dependencies= 7 | 8 | define $(package)_set_vars 9 | $(package)_config_opts_linux=--with-pic --disable-static 10 | endef 11 | 12 | define $(package)_config_cmds 13 | $($(package)_autoconf) 14 | endef 15 | 16 | define $(package)_build_cmds 17 | $(MAKE) 18 | endef 19 | 20 | define $(package)_stage_cmds 21 | $(MAKE) DESTDIR=$($(package)_staging_dir) install 22 | endef 23 | -------------------------------------------------------------------------------- /depends_s/patches/boost/darwin_boost_atomic-1.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/boost/atomic/detail/cas128strong.hpp b/include/boost/atomic/detail/cas128strong.hpp 2 | index 906c13e..dcb4d7d 100644 3 | --- a/include/boost/atomic/detail/cas128strong.hpp 4 | +++ b/include/boost/atomic/detail/cas128strong.hpp 5 | @@ -196,15 +196,17 @@ class base_atomic 6 | 7 | public: 8 | BOOST_DEFAULTED_FUNCTION(base_atomic(void), {}) 9 | - explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0) 10 | + explicit base_atomic(value_type const& v) BOOST_NOEXCEPT 11 | { 12 | + memset(&v_, 0, sizeof(v_)); 13 | memcpy(&v_, &v, sizeof(value_type)); 14 | } 15 | 16 | void 17 | store(value_type const& value, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT 18 | { 19 | - storage_type value_s = 0; 20 | + storage_type value_s; 21 | + memset(&value_s, 0, sizeof(value_s)); 22 | memcpy(&value_s, &value, sizeof(value_type)); 23 | platform_fence_before_store(order); 24 | platform_store128(value_s, &v_); 25 | @@ -247,7 +249,9 @@ class base_atomic 26 | memory_order success_order, 27 | memory_order failure_order) volatile BOOST_NOEXCEPT 28 | { 29 | - storage_type expected_s = 0, desired_s = 0; 30 | + storage_type expected_s, desired_s; 31 | + memset(&expected_s, 0, sizeof(expected_s)); 32 | + memset(&desired_s, 0, sizeof(desired_s)); 33 | memcpy(&expected_s, &expected, sizeof(value_type)); 34 | memcpy(&desired_s, &desired, sizeof(value_type)); 35 | 36 | -------------------------------------------------------------------------------- /depends_s/patches/qt/fix-xcb-include-order.patch: -------------------------------------------------------------------------------- 1 | --- old/qtbase/src/plugins/platforms/xcb/xcb-plugin.pro 2014-07-30 18:17:27.384458441 -0400 2 | +++ new/qtbase/src/plugins/platforms/xcb/xcb-plugin.pro 2014-07-30 18:18:28.620459303 -0400 3 | @@ -101,10 +101,6 @@ 4 | } 5 | } 6 | 7 | -DEFINES += $$QMAKE_DEFINES_XCB 8 | -LIBS += $$QMAKE_LIBS_XCB 9 | -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB 10 | - 11 | CONFIG += qpa/genericunixfontdatabase 12 | 13 | contains(QT_CONFIG, dbus) { 14 | @@ -141,3 +137,7 @@ 15 | INCLUDEPATH += ../../../3rdparty/xkbcommon/xkbcommon/ 16 | } 17 | } 18 | + 19 | +DEFINES += $$QMAKE_DEFINES_XCB 20 | +LIBS += $$QMAKE_LIBS_XCB 21 | +INCLUDEPATH += $$QMAKE_CFLAGS_XCB 22 | -------------------------------------------------------------------------------- /depends_s/patches/qt/mac-qmake.conf: -------------------------------------------------------------------------------- 1 | MAKEFILE_GENERATOR = UNIX 2 | CONFIG += app_bundle incremental global_init_link_order lib_version_first plugin_no_soname absolute_library_soname 3 | QMAKE_INCREMENTAL_STYLE = sublib 4 | include(../common/macx.conf) 5 | include(../common/gcc-base-mac.conf) 6 | include(../common/clang.conf) 7 | include(../common/clang-mac.conf) 8 | QMAKE_MAC_SDK_PATH=$${MAC_SDK_PATH} 9 | QMAKE_XCODE_VERSION=4.3 10 | QMAKE_XCODE_DEVELOPER_PATH=/Developer 11 | QMAKE_MACOSX_DEPLOYMENT_TARGET = $${MAC_MIN_VERSION} 12 | QMAKE_MAC_SDK=macosx 13 | QMAKE_MAC_SDK.macosx.path = $$QMAKE_MAC_SDK_PATH 14 | QMAKE_MAC_SDK.macosx.platform_name = macosx 15 | QMAKE_CFLAGS += -target $${MAC_TARGET} 16 | QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_CFLAGS 17 | QMAKE_CXXFLAGS += $$QMAKE_CFLAGS 18 | QMAKE_LFLAGS += -target $${MAC_TARGET} 19 | QMAKE_AR = $${CROSS_COMPILE}ar cq 20 | QMAKE_RANLIB=$${CROSS_COMPILE}ranlib 21 | QMAKE_LIBTOOL=$${CROSS_COMPILE}libtool 22 | QMAKE_INSTALL_NAME_TOOL=$${CROSS_COMPILE}install_name_tool 23 | load(qt_config) 24 | -------------------------------------------------------------------------------- /depends_s/patches/qt/qt5-tablet-osx.patch: -------------------------------------------------------------------------------- 1 | --- old/qtbase/src/widgets/kernel/qwidgetwindow.cpp 2014-09-05 20:45:18.717570370 -0400 2 | +++ new/qtbase/src/widgets/kernel/qwidgetwindow.cpp 2014-09-05 20:52:38.653576561 -0400 3 | @@ -57,7 +57,7 @@ 4 | Q_WIDGETS_EXPORT extern bool qt_tab_all_widgets(); 5 | 6 | QWidget *qt_button_down = 0; // widget got last button-down 7 | -static QWidget *qt_tablet_target = 0; 8 | +static QPointer qt_tablet_target = 0; 9 | 10 | // popup control 11 | QWidget *qt_popup_down = 0; // popup that contains the pressed widget 12 | @@ -96,8 +96,6 @@ 13 | 14 | QWidgetWindow::~QWidgetWindow() 15 | { 16 | - if (m_widget == qt_tablet_target) 17 | - qt_tablet_target = 0; 18 | } 19 | 20 | #ifndef QT_NO_ACCESSIBILITY 21 | -------------------------------------------------------------------------------- /depends_s/patches/qt46/stlfix.patch: -------------------------------------------------------------------------------- 1 | --- old/config.tests/unix/stl/stltest.cpp 2011-06-23 03:45:23.000000000 -0400 2 | +++ new/config.tests/unix/stl/stltest.cpp 2014-08-28 00:54:04.154837604 -0400 3 | @@ -49,6 +49,7 @@ 4 | #include 5 | #include 6 | #include 7 | +#include 8 | 9 | // something mean to see if the compiler and C++ standard lib are good enough 10 | template 11 | -------------------------------------------------------------------------------- /fffcore-cli-resf.rc: -------------------------------------------------------------------------------- 1 | #include // needed for VERSIONINFO 2 | #include "clientversion.h" // holds the needed client version information 3 | 4 | #define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_REVISION,CLIENT_VERSION_BUILD 5 | #define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD) 6 | #define VER_FILEVERSION VER_PRODUCTVERSION 7 | #define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR 8 | 9 | VS_VERSION_INFO VERSIONINFO 10 | FILEVERSION VER_FILEVERSION 11 | PRODUCTVERSION VER_PRODUCTVERSION 12 | FILEOS VOS_NT_WINDOWS32 13 | FILETYPE VFT_APP 14 | BEGIN 15 | BLOCK "StringFileInfo" 16 | BEGIN 17 | BLOCK "" // U.S. English - multilingual (hex) 18 | BEGIN 19 | VALUE "CompanyName", "FFF" 20 | VALUE "FileDescription", "FFF-cli (OSS RPC client for FFF)" 21 | VALUE "FileVersion", VER_FILEVERSION_STR 22 | VALUE "InternalName", "FFF-cli" 23 | VALUE "LegalCopyright", COPYRIGHT_STR 24 | VALUE "LegalTrademarks1", "Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." 25 | VALUE "OriginalFilename", "FFF-cli.exe" 26 | VALUE "ProductName", "FFF-cli" 27 | VALUE "ProductVersion", VER_PRODUCTVERSION_STR 28 | END 29 | END 30 | 31 | BLOCK "VarFileInfo" 32 | BEGIN 33 | VALUE "Translation", 0x0, 1252 // language neutral - multilingual (decimal) 34 | END 35 | END 36 | -------------------------------------------------------------------------------- /fffcored-res.rc: -------------------------------------------------------------------------------- 1 | #include // needed for VERSIONINFO 2 | #include "clientversion.h" // holds the needed client version information 3 | 4 | #define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_REVISION,CLIENT_VERSION_BUILD 5 | #define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD) 6 | #define VER_FILEVERSION VER_PRODUCTVERSION 7 | #define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR 8 | 9 | VS_VERSION_INFO VERSIONINFO 10 | FILEVERSION VER_FILEVERSION 11 | PRODUCTVERSION VER_PRODUCTVERSION 12 | FILEOS VOS_NT_WINDOWS32 13 | FILETYPE VFT_APP 14 | BEGIN 15 | BLOCK "StringFileInfo" 16 | BEGIN 17 | BLOCK "040904E4" // U.S. English - multilingual (hex) 18 | BEGIN 19 | VALUE "CompanyName", "FFF" 20 | VALUE "FileDescription", "FFFd (OSS daemon/client for FFF)" 21 | VALUE "FileVersion", VER_FILEVERSION_STR 22 | VALUE "InternalName", "FFFd" 23 | VALUE "LegalCopyright", COPYRIGHT_STR 24 | VALUE "LegalTrademarks1", "Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." 25 | VALUE "OriginalFilename", "FFFd.exe" 26 | VALUE "ProductName", "FFFd" 27 | VALUE "ProductVersion", VER_PRODUCTVERSION_STR 28 | END 29 | END 30 | 31 | BLOCK "VarFileInfo" 32 | BEGIN 33 | VALUE "Translation", 0x0, 1252 // language neutral - multilingual (decimal) 34 | END 35 | END 36 | -------------------------------------------------------------------------------- /filters/filtercallback_cold.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #include "filters/filtercallback.h" 5 | 6 | #ifdef WIN32 7 | void FilterCallback::UbjCallback(const char *, Blob_t*, Blob_t*) 8 | { 9 | } 10 | #else 11 | void FilterCallback::JspCallback(std::string, json_spirit::Array, json_spirit::Value &) 12 | { 13 | } 14 | #endif // WIN32 15 | 16 | void FilterCallback::CreateCallbackLog(std::string, json_spirit::Array, json_spirit::Value) 17 | { 18 | } 19 | 20 | void FilterCallback::CreateCallbackLogError(std::string, json_spirit::Array, json_spirit::Object &) 21 | { 22 | } 23 | 24 | void FilterCallback::CreateCallbackLogError(std::string, json_spirit::Array, std::exception &) 25 | { 26 | } 27 | -------------------------------------------------------------------------------- /filters/ifiltercallbackf.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef IFILTERCALLBACK_H 5 | #define IFILTERCALLBACK_H 6 | 7 | #include 8 | 9 | #ifndef WIN32 10 | #include "json/json_spirit.h" 11 | #else 12 | #include "v8_win/v8_win.h" 13 | #endif // WIN32 14 | 15 | /** 16 | * Interface for platform-dependent filter callback API functions. 17 | */ 18 | class IFilterCallback 19 | { 20 | public: 21 | #ifdef WIN32 22 | /** 23 | * Callback using UBJSON to pass arguments and a return value. 24 | * 25 | * @param name The name of the API function to invoke. 26 | * @param argsBlob The UBJSON content of the function arguments. 27 | * @param resultBlob The UBJSON content of the function return value. 28 | */ 29 | virtual void UbjCallback(const char *name, Blob_t* argsBlob, Blob_t* resultBlob) = 0; 30 | #else 31 | /** 32 | * Callback using json_spirit to pass arguments and a return value. 33 | * 34 | * @param name The name of the API function to invoke. 35 | * @param args The function arguments. 36 | * @param result The function return value. 37 | */ 38 | virtual void JspCallback(std::string name, json_spirit::Array args, json_spirit::Value &result) = 0; 39 | #endif // WIN32 40 | 41 | virtual ~IFilterCallback() 42 | { 43 | } 44 | }; // class IFilterCallback 45 | 46 | #endif // IFILTERCALLBACK_H 47 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /json/json_spirit_ubjson.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef JSON_SPIRIT_UBJSON_H 5 | #define JSON_SPIRIT_UBJSON_H 6 | 7 | #include "json/json_spirit_utils.h" 8 | #include "json/json_spirit_value.h" 9 | #include "FFF_Core/FFF_Core.h" 10 | 11 | using namespace std; 12 | using namespace json_spirit; 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | int ubjson_write(Value json_value,mc_Script *lpScript,int max_depth); 19 | Value ubjson_read(const unsigned char *elem,size_t elem_size,int max_depth,int *err); 20 | 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif /* JSON_SPIRIT_UBJSON_H */ 27 | 28 | -------------------------------------------------------------------------------- /json/json_spirit_valuef.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 | -------------------------------------------------------------------------------- /json/licensef.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 | -------------------------------------------------------------------------------- /keys/enckeyf.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef ENCKEY_H 5 | #define ENCKEY_H 6 | 7 | #include "utils/serialize.h" 8 | #include "utils/util.h" 9 | 10 | #define MC_ECF_EKEY_PURPOSE_GENERAL 0x00000000 11 | #define MC_ECF_EKEY_PURPOSE_LICENSE 0x00000001 12 | 13 | #define MC_ECF_ASYMMETRIC_NONE 0x00000000 14 | #define MC_ECF_ASYMMETRIC_ENCRYPTION_RSA_2048_DER 0x00000001 15 | #define MC_ECF_ASYMMETRIC_ENCRYPTION_RSA_2048_PEM 0x00000002 16 | 17 | class CEncryptionKey 18 | { 19 | public: 20 | uint32_t m_Type; 21 | uint32_t m_Purpose; 22 | std::vector m_PrivateKey; 23 | std::vector m_PublicKey; 24 | std::vector m_Details; 25 | 26 | public: 27 | CEncryptionKey() 28 | { 29 | m_Type=MC_ECF_ASYMMETRIC_NONE; 30 | m_Purpose=MC_ECF_EKEY_PURPOSE_GENERAL; 31 | m_PrivateKey.clear(); 32 | m_PublicKey.clear(); 33 | m_Details.clear(); 34 | } 35 | bool Generate(uint32_t type); 36 | 37 | ADD_SERIALIZE_METHODS; 38 | 39 | template 40 | inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { 41 | READWRITE(m_Type); 42 | READWRITE(m_Purpose); 43 | READWRITE(m_PrivateKey); 44 | READWRITE(m_PublicKey); 45 | READWRITE(m_Details); 46 | } 47 | 48 | 49 | }; 50 | 51 | 52 | #endif /* ENCKEY_H */ 53 | 54 | -------------------------------------------------------------------------------- /leveldb/.gitignore: -------------------------------------------------------------------------------- 1 | build_config.mk 2 | *.a 3 | *.o 4 | *.dylib* 5 | *.so 6 | *.so.* 7 | *_test 8 | db_bench 9 | leveldbutil 10 | Release 11 | Debug 12 | Benchmark 13 | vs2010.* 14 | -------------------------------------------------------------------------------- /leveldb/authorsfff: -------------------------------------------------------------------------------- 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 | 10 | # Partial list of contributors: 11 | Kevin Regan 12 | Johan Bilien 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | class DBImpl; 15 | 16 | // Return a new iterator that converts internal keys (yielded by 17 | // "*internal_iter") that were live at the specified "sequence" number 18 | // into appropriate user keys. 19 | extern Iterator* NewDBIterator( 20 | DBImpl* db, 21 | const Comparator* user_key_comparator, 22 | Iterator* internal_iter, 23 | SequenceNumber sequence, 24 | uint32_t seed); 25 | 26 | } // namespace leveldb 27 | 28 | #endif // STORAGE_LEVELDB_DB_DB_ITER_H_ 29 | -------------------------------------------------------------------------------- /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), length (2 bytes), type (1 byte). 30 | static const int kHeaderSize = 4 + 2 + 1; 31 | 32 | } // namespace log 33 | } // namespace leveldb 34 | 35 | #endif // STORAGE_LEVELDB_DB_LOG_FORMAT_H_ 36 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /leveldb/db/version_edit_testf.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 | -------------------------------------------------------------------------------- /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 sequence number for the start of this batch. 25 | static SequenceNumber Sequence(const WriteBatch* batch); 26 | 27 | // Store the specified number as the sequence 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 | -------------------------------------------------------------------------------- /leveldb/doc/docf.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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /leveldb/include/leveldb/dumpfile.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 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_INCLUDE_DUMPFILE_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 7 | 8 | #include 9 | #include "leveldb/env.h" 10 | #include "leveldb/status.h" 11 | 12 | namespace leveldb { 13 | 14 | // Dump the contents of the file named by fname in text format to 15 | // *dst. Makes a sequence of dst->Append() calls; each call is passed 16 | // the newline-terminated text corresponding to a single item found 17 | // in the file. 18 | // 19 | // Returns a non-OK result if fname does not name a leveldb storage 20 | // file, or if the file cannot be read. 21 | Status DumpFile(Env* env, const std::string& fname, WritableFile* dst); 22 | 23 | } // namespace leveldb 24 | 25 | #endif // STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 26 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /leveldb/port/port_posixf.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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /leveldb/port/thread_annotationsf.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 | #define STORAGE_LEVELDB_PORT_THREAD_ANNOTATIONS_H_ 7 | 8 | // Some environments provide custom macros to aid in static thread-safety 9 | // analysis. Provide empty definitions of such macros unless they are already 10 | // defined. 11 | 12 | #ifndef EXCLUSIVE_LOCKS_REQUIRED 13 | #define EXCLUSIVE_LOCKS_REQUIRED(...) 14 | #endif 15 | 16 | #ifndef SHARED_LOCKS_REQUIRED 17 | #define SHARED_LOCKS_REQUIRED(...) 18 | #endif 19 | 20 | #ifndef LOCKS_EXCLUDED 21 | #define LOCKS_EXCLUDED(...) 22 | #endif 23 | 24 | #ifndef LOCK_RETURNED 25 | #define LOCK_RETURNED(x) 26 | #endif 27 | 28 | #ifndef LOCKABLE 29 | #define LOCKABLE 30 | #endif 31 | 32 | #ifndef SCOPED_LOCKABLE 33 | #define SCOPED_LOCKABLE 34 | #endif 35 | 36 | #ifndef EXCLUSIVE_LOCK_FUNCTION 37 | #define EXCLUSIVE_LOCK_FUNCTION(...) 38 | #endif 39 | 40 | #ifndef SHARED_LOCK_FUNCTION 41 | #define SHARED_LOCK_FUNCTION(...) 42 | #endif 43 | 44 | #ifndef EXCLUSIVE_TRYLOCK_FUNCTION 45 | #define EXCLUSIVE_TRYLOCK_FUNCTION(...) 46 | #endif 47 | 48 | #ifndef SHARED_TRYLOCK_FUNCTION 49 | #define SHARED_TRYLOCK_FUNCTION(...) 50 | #endif 51 | 52 | #ifndef UNLOCK_FUNCTION 53 | #define UNLOCK_FUNCTION(...) 54 | #endif 55 | 56 | #ifndef NO_THREAD_SAFETY_ANALYSIS 57 | #define NO_THREAD_SAFETY_ANALYSIS 58 | #endif 59 | 60 | #endif // STORAGE_LEVELDB_PORT_THREAD_ANNOTATIONS_H_ 61 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /leveldb/table/two_level_iteratorf.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 | -------------------------------------------------------------------------------- /leveldb/todof: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /leveldb/util/crc2c.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 | -------------------------------------------------------------------------------- /leveldb/util/filter_policyfff.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 | -------------------------------------------------------------------------------- /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 | // The FALLTHROUGH_INTENDED macro can be used to annotate implicit fall-through 10 | // between switch labels. The real definition should be provided externally. 11 | // This one is a fallback version for unsupported compilers. 12 | #ifndef FALLTHROUGH_INTENDED 13 | #define FALLTHROUGH_INTENDED do { } while (0) 14 | #endif 15 | 16 | namespace leveldb { 17 | 18 | uint32_t Hash(const char* data, size_t n, uint32_t seed) { 19 | // Similar to murmur hash 20 | const uint32_t m = 0xc6a4a793; 21 | const uint32_t r = 24; 22 | const char* limit = data + n; 23 | uint32_t h = seed ^ (n * m); 24 | 25 | // Pick up four bytes at a time 26 | while (data + 4 <= limit) { 27 | uint32_t w = DecodeFixed32(data); 28 | data += 4; 29 | h += w; 30 | h *= m; 31 | h ^= (h >> 16); 32 | } 33 | 34 | // Pick up remaining bytes 35 | switch (limit - data) { 36 | case 3: 37 | h += static_cast(data[2]) << 16; 38 | FALLTHROUGH_INTENDED; 39 | case 2: 40 | h += static_cast(data[1]) << 8; 41 | FALLTHROUGH_INTENDED; 42 | case 1: 43 | h += static_cast(data[0]); 44 | h *= m; 45 | h ^= (h >> r); 46 | break; 47 | } 48 | return h; 49 | } 50 | 51 | 52 | } // namespace leveldb 53 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | // Parse a human-readable number from "*in" into *value. On success, 36 | // advances "*in" past the consumed number and sets "*val" to the 37 | // numeric value. Otherwise, returns false and leaves *in in an 38 | // unspecified state. 39 | extern bool ConsumeDecimalNumber(Slice* in, uint64_t* val); 40 | 41 | } // namespace leveldb 42 | 43 | #endif // STORAGE_LEVELDB_UTIL_LOGGING_H_ 44 | -------------------------------------------------------------------------------- /leveldb/util/mutexlockfff.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 | -------------------------------------------------------------------------------- /leveldb/util/optionsf.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 | -------------------------------------------------------------------------------- /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 | size_t 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 | -------------------------------------------------------------------------------- /makefile.qttest.include: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS += qt/test/test_FFF-qt 2 | TESTS += qt/test/test_FFF-qt 3 | 4 | TEST_QT_MOC_CPP = qt/test/moc_uritests.cpp 5 | 6 | if ENABLE_WALLET 7 | TEST_QT_MOC_CPP += qt/test/moc_paymentservertests.cpp 8 | endif 9 | 10 | TEST_QT_H = \ 11 | qt/test/uritests.h \ 12 | qt/test/paymentrequestdata.h \ 13 | qt/test/paymentservertests.h 14 | 15 | qt_test_test_FFF_qt_CPPFLAGS = $(FFF_INCLUDES) $(FFF_QT_INCLUDES) \ 16 | $(QT_INCLUDES) $(QT_TEST_INCLUDES) $(PROTOBUF_CFLAGS) 17 | 18 | qt_test_test_FFF_qt_SOURCES = \ 19 | qt/test/test_main.cpp \ 20 | qt/test/uritests.cpp \ 21 | $(TEST_QT_H) 22 | if ENABLE_WALLET 23 | qt_test_test_FFF_qt_SOURCES += \ 24 | qt/test/paymentservertests.cpp 25 | endif 26 | 27 | nodist_qt_test_test_FFF_qt_SOURCES = $(TEST_QT_MOC_CPP) 28 | 29 | qt_test_test_FFF_qt_LDADD = $(LIBFFFQT) $(LIBFFF_SERVER) 30 | if ENABLE_WALLET 31 | qt_test_test_FFF_qt_LDADD += $(LIBFFF_WALLET) 32 | endif 33 | qt_test_test_FFF_qt_LDADD += $(LIBFFF_CLI) $(LIBFFF_COMMON) $(LIBFFF_UTIL) $(LIBFFF_CRYPTO) $(LIBFFF_UNIVALUE) $(LIBLEVELDB) \ 34 | $(LIBMEMENV) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \ 35 | $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) 36 | qt_test_test_FFF_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) 37 | 38 | CLEAN_FFF_QT_TEST = $(TEST_QT_MOC_CPP) qt/test/*.gcda qt/test/*.gcno 39 | 40 | CLEANFILES += $(CLEAN_FFF_QT_TEST) 41 | 42 | test_FFF_qt : qt/test/test_FFF-qt$(EXEEXT) 43 | 44 | test_FFF_qt_check : qt/test/test_FFF-qt$(EXEEXT) FORCE 45 | $(MAKE) check-TESTS TESTS=$^ 46 | 47 | test_FFF_qt_clean: FORCE 48 | rm -f $(CLEAN_FFF_QT_TEST) $(qt_test_test_FFF_qt_OBJECTS) 49 | -------------------------------------------------------------------------------- /multichain/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | LocalizedResourceName=@chain,0 3 | -------------------------------------------------------------------------------- /multichain/fffcoref.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef FFF_Core_H 5 | #define FFF_Core_H 6 | 7 | 8 | #include "utils/define.h" 9 | #include "utils/declare.h" 10 | 11 | #include "chainparams/chainparams.h" 12 | #include "protocol/FFF_Corescript.h" 13 | #include "permissions/permission.h" 14 | #include "entities/asset.h" 15 | #include "chainparams/state.h" 16 | 17 | 18 | extern unsigned int MIN_RELAY_TX_FEE; 19 | extern unsigned int MIN_OFFCHAIN_FEE; 20 | 21 | 22 | #endif /* FFF_Core_H */ 23 | 24 | -------------------------------------------------------------------------------- /obj/f.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /src/chain/checkpointsf.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2014 The FFF developers 2 | // Original code was distributed under the MIT software license. 3 | // Copyright (c) 2014-2019 Coin Sciences Ltd 4 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 5 | 6 | #ifndef FFF_CHECKPOINTS_H 7 | #define FFF_CHECKPOINTS_H 8 | 9 | #include "structs/uint256.h" 10 | 11 | #include 12 | 13 | class CBlockIndex; 14 | 15 | /** 16 | * Block-chain checkpoints are compiled-in sanity checks. 17 | * They are updated every release or three. 18 | */ 19 | namespace Checkpoints 20 | { 21 | typedef std::map MapCheckpoints; 22 | 23 | struct CCheckpointData { 24 | const MapCheckpoints *mapCheckpoints; 25 | int64_t nTimeLastCheckpoint; 26 | int64_t nTransactionsLastCheckpoint; 27 | double fTransactionsPerDay; 28 | }; 29 | 30 | //! Returns true if block passes checkpoint checks 31 | bool CheckBlock(int nHeight, const uint256& hash); 32 | 33 | //! Return conservative estimate of total number of blocks, 0 if unknown 34 | int GetTotalBlocksEstimate(); 35 | 36 | //! Returns last CBlockIndex* in mapBlockIndex that is a checkpoint 37 | CBlockIndex* GetLastCheckpoint(); 38 | 39 | double GuessVerificationProgress(CBlockIndex* pindex, bool fSigchecks = true); 40 | 41 | extern bool fEnabled; 42 | 43 | } //namespace Checkpoints 44 | 45 | #endif // FFF_CHECKPOINTS_H 46 | -------------------------------------------------------------------------------- /src/chain/pow.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto 2 | // Copyright (c) 2009-2014 The FFF developers 3 | // Original code was distributed under the MIT/X11 software license. 4 | // Copyright (c) 2014-2019 Coin Sciences Ltd 5 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 6 | 7 | #ifndef FFF_POW_H 8 | #define FFF_POW_H 9 | 10 | #include 11 | 12 | class CBlockHeader; 13 | class CBlockIndex; 14 | class uint256; 15 | 16 | unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock); 17 | 18 | /** Check whether a block hash satisfies the proof-of-work requirement specified by nBits */ 19 | bool CheckProofOfWork(uint256 hash, unsigned int nBits, bool fNoErrorInLog = false); 20 | uint256 GetBlockProof(const CBlockIndex& block); 21 | 22 | #endif // FFF_POW_H 23 | -------------------------------------------------------------------------------- /src/cli-resf.rc: -------------------------------------------------------------------------------- 1 | #include // needed for VERSIONINFO 2 | #include "version/clientversion.h" // holds the needed client version information 3 | 4 | #define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_REVISION,CLIENT_VERSION_BUILD 5 | #define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD) 6 | #define VER_FILEVERSION VER_PRODUCTVERSION 7 | #define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR 8 | 9 | VS_VERSION_INFO VERSIONINFO 10 | FILEVERSION VER_FILEVERSION 11 | PRODUCTVERSION VER_PRODUCTVERSION 12 | FILEOS VOS_NT_WINDOWS32 13 | FILETYPE VFT_APP 14 | BEGIN 15 | BLOCK "StringFileInfo" 16 | BEGIN 17 | BLOCK "040904E4" // U.S. English - multilingual (hex) 18 | BEGIN 19 | VALUE "CompanyName", "Coin Sciences Ltd" 20 | VALUE "FileDescription", "FFF_Core-cli (OSS RPC client for FFF_Core)" 21 | VALUE "FileVersion", WIN_VERSION_STR 22 | VALUE "InternalName", "FFF_Core-cli" 23 | VALUE "LegalCopyright", COPYRIGHT_STR 24 | VALUE "LegalTrademarks1", "The software product under this license is provided free of charge. Full terms are shown at: http://www.FFF_Core.com/terms-of-service/." 25 | VALUE "OriginalFilename", "FFF_Core-cli.exe" 26 | VALUE "ProductName", "FFF_Core-cli" 27 | VALUE "ProductVersion", WIN_VERSION_STR 28 | END 29 | END 30 | 31 | BLOCK "VarFileInfo" 32 | BEGIN 33 | VALUE "Translation", 0x0, 1252 // language neutral - multilingual (decimal) 34 | END 35 | END 36 | -------------------------------------------------------------------------------- /src/compat/glibc_compatf.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | // Copyright (c) 2014-2019 Coin Sciences Ltd 5 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 6 | 7 | #if defined(HAVE_CONFIG_H) 8 | #include "config/FFF-config.h" 9 | #endif 10 | 11 | #include 12 | 13 | #if defined(HAVE_SYS_SELECT_H) 14 | #include 15 | #endif 16 | 17 | // Prior to GLIBC_2.14, memcpy was aliased to memmove. 18 | extern "C" void* memmove(void* a, const void* b, size_t c); 19 | extern "C" void* memcpy(void* a, const void* b, size_t c) 20 | { 21 | return memmove(a, b, c); 22 | } 23 | 24 | extern "C" void __chk_fail(void) __attribute__((__noreturn__)); 25 | extern "C" FDELT_TYPE __fdelt_warn(FDELT_TYPE a) 26 | { 27 | if (a >= FD_SETSIZE) 28 | __chk_fail(); 29 | return a / __NFDBITS; 30 | } 31 | extern "C" FDELT_TYPE __fdelt_chk(FDELT_TYPE) __attribute__((weak, alias("__fdelt_warn"))); 32 | -------------------------------------------------------------------------------- /src/compat/sanity.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | // Copyright (c) 2014-2019 Coin Sciences Ltd 5 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 6 | 7 | #ifndef FFF_COMPAT_SANITY_H 8 | #define FFF_COMPAT_SANITY_H 9 | 10 | bool glibc_sanity_test(); 11 | bool glibcxx_sanity_test(); 12 | 13 | #endif // FFF_COMPAT_SANITY_H 14 | -------------------------------------------------------------------------------- /src/compat/strnlen.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | // Copyright (c) 2014-2019 Coin Sciences Ltd 5 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 6 | 7 | #if defined(HAVE_CONFIG_H) 8 | #include "config/FFF-config.h" 9 | #endif 10 | 11 | #include 12 | 13 | #if HAVE_DECL_STRNLEN == 0 14 | size_t strnlen( const char *start, size_t max_len) 15 | { 16 | const char *end = (const char *)memchr(start, '\0', max_len); 17 | 18 | return end ? (size_t)(end - start) : max_len; 19 | } 20 | #endif // HAVE_DECL_STRNLEN 21 | -------------------------------------------------------------------------------- /src/config/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fff-source/FFF_Protocol_Core/f7284c0b6024bdfb8decb2f9c78065e98d03094a/src/config/.empty -------------------------------------------------------------------------------- /src/crypto/hmac_sha256f.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #include "crypto/hmac_sha256.h" 6 | 7 | #include 8 | 9 | CHMAC_SHA256::CHMAC_SHA256(const unsigned char* key, size_t keylen) 10 | { 11 | unsigned char rkey[64]; 12 | if (keylen <= 64) { 13 | memcpy(rkey, key, keylen); 14 | memset(rkey + keylen, 0, 64 - keylen); 15 | } else { 16 | CSHA256().Write(key, keylen).Finalize(rkey); 17 | memset(rkey + 32, 0, 32); 18 | } 19 | 20 | for (int n = 0; n < 64; n++) 21 | rkey[n] ^= 0x5c; 22 | outer.Write(rkey, 64); 23 | 24 | for (int n = 0; n < 64; n++) 25 | rkey[n] ^= 0x5c ^ 0x36; 26 | inner.Write(rkey, 64); 27 | } 28 | 29 | void CHMAC_SHA256::Finalize(unsigned char hash[OUTPUT_SIZE]) 30 | { 31 | unsigned char temp[32]; 32 | inner.Finalize(temp); 33 | outer.Write(temp, 32).Finalize(hash); 34 | } 35 | -------------------------------------------------------------------------------- /src/crypto/hmac_sha256f.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef FFF_CRYPTO_HMAC_SHA256_H 6 | #define FFF_CRYPTO_HMAC_SHA256_H 7 | 8 | #include "crypto/sha256.h" 9 | 10 | #include 11 | #include 12 | 13 | /** A hasher class for HMAC-SHA-512. */ 14 | class CHMAC_SHA256 15 | { 16 | private: 17 | CSHA256 outer; 18 | CSHA256 inner; 19 | 20 | public: 21 | static const size_t OUTPUT_SIZE = 32; 22 | 23 | CHMAC_SHA256(const unsigned char* key, size_t keylen); 24 | CHMAC_SHA256& Write(const unsigned char* data, size_t len) 25 | { 26 | inner.Write(data, len); 27 | return *this; 28 | } 29 | void Finalize(unsigned char hash[OUTPUT_SIZE]); 30 | }; 31 | 32 | #endif // FFF_CRYPTO_HMAC_SHA256_H 33 | -------------------------------------------------------------------------------- /src/crypto/hmac_sha512f.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #include "crypto/hmac_sha512.h" 6 | 7 | #include 8 | 9 | CHMAC_SHA512::CHMAC_SHA512(const unsigned char* key, size_t keylen) 10 | { 11 | unsigned char rkey[128]; 12 | if (keylen <= 128) { 13 | memcpy(rkey, key, keylen); 14 | memset(rkey + keylen, 0, 128 - keylen); 15 | } else { 16 | CSHA512().Write(key, keylen).Finalize(rkey); 17 | memset(rkey + 64, 0, 64); 18 | } 19 | 20 | for (int n = 0; n < 128; n++) 21 | rkey[n] ^= 0x5c; 22 | outer.Write(rkey, 128); 23 | 24 | for (int n = 0; n < 128; n++) 25 | rkey[n] ^= 0x5c ^ 0x36; 26 | inner.Write(rkey, 128); 27 | } 28 | 29 | void CHMAC_SHA512::Finalize(unsigned char hash[OUTPUT_SIZE]) 30 | { 31 | unsigned char temp[64]; 32 | inner.Finalize(temp); 33 | outer.Write(temp, 64).Finalize(hash); 34 | } 35 | -------------------------------------------------------------------------------- /src/crypto/hmac_sha512fff.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef FFF_CRYPTO_HMAC_SHA512_H 6 | #define FFF_CRYPTO_HMAC_SHA512_H 7 | 8 | #include "crypto/sha512.h" 9 | 10 | #include 11 | #include 12 | 13 | /** A hasher class for HMAC-SHA-512. */ 14 | class CHMAC_SHA512 15 | { 16 | private: 17 | CSHA512 outer; 18 | CSHA512 inner; 19 | 20 | public: 21 | static const size_t OUTPUT_SIZE = 64; 22 | 23 | CHMAC_SHA512(const unsigned char* key, size_t keylen); 24 | CHMAC_SHA512& Write(const unsigned char* data, size_t len) 25 | { 26 | inner.Write(data, len); 27 | return *this; 28 | } 29 | void Finalize(unsigned char hash[OUTPUT_SIZE]); 30 | }; 31 | 32 | #endif // FFF_CRYPTO_HMAC_SHA512_H 33 | -------------------------------------------------------------------------------- /src/crypto/rfc6979_hmac_sha256.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef FFF_RFC6979_HMAC_SHA256_H 6 | #define FFF_RFC6979_HMAC_SHA256_H 7 | 8 | #include "crypto/hmac_sha256.h" 9 | 10 | #include 11 | #include 12 | 13 | /** The RFC 6979 PRNG using HMAC-SHA256. */ 14 | class RFC6979_HMAC_SHA256 15 | { 16 | private: 17 | unsigned char V[CHMAC_SHA256::OUTPUT_SIZE]; 18 | unsigned char K[CHMAC_SHA256::OUTPUT_SIZE]; 19 | bool retry; 20 | 21 | public: 22 | /** 23 | * Construct a new RFC6979 PRNG, using the given key and message. 24 | * The message is assumed to be already hashed. 25 | */ 26 | RFC6979_HMAC_SHA256(const unsigned char* key, size_t keylen, const unsigned char* msg, size_t msglen); 27 | 28 | /** 29 | * Generate a byte array. 30 | */ 31 | void Generate(unsigned char* output, size_t outputlen); 32 | 33 | ~RFC6979_HMAC_SHA256(); 34 | }; 35 | 36 | #endif // FFF_RFC6979_HMAC_SHA256_H 37 | -------------------------------------------------------------------------------- /src/crypto/ripemd160.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef FFF_CRYPTO_RIPEMD160_H 6 | #define FFF_CRYPTO_RIPEMD160_H 7 | 8 | #include 9 | #include 10 | 11 | /** A hasher class for RIPEMD-160. */ 12 | class CRIPEMD160 13 | { 14 | private: 15 | uint32_t s[5]; 16 | unsigned char buf[64]; 17 | size_t bytes; 18 | 19 | public: 20 | static const size_t OUTPUT_SIZE = 20; 21 | 22 | CRIPEMD160(); 23 | CRIPEMD160& Write(const unsigned char* data, size_t len); 24 | void Finalize(unsigned char hash[OUTPUT_SIZE]); 25 | CRIPEMD160& Reset(); 26 | }; 27 | 28 | #endif // FFF_CRYPTO_RIPEMD160_H 29 | -------------------------------------------------------------------------------- /src/crypto/sha1.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef FFF_CRYPTO_SHA1_H 6 | #define FFF_CRYPTO_SHA1_H 7 | 8 | #include 9 | #include 10 | 11 | /** A hasher class for SHA1. */ 12 | class CSHA1 13 | { 14 | private: 15 | uint32_t s[5]; 16 | unsigned char buf[64]; 17 | size_t bytes; 18 | 19 | public: 20 | static const size_t OUTPUT_SIZE = 20; 21 | 22 | CSHA1(); 23 | CSHA1& Write(const unsigned char* data, size_t len); 24 | void Finalize(unsigned char hash[OUTPUT_SIZE]); 25 | CSHA1& Reset(); 26 | }; 27 | 28 | #endif // FFF_CRYPTO_SHA1_H 29 | -------------------------------------------------------------------------------- /src/crypto/sha256fff.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef FFF_CRYPTO_SHA256_H 6 | #define FFF_CRYPTO_SHA256_H 7 | 8 | #include 9 | #include 10 | 11 | /** A hasher class for SHA-256. */ 12 | class CSHA256 13 | { 14 | private: 15 | uint32_t s[8]; 16 | unsigned char buf[64]; 17 | size_t bytes; 18 | 19 | public: 20 | static const size_t OUTPUT_SIZE = 32; 21 | 22 | CSHA256(); 23 | CSHA256& Write(const unsigned char* data, size_t len); 24 | void Finalize(unsigned char hash[OUTPUT_SIZE]); 25 | CSHA256& Reset(); 26 | }; 27 | 28 | #endif // FFF_CRYPTO_SHA256_H 29 | -------------------------------------------------------------------------------- /src/crypto/sha512f.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The FFF developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef FFF_CRYPTO_SHA512_H 6 | #define FFF_CRYPTO_SHA512_H 7 | 8 | #include 9 | #include 10 | 11 | /** A hasher class for SHA-512. */ 12 | class CSHA512 13 | { 14 | private: 15 | uint64_t s[8]; 16 | unsigned char buf[128]; 17 | size_t bytes; 18 | 19 | public: 20 | static const size_t OUTPUT_SIZE = 64; 21 | 22 | CSHA512(); 23 | CSHA512& Write(const unsigned char* data, size_t len); 24 | void Finalize(unsigned char hash[OUTPUT_SIZE]); 25 | CSHA512& Reset(); 26 | }; 27 | 28 | #endif // FFF_CRYPTO_SHA512_H 29 | -------------------------------------------------------------------------------- /src/custom/custom.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #include "core/main.h" 5 | #include "utils/util.h" 6 | #include "utils/utilparse.h" 7 | #include "FFF_Core/FFF_Core.h" 8 | #include "structs/base58.h" 9 | #include "version/version.h" 10 | 11 | 12 | 13 | #ifndef CUSTOM_H 14 | #define CUSTOM_H 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | int custom_version_info(int version); 21 | bool custom_good_for_coin_selection(const CScript& script); 22 | bool custom_accept_transacton(const CTransaction& tx, 23 | const CCoinsViewCache &inputs, 24 | int offset, 25 | bool accept, 26 | std::string& reason, 27 | uint32_t *replay); 28 | 29 | void custom_set_runtime_defaults(int exe_type); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif /* CUSTOM_H */ 36 | 37 | -------------------------------------------------------------------------------- /src/custom/custom_fffcoref.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #include "FFF_Core/FFF_Core.h" 5 | 6 | void* custom_get_blockchain_default(const char *param,int* size,void *param_in) 7 | { 8 | *size=0; 9 | 10 | return NULL; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/custom/custom_serverf.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #include "custom/custom.h" 5 | 6 | using namespace std; 7 | 8 | bool custom_good_for_coin_selection(const CScript& script) 9 | { 10 | return true; 11 | } 12 | 13 | bool custom_accept_transacton(const CTransaction& tx, 14 | const CCoinsViewCache &inputs, 15 | int offset, 16 | bool accept, 17 | string& reason, 18 | uint32_t *replay) 19 | { 20 | return true; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/custom/customf.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #include "custom/custom.h" 5 | 6 | using namespace std; 7 | 8 | int custom_version_info(int version) 9 | { 10 | return 0; 11 | } 12 | 13 | void custom_set_runtime_defaults(int exe_type) 14 | { 15 | 16 | } 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/entmakefilef.am: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/fffcore-cli-resf.rc: -------------------------------------------------------------------------------- 1 | #include // needed for VERSIONINFO 2 | #include "clientversion.h" // holds the needed client version information 3 | 4 | #define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_REVISION,CLIENT_VERSION_BUILD 5 | #define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD) 6 | #define VER_FILEVERSION VER_PRODUCTVERSION 7 | #define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR 8 | 9 | VS_VERSION_INFO VERSIONINFO 10 | FILEVERSION VER_FILEVERSION 11 | PRODUCTVERSION VER_PRODUCTVERSION 12 | FILEOS VOS_NT_WINDOWS32 13 | FILETYPE VFT_APP 14 | BEGIN 15 | BLOCK "StringFileInfo" 16 | BEGIN 17 | BLOCK "" // U.S. English - multilingual (hex) 18 | BEGIN 19 | VALUE "CompanyName", "FFF" 20 | VALUE "FileDescription", "FFF-cli (OSS RPC client for FFF)" 21 | VALUE "FileVersion", VER_FILEVERSION_STR 22 | VALUE "InternalName", "FFF-cli" 23 | VALUE "LegalCopyright", COPYRIGHT_STR 24 | VALUE "LegalTrademarks1", "Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." 25 | VALUE "OriginalFilename", "FFF-cli.exe" 26 | VALUE "ProductName", "FFF-cli" 27 | VALUE "ProductVersion", VER_PRODUCTVERSION_STR 28 | END 29 | END 30 | 31 | BLOCK "VarFileInfo" 32 | BEGIN 33 | VALUE "Translation", 0x0, 1252 // language neutral - multilingual (decimal) 34 | END 35 | END 36 | -------------------------------------------------------------------------------- /src/fffcored-res.rc: -------------------------------------------------------------------------------- 1 | #include // needed for VERSIONINFO 2 | #include "clientversion.h" // holds the needed client version information 3 | 4 | #define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_REVISION,CLIENT_VERSION_BUILD 5 | #define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD) 6 | #define VER_FILEVERSION VER_PRODUCTVERSION 7 | #define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR 8 | 9 | VS_VERSION_INFO VERSIONINFO 10 | FILEVERSION VER_FILEVERSION 11 | PRODUCTVERSION VER_PRODUCTVERSION 12 | FILEOS VOS_NT_WINDOWS32 13 | FILETYPE VFT_APP 14 | BEGIN 15 | BLOCK "StringFileInfo" 16 | BEGIN 17 | BLOCK "040904E4" // U.S. English - multilingual (hex) 18 | BEGIN 19 | VALUE "CompanyName", "FFF" 20 | VALUE "FileDescription", "FFFd (OSS daemon/client for FFF)" 21 | VALUE "FileVersion", VER_FILEVERSION_STR 22 | VALUE "InternalName", "FFFd" 23 | VALUE "LegalCopyright", COPYRIGHT_STR 24 | VALUE "LegalTrademarks1", "Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." 25 | VALUE "OriginalFilename", "FFFd.exe" 26 | VALUE "ProductName", "FFFd" 27 | VALUE "ProductVersion", VER_PRODUCTVERSION_STR 28 | END 29 | END 30 | 31 | BLOCK "VarFileInfo" 32 | BEGIN 33 | VALUE "Translation", 0x0, 1252 // language neutral - multilingual (decimal) 34 | END 35 | END 36 | -------------------------------------------------------------------------------- /src/filters/filtercallback_coldfff.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #include "filters/filtercallback.h" 5 | 6 | #ifdef WIN32 7 | void FilterCallback::UbjCallback(const char *, Blob_t*, Blob_t*) 8 | { 9 | } 10 | #else 11 | void FilterCallback::JspCallback(std::string, json_spirit::Array, json_spirit::Value &) 12 | { 13 | } 14 | #endif // WIN32 15 | 16 | void FilterCallback::CreateCallbackLog(std::string, json_spirit::Array, json_spirit::Value) 17 | { 18 | } 19 | 20 | void FilterCallback::CreateCallbackLogError(std::string, json_spirit::Array, json_spirit::Object &) 21 | { 22 | } 23 | 24 | void FilterCallback::CreateCallbackLogError(std::string, json_spirit::Array, std::exception &) 25 | { 26 | } 27 | -------------------------------------------------------------------------------- /src/filters/ifiltercallbackf.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef IFILTERCALLBACK_H 5 | #define IFILTERCALLBACK_H 6 | 7 | #include 8 | 9 | #ifndef WIN32 10 | #include "json/json_spirit.h" 11 | #else 12 | #include "v8_win/v8_win.h" 13 | #endif // WIN32 14 | 15 | /** 16 | * Interface for platform-dependent filter callback API functions. 17 | */ 18 | class IFilterCallback 19 | { 20 | public: 21 | #ifdef WIN32 22 | /** 23 | * Callback using UBJSON to pass arguments and a return value. 24 | * 25 | * @param name The name of the API function to invoke. 26 | * @param argsBlob The UBJSON content of the function arguments. 27 | * @param resultBlob The UBJSON content of the function return value. 28 | */ 29 | virtual void UbjCallback(const char *name, Blob_t* argsBlob, Blob_t* resultBlob) = 0; 30 | #else 31 | /** 32 | * Callback using json_spirit to pass arguments and a return value. 33 | * 34 | * @param name The name of the API function to invoke. 35 | * @param args The function arguments. 36 | * @param result The function return value. 37 | */ 38 | virtual void JspCallback(std::string name, json_spirit::Array args, json_spirit::Value &result) = 0; 39 | #endif // WIN32 40 | 41 | virtual ~IFilterCallback() 42 | { 43 | } 44 | }; // class IFilterCallback 45 | 46 | #endif // IFILTERCALLBACK_H 47 | -------------------------------------------------------------------------------- /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_ubjson.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef JSON_SPIRIT_UBJSON_H 5 | #define JSON_SPIRIT_UBJSON_H 6 | 7 | #include "json/json_spirit_utils.h" 8 | #include "json/json_spirit_value.h" 9 | #include "FFF_Core/FFF_Core.h" 10 | 11 | using namespace std; 12 | using namespace json_spirit; 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | int ubjson_write(Value json_value,mc_Script *lpScript,int max_depth); 19 | Value ubjson_read(const unsigned char *elem,size_t elem_size,int max_depth,int *err); 20 | 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif /* JSON_SPIRIT_UBJSON_H */ 27 | 28 | -------------------------------------------------------------------------------- /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_spiritfff.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/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/keys/enckeyfff.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef ENCKEY_H 5 | #define ENCKEY_H 6 | 7 | #include "utils/serialize.h" 8 | #include "utils/util.h" 9 | 10 | #define MC_ECF_EKEY_PURPOSE_GENERAL 0x00000000 11 | #define MC_ECF_EKEY_PURPOSE_LICENSE 0x00000001 12 | 13 | #define MC_ECF_ASYMMETRIC_NONE 0x00000000 14 | #define MC_ECF_ASYMMETRIC_ENCRYPTION_RSA_2048_DER 0x00000001 15 | #define MC_ECF_ASYMMETRIC_ENCRYPTION_RSA_2048_PEM 0x00000002 16 | 17 | class CEncryptionKey 18 | { 19 | public: 20 | uint32_t m_Type; 21 | uint32_t m_Purpose; 22 | std::vector m_PrivateKey; 23 | std::vector m_PublicKey; 24 | std::vector m_Details; 25 | 26 | public: 27 | CEncryptionKey() 28 | { 29 | m_Type=MC_ECF_ASYMMETRIC_NONE; 30 | m_Purpose=MC_ECF_EKEY_PURPOSE_GENERAL; 31 | m_PrivateKey.clear(); 32 | m_PublicKey.clear(); 33 | m_Details.clear(); 34 | } 35 | bool Generate(uint32_t type); 36 | 37 | ADD_SERIALIZE_METHODS; 38 | 39 | template 40 | inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { 41 | READWRITE(m_Type); 42 | READWRITE(m_Purpose); 43 | READWRITE(m_PrivateKey); 44 | READWRITE(m_PublicKey); 45 | READWRITE(m_Details); 46 | } 47 | 48 | 49 | }; 50 | 51 | 52 | #endif /* ENCKEY_H */ 53 | 54 | -------------------------------------------------------------------------------- /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 | 10 | # Partial list of contributors: 11 | Kevin Regan 12 | Johan Bilien 13 | -------------------------------------------------------------------------------- /src/leveldb/db/builderf.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 | class DBImpl; 15 | 16 | // Return a new iterator that converts internal keys (yielded by 17 | // "*internal_iter") that were live at the specified "sequence" number 18 | // into appropriate user keys. 19 | extern Iterator* NewDBIterator( 20 | DBImpl* db, 21 | const Comparator* user_key_comparator, 22 | Iterator* internal_iter, 23 | SequenceNumber sequence, 24 | uint32_t seed); 25 | 26 | } // namespace leveldb 27 | 28 | #endif // STORAGE_LEVELDB_DB_DB_ITER_H_ 29 | -------------------------------------------------------------------------------- /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), length (2 bytes), type (1 byte). 30 | static const int kHeaderSize = 4 + 2 + 1; 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_internalfff.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 sequence number for the start of this batch. 25 | static SequenceNumber Sequence(const WriteBatch* batch); 26 | 27 | // Store the specified number as the sequence 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/fff.gitignore: -------------------------------------------------------------------------------- 1 | build_config.mk 2 | *.a 3 | *.o 4 | *.dylib* 5 | *.so 6 | *.so.* 7 | *_test 8 | db_bench 9 | leveldbutil 10 | Release 11 | Debug 12 | Benchmark 13 | vs2010.* 14 | -------------------------------------------------------------------------------- /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/include/leveldb/dumpfilef.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 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_INCLUDE_DUMPFILE_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 7 | 8 | #include 9 | #include "leveldb/env.h" 10 | #include "leveldb/status.h" 11 | 12 | namespace leveldb { 13 | 14 | // Dump the contents of the file named by fname in text format to 15 | // *dst. Makes a sequence of dst->Append() calls; each call is passed 16 | // the newline-terminated text corresponding to a single item found 17 | // in the file. 18 | // 19 | // Returns a non-OK result if fname does not name a leveldb storage 20 | // file, or if the file cannot be read. 21 | Status DumpFile(Env* env, const std::string& fname, WritableFile* dst); 22 | 23 | } // namespace leveldb 24 | 25 | #endif // STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 26 | -------------------------------------------------------------------------------- /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/newsf: -------------------------------------------------------------------------------- 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/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/portf.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/readmef: -------------------------------------------------------------------------------- 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/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 | #define STORAGE_LEVELDB_PORT_THREAD_ANNOTATIONS_H_ 7 | 8 | // Some environments provide custom macros to aid in static thread-safety 9 | // analysis. Provide empty definitions of such macros unless they are already 10 | // defined. 11 | 12 | #ifndef EXCLUSIVE_LOCKS_REQUIRED 13 | #define EXCLUSIVE_LOCKS_REQUIRED(...) 14 | #endif 15 | 16 | #ifndef SHARED_LOCKS_REQUIRED 17 | #define SHARED_LOCKS_REQUIRED(...) 18 | #endif 19 | 20 | #ifndef LOCKS_EXCLUDED 21 | #define LOCKS_EXCLUDED(...) 22 | #endif 23 | 24 | #ifndef LOCK_RETURNED 25 | #define LOCK_RETURNED(x) 26 | #endif 27 | 28 | #ifndef LOCKABLE 29 | #define LOCKABLE 30 | #endif 31 | 32 | #ifndef SCOPED_LOCKABLE 33 | #define SCOPED_LOCKABLE 34 | #endif 35 | 36 | #ifndef EXCLUSIVE_LOCK_FUNCTION 37 | #define EXCLUSIVE_LOCK_FUNCTION(...) 38 | #endif 39 | 40 | #ifndef SHARED_LOCK_FUNCTION 41 | #define SHARED_LOCK_FUNCTION(...) 42 | #endif 43 | 44 | #ifndef EXCLUSIVE_TRYLOCK_FUNCTION 45 | #define EXCLUSIVE_TRYLOCK_FUNCTION(...) 46 | #endif 47 | 48 | #ifndef SHARED_TRYLOCK_FUNCTION 49 | #define SHARED_TRYLOCK_FUNCTION(...) 50 | #endif 51 | 52 | #ifndef UNLOCK_FUNCTION 53 | #define UNLOCK_FUNCTION(...) 54 | #endif 55 | 56 | #ifndef NO_THREAD_SAFETY_ANALYSIS 57 | #define NO_THREAD_SAFETY_ANALYSIS 58 | #endif 59 | 60 | #endif // STORAGE_LEVELDB_PORT_THREAD_ANNOTATIONS_H_ 61 | -------------------------------------------------------------------------------- /src/leveldb/port/win/stdintf.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_iteratorf.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/todof: -------------------------------------------------------------------------------- 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/util/crc2c.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_policyfff.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.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/hashf.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 | // The FALLTHROUGH_INTENDED macro can be used to annotate implicit fall-through 10 | // between switch labels. The real definition should be provided externally. 11 | // This one is a fallback version for unsupported compilers. 12 | #ifndef FALLTHROUGH_INTENDED 13 | #define FALLTHROUGH_INTENDED do { } while (0) 14 | #endif 15 | 16 | namespace leveldb { 17 | 18 | uint32_t Hash(const char* data, size_t n, uint32_t seed) { 19 | // Similar to murmur hash 20 | const uint32_t m = 0xc6a4a793; 21 | const uint32_t r = 24; 22 | const char* limit = data + n; 23 | uint32_t h = seed ^ (n * m); 24 | 25 | // Pick up four bytes at a time 26 | while (data + 4 <= limit) { 27 | uint32_t w = DecodeFixed32(data); 28 | data += 4; 29 | h += w; 30 | h *= m; 31 | h ^= (h >> 16); 32 | } 33 | 34 | // Pick up remaining bytes 35 | switch (limit - data) { 36 | case 3: 37 | h += static_cast(data[2]) << 16; 38 | FALLTHROUGH_INTENDED; 39 | case 2: 40 | h += static_cast(data[1]) << 8; 41 | FALLTHROUGH_INTENDED; 42 | case 1: 43 | h += static_cast(data[0]); 44 | h *= m; 45 | h ^= (h >> r); 46 | break; 47 | } 48 | return h; 49 | } 50 | 51 | 52 | } // namespace leveldb 53 | -------------------------------------------------------------------------------- /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/loggingfff.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 | // Parse a human-readable number from "*in" into *value. On success, 36 | // advances "*in" past the consumed number and sets "*val" to the 37 | // numeric value. Otherwise, returns false and leaves *in in an 38 | // unspecified state. 39 | extern bool ConsumeDecimalNumber(Slice* in, uint64_t* val); 40 | 41 | } // namespace leveldb 42 | 43 | #endif // STORAGE_LEVELDB_UTIL_LOGGING_H_ 44 | -------------------------------------------------------------------------------- /src/leveldb/util/mutexlockf.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 | size_t 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/makefile.qttest.include: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS += qt/test/test_FFF-qt 2 | TESTS += qt/test/test_FFF-qt 3 | 4 | TEST_QT_MOC_CPP = qt/test/moc_uritests.cpp 5 | 6 | if ENABLE_WALLET 7 | TEST_QT_MOC_CPP += qt/test/moc_paymentservertests.cpp 8 | endif 9 | 10 | TEST_QT_H = \ 11 | qt/test/uritests.h \ 12 | qt/test/paymentrequestdata.h \ 13 | qt/test/paymentservertests.h 14 | 15 | qt_test_test_FFF_qt_CPPFLAGS = $(FFF_INCLUDES) $(FFF_QT_INCLUDES) \ 16 | $(QT_INCLUDES) $(QT_TEST_INCLUDES) $(PROTOBUF_CFLAGS) 17 | 18 | qt_test_test_FFF_qt_SOURCES = \ 19 | qt/test/test_main.cpp \ 20 | qt/test/uritests.cpp \ 21 | $(TEST_QT_H) 22 | if ENABLE_WALLET 23 | qt_test_test_FFF_qt_SOURCES += \ 24 | qt/test/paymentservertests.cpp 25 | endif 26 | 27 | nodist_qt_test_test_FFF_qt_SOURCES = $(TEST_QT_MOC_CPP) 28 | 29 | qt_test_test_FFF_qt_LDADD = $(LIBFFFQT) $(LIBFFF_SERVER) 30 | if ENABLE_WALLET 31 | qt_test_test_FFF_qt_LDADD += $(LIBFFF_WALLET) 32 | endif 33 | qt_test_test_FFF_qt_LDADD += $(LIBFFF_CLI) $(LIBFFF_COMMON) $(LIBFFF_UTIL) $(LIBFFF_CRYPTO) $(LIBFFF_UNIVALUE) $(LIBLEVELDB) \ 34 | $(LIBMEMENV) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \ 35 | $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) 36 | qt_test_test_FFF_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) 37 | 38 | CLEAN_FFF_QT_TEST = $(TEST_QT_MOC_CPP) qt/test/*.gcda qt/test/*.gcno 39 | 40 | CLEANFILES += $(CLEAN_FFF_QT_TEST) 41 | 42 | test_FFF_qt : qt/test/test_FFF-qt$(EXEEXT) 43 | 44 | test_FFF_qt_check : qt/test/test_FFF-qt$(EXEEXT) FORCE 45 | $(MAKE) check-TESTS TESTS=$^ 46 | 47 | test_FFF_qt_clean: FORCE 48 | rm -f $(CLEAN_FFF_QT_TEST) $(qt_test_test_FFF_qt_OBJECTS) 49 | -------------------------------------------------------------------------------- /src/multichain/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | LocalizedResourceName=chainsrc 3 | -------------------------------------------------------------------------------- /src/multichain/fffcore.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef FFF_Core_H 5 | #define FFF_Core_H 6 | 7 | 8 | #include "utils/define.h" 9 | #include "utils/declare.h" 10 | 11 | #include "chainparams/chainparams.h" 12 | #include "protocol/FFF_Corescript.h" 13 | #include "permissions/permission.h" 14 | #include "entities/asset.h" 15 | #include "chainparams/state.h" 16 | 17 | 18 | extern unsigned int MIN_RELAY_TX_FEE; 19 | extern unsigned int MIN_OFFCHAIN_FEE; 20 | 21 | 22 | #endif /* FFF_Core_H */ 23 | 24 | -------------------------------------------------------------------------------- /src/obj-test/f.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /src/obj/fff.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /src/res.rc: -------------------------------------------------------------------------------- 1 | #include // needed for VERSIONINFO 2 | #include "version/clientversion.h" // holds the needed client version information 3 | 4 | #define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_REVISION,CLIENT_VERSION_BUILD 5 | #define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD) 6 | #define VER_FILEVERSION VER_PRODUCTVERSION 7 | #define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR 8 | 9 | VS_VERSION_INFO VERSIONINFO 10 | FILEVERSION VER_FILEVERSION 11 | PRODUCTVERSION VER_PRODUCTVERSION 12 | FILEOS VOS_NT_WINDOWS32 13 | FILETYPE VFT_APP 14 | BEGIN 15 | BLOCK "StringFileInfo" 16 | BEGIN 17 | BLOCK "040904E4" // U.S. English - multilingual (hex) 18 | BEGIN 19 | VALUE "CompanyName", "Coin Sciences Ltd" 20 | VALUE "FileDescription", "FFF_Cored (OSS daemon/client for FFF_Core)" 21 | VALUE "FileVersion", WIN_VERSION_STR 22 | VALUE "InternalName", "FFF_Cored" 23 | VALUE "LegalCopyright", COPYRIGHT_STR 24 | VALUE "LegalTrademarks1", "The software product under this license is provided free of charge. Full terms are shown at: http://www.FFF_Core.com/terms-of-service/." 25 | VALUE "OriginalFilename", "FFF_Cored.exe" 26 | VALUE "ProductName", "FFF_Cored" 27 | VALUE "ProductVersion", WIN_VERSION_STR 28 | END 29 | END 30 | 31 | BLOCK "VarFileInfo" 32 | BEGIN 33 | VALUE "Translation", 0x0, 1252 // language neutral - multilingual (decimal) 34 | END 35 | END 36 | -------------------------------------------------------------------------------- /src/rpc/rpcclient.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Satoshi Nakamoto 2 | // Copyright (c) 2014-2016 The FFF Core developers 3 | // Original code was distributed under the MIT software license. 4 | // Copyright (c) 2014-2019 Coin Sciences Ltd 5 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 6 | 7 | #ifndef FFF_RPCCLIENT_H 8 | #define FFF_RPCCLIENT_H 9 | 10 | #include "json/json_spirit_reader_template.h" 11 | #include "json/json_spirit_utils.h" 12 | #include "json/json_spirit_writer_template.h" 13 | 14 | json_spirit::Array RPCConvertValues(const std::string& strMethod, const std::vector& strParams); 15 | bool HaveAPIWithThisName(const std::string &strMethod); 16 | 17 | #endif // FFF_RPCCLIENT_H 18 | -------------------------------------------------------------------------------- /src/script/sigcache.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto 2 | // Copyright (c) 2014-2016 The FFF Core developers 3 | // Original code was distributed under the MIT software license. 4 | // Copyright (c) 2014-2019 Coin Sciences Ltd 5 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 6 | 7 | #ifndef FFF_SCRIPT_SIGCACHE_H 8 | #define FFF_SCRIPT_SIGCACHE_H 9 | 10 | #include "script/interpreter.h" 11 | 12 | #include 13 | 14 | class CPubKey; 15 | 16 | class CachingTransactionSignatureChecker : public TransactionSignatureChecker 17 | { 18 | private: 19 | bool store; 20 | 21 | public: 22 | CachingTransactionSignatureChecker(const CTransaction* txToIn, unsigned int nInIn, bool storeIn=true) : TransactionSignatureChecker(txToIn, nInIn), store(storeIn) {} 23 | 24 | bool VerifySignature(const std::vector& vchSig, const CPubKey& vchPubKey, const uint256& sighash) const; 25 | }; 26 | 27 | #endif // FFF_SCRIPT_SIGCACHE_H 28 | -------------------------------------------------------------------------------- /src/script/sign.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto 2 | // Copyright (c) 2014-2016 The FFF Core developers 3 | // Original code was distributed under the MIT software license. 4 | // Copyright (c) 2014-2019 Coin Sciences Ltd 5 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 6 | 7 | #ifndef FFF_SCRIPT_SIGN_H 8 | #define FFF_SCRIPT_SIGN_H 9 | 10 | #include "script/interpreter.h" 11 | 12 | class CKeyStore; 13 | class CScript; 14 | class CTransaction; 15 | 16 | struct CMutableTransaction; 17 | 18 | bool SignSignature(const CKeyStore& keystore, const CScript& fromPubKey, CMutableTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL); 19 | bool SignSignature(const CKeyStore& keystore, const CTransaction& txFrom, CMutableTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL); 20 | 21 | /** 22 | * Given two sets of signatures for scriptPubKey, possibly with OP_0 placeholders, 23 | * combine them intelligently and return the result. 24 | */ 25 | CScript CombineSignatures(const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn, const CScript& scriptSig1, const CScript& scriptSig2); 26 | 27 | #endif // FFF_SCRIPT_SIGN_H 28 | -------------------------------------------------------------------------------- /src/secp256k1/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | autoreconf -if --warnings=all 4 | -------------------------------------------------------------------------------- /src/secp256k1/copying: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Pieter Wuille 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 | -------------------------------------------------------------------------------- /src/secp256k1/f.gitignore: -------------------------------------------------------------------------------- 1 | bench_inv 2 | bench_ecdh 3 | bench_sign 4 | bench_verify 5 | bench_schnorr_verify 6 | bench_recover 7 | bench_internal 8 | tests 9 | gen_context 10 | *.exe 11 | *.so 12 | *.a 13 | !.gitignore 14 | 15 | Makefile 16 | configure 17 | .libs/ 18 | Makefile.in 19 | aclocal.m4 20 | autom4te.cache/ 21 | config.log 22 | config.status 23 | *.tar.gz 24 | *.la 25 | libtool 26 | .deps/ 27 | .dirstamp 28 | #build-aux/ 29 | *.lo 30 | *.o 31 | *~ 32 | src/libsecp256k1-config.h 33 | src/libsecp256k1-config.h.in 34 | src/ecmult_static_context.h 35 | m4/libtool.m4 36 | m4/ltoptions.m4 37 | m4/ltsugar.m4 38 | m4/ltversion.m4 39 | m4/lt~obsolete.m4 40 | src/stamp-h1 41 | libsecp256k1.pc 42 | -------------------------------------------------------------------------------- /src/secp256k1/include/secp256k1_ecdh.h: -------------------------------------------------------------------------------- 1 | #ifndef _SECP256K1_ECDH_ 2 | # define _SECP256K1_ECDH_ 3 | 4 | # include "secp256k1.h" 5 | 6 | # ifdef __cplusplus 7 | extern "C" { 8 | # endif 9 | 10 | /** Compute an EC Diffie-Hellman secret in constant time 11 | * Returns: 1: exponentiation was successful 12 | * 0: scalar was invalid (zero or overflow) 13 | * Args: ctx: pointer to a context object (cannot be NULL) 14 | * Out: result: a 32-byte array which will be populated by an ECDH 15 | * secret computed from the point and scalar 16 | * In: pubkey: a pointer to a secp256k1_pubkey containing an 17 | * initialized public key 18 | * privkey: a 32-byte scalar with which to multiply the point 19 | */ 20 | SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdh( 21 | const secp256k1_context* ctx, 22 | unsigned char *result, 23 | const secp256k1_pubkey *pubkey, 24 | const unsigned char *privkey 25 | ) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); 26 | 27 | # ifdef __cplusplus 28 | } 29 | # endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/secp256k1/libsecp256k1.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libsecp256k1 7 | Description: Optimized C library for EC operations on curve secp256k1 8 | URL: https://github.com/FFF/secp256k1 9 | Version: @PACKAGE_VERSION@ 10 | Cflags: -I${includedir} 11 | Libs.private: @SECP_LIBS@ 12 | Libs: -L${libdir} -lsecp256k1 13 | 14 | -------------------------------------------------------------------------------- /src/secp256k1/obj/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fff-source/FFF_Protocol_Core/f7284c0b6024bdfb8decb2f9c78065e98d03094a/src/secp256k1/obj/.gitignore -------------------------------------------------------------------------------- /src/secp256k1/src/basic-config.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_BASIC_CONFIG_ 8 | #define _SECP256K1_BASIC_CONFIG_ 9 | 10 | #ifdef USE_BASIC_CONFIG 11 | 12 | #undef USE_ASM_X86_64 13 | #undef USE_ENDOMORPHISM 14 | #undef USE_FIELD_10X26 15 | #undef USE_FIELD_5X52 16 | #undef USE_FIELD_INV_BUILTIN 17 | #undef USE_FIELD_INV_NUM 18 | #undef USE_NUM_GMP 19 | #undef USE_NUM_NONE 20 | #undef USE_SCALAR_4X64 21 | #undef USE_SCALAR_8X32 22 | #undef USE_SCALAR_INV_BUILTIN 23 | #undef USE_SCALAR_INV_NUM 24 | 25 | #define USE_NUM_NONE 1 26 | #define USE_FIELD_INV_BUILTIN 1 27 | #define USE_SCALAR_INV_BUILTIN 1 28 | #define USE_FIELD_10X26 1 29 | #define USE_SCALAR_8X32 1 30 | 31 | #endif // USE_BASIC_CONFIG 32 | #endif // _SECP256K1_BASIC_CONFIG_ 33 | -------------------------------------------------------------------------------- /src/secp256k1/src/ecdsaf.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_ECDSA_ 8 | #define _SECP256K1_ECDSA_ 9 | 10 | #include 11 | 12 | #include "scalar.h" 13 | #include "group.h" 14 | #include "ecmult.h" 15 | 16 | static int secp256k1_ecdsa_sig_parse(secp256k1_scalar *r, secp256k1_scalar *s, const unsigned char *sig, size_t size); 17 | static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, size_t *size, const secp256k1_scalar *r, const secp256k1_scalar *s); 18 | static int secp256k1_ecdsa_sig_verify(const secp256k1_ecmult_context *ctx, const secp256k1_scalar* r, const secp256k1_scalar* s, const secp256k1_ge *pubkey, const secp256k1_scalar *message); 19 | static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, secp256k1_scalar* r, secp256k1_scalar* s, const secp256k1_scalar *seckey, const secp256k1_scalar *message, const secp256k1_scalar *nonce, int *recid); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/secp256k1/src/eckey.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_ECKEY_ 8 | #define _SECP256K1_ECKEY_ 9 | 10 | #include 11 | 12 | #include "group.h" 13 | #include "scalar.h" 14 | #include "ecmult.h" 15 | #include "ecmult_gen.h" 16 | 17 | static int secp256k1_eckey_pubkey_parse(secp256k1_ge *elem, const unsigned char *pub, size_t size); 18 | static int secp256k1_eckey_pubkey_serialize(secp256k1_ge *elem, unsigned char *pub, size_t *size, int compressed); 19 | 20 | static int secp256k1_eckey_privkey_tweak_add(secp256k1_scalar *key, const secp256k1_scalar *tweak); 21 | static int secp256k1_eckey_pubkey_tweak_add(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak); 22 | static int secp256k1_eckey_privkey_tweak_mul(secp256k1_scalar *key, const secp256k1_scalar *tweak); 23 | static int secp256k1_eckey_pubkey_tweak_mul(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/secp256k1/src/ecmult_constf.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2015 Andrew Poelstra * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_ECMULT_CONST_ 8 | #define _SECP256K1_ECMULT_CONST_ 9 | 10 | #include "scalar.h" 11 | #include "group.h" 12 | 13 | static void secp256k1_ecmult_const(secp256k1_gej *r, const secp256k1_ge *a, const secp256k1_scalar *q); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/secp256k1/src/ecmultf.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_ECMULT_ 8 | #define _SECP256K1_ECMULT_ 9 | 10 | #include "num.h" 11 | #include "group.h" 12 | 13 | typedef struct { 14 | /* For accelerating the computation of a*P + b*G: */ 15 | secp256k1_ge_storage (*pre_g)[]; /* odd multiples of the generator */ 16 | #ifdef USE_ENDOMORPHISM 17 | secp256k1_ge_storage (*pre_g_128)[]; /* odd multiples of 2^128*generator */ 18 | #endif 19 | } secp256k1_ecmult_context; 20 | 21 | static void secp256k1_ecmult_context_init(secp256k1_ecmult_context *ctx); 22 | static void secp256k1_ecmult_context_build(secp256k1_ecmult_context *ctx, const secp256k1_callback *cb); 23 | static void secp256k1_ecmult_context_clone(secp256k1_ecmult_context *dst, 24 | const secp256k1_ecmult_context *src, const secp256k1_callback *cb); 25 | static void secp256k1_ecmult_context_clear(secp256k1_ecmult_context *ctx); 26 | static int secp256k1_ecmult_context_is_built(const secp256k1_ecmult_context *ctx); 27 | 28 | /** Double multiply: R = na*A + ng*G */ 29 | static void secp256k1_ecmult(const secp256k1_ecmult_context *ctx, secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/secp256k1/src/java/org/bitcoin/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | LocalizedResourceName=fff_code 3 | -------------------------------------------------------------------------------- /src/secp256k1/src/java/org_fffcore_nativesecp256k1f.c: -------------------------------------------------------------------------------- 1 | #include "org_FFF_NativeSecp256k1.h" 2 | #include "include/secp256k1.h" 3 | 4 | JNIEXPORT jint JNICALL Java_org_FFF_NativeSecp256k1_secp256k1_1ecdsa_1verify 5 | (JNIEnv* env, jclass classObject, jobject byteBufferObject) 6 | { 7 | unsigned char* data = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); 8 | int sigLen = *((int*)(data + 32)); 9 | int pubLen = *((int*)(data + 32 + 4)); 10 | 11 | return secp256k1_ecdsa_verify(data, 32, data+32+8, sigLen, data+32+8+sigLen, pubLen); 12 | } 13 | 14 | static void __javasecp256k1_attach(void) __attribute__((constructor)); 15 | static void __javasecp256k1_detach(void) __attribute__((destructor)); 16 | 17 | static void __javasecp256k1_attach(void) { 18 | secp256k1_start(SECP256K1_START_VERIFY); 19 | } 20 | 21 | static void __javasecp256k1_detach(void) { 22 | secp256k1_stop(); 23 | } 24 | -------------------------------------------------------------------------------- /src/secp256k1/src/java/org_fffcore_nativesecp256k1f.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_FFF_NativeSecp256k1 */ 4 | 5 | #ifndef _Included_org_FFF_NativeSecp256k1 6 | #define _Included_org_FFF_NativeSecp256k1 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_FFF_NativeSecp256k1 12 | * Method: secp256k1_ecdsa_verify 13 | * Signature: (Ljava/nio/ByteBuffer;)I 14 | */ 15 | JNIEXPORT jint JNICALL Java_org_FFF_NativeSecp256k1_secp256k1_1ecdsa_1verify 16 | (JNIEnv *, jclass, jobject); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /src/secp256k1/src/modules/ecdh/makefile.amf.include: -------------------------------------------------------------------------------- 1 | include_HEADERS += include/secp256k1_ecdh.h 2 | noinst_HEADERS += src/modules/ecdh/main_impl.h 3 | noinst_HEADERS += src/modules/ecdh/tests_impl.h 4 | if USE_BENCHMARK 5 | noinst_PROGRAMS += bench_ecdh 6 | bench_ecdh_SOURCES = src/bench_ecdh.c 7 | bench_ecdh_LDADD = libsecp256k1.la $(SECP_LIBS) 8 | endif 9 | -------------------------------------------------------------------------------- /src/secp256k1/src/modules/recovery/makefile.am.include: -------------------------------------------------------------------------------- 1 | include_HEADERS += include/secp256k1_recovery.h 2 | noinst_HEADERS += src/modules/recovery/main_impl.h 3 | noinst_HEADERS += src/modules/recovery/tests_impl.h 4 | if USE_BENCHMARK 5 | noinst_PROGRAMS += bench_recover 6 | bench_recover_SOURCES = src/bench_recover.c 7 | bench_recover_LDADD = libsecp256k1.la $(SECP_LIBS) 8 | endif 9 | -------------------------------------------------------------------------------- /src/secp256k1/src/modules/schnorr/makefile.amf.include: -------------------------------------------------------------------------------- 1 | include_HEADERS += include/secp256k1_schnorr.h 2 | noinst_HEADERS += src/modules/schnorr/main_impl.h 3 | noinst_HEADERS += src/modules/schnorr/schnorr.h 4 | noinst_HEADERS += src/modules/schnorr/schnorr_impl.h 5 | noinst_HEADERS += src/modules/schnorr/tests_impl.h 6 | if USE_BENCHMARK 7 | noinst_PROGRAMS += bench_schnorr_verify 8 | bench_schnorr_verify_SOURCES = src/bench_schnorr_verify.c 9 | bench_schnorr_verify_LDADD = libsecp256k1.la $(SECP_LIBS) 10 | endif 11 | -------------------------------------------------------------------------------- /src/secp256k1/src/modules/schnorr/schnorrfff.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Copyright (c) 2014-2015 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php. * 5 | ***********************************************************************/ 6 | 7 | #ifndef _SECP256K1_MODULE_SCHNORR_H_ 8 | #define _SECP256K1_MODULE_SCHNORR_H_ 9 | 10 | #include "scalar.h" 11 | #include "group.h" 12 | 13 | typedef void (*secp256k1_schnorr_msghash)(unsigned char *h32, const unsigned char *r32, const unsigned char *msg32); 14 | 15 | static int secp256k1_schnorr_sig_sign(const secp256k1_ecmult_gen_context* ctx, unsigned char *sig64, const secp256k1_scalar *key, const secp256k1_scalar *nonce, const secp256k1_ge *pubnonce, secp256k1_schnorr_msghash hash, const unsigned char *msg32); 16 | static int secp256k1_schnorr_sig_verify(const secp256k1_ecmult_context* ctx, const unsigned char *sig64, const secp256k1_ge *pubkey, secp256k1_schnorr_msghash hash, const unsigned char *msg32); 17 | static int secp256k1_schnorr_sig_recover(const secp256k1_ecmult_context* ctx, const unsigned char *sig64, secp256k1_ge *pubkey, secp256k1_schnorr_msghash hash, const unsigned char *msg32); 18 | static int secp256k1_schnorr_sig_combine(unsigned char *sig64, size_t n, const unsigned char * const *sig64ins); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/secp256k1/src/num_gmpf.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_NUM_REPR_ 8 | #define _SECP256K1_NUM_REPR_ 9 | 10 | #include 11 | 12 | #define NUM_LIMBS ((256+GMP_NUMB_BITS-1)/GMP_NUMB_BITS) 13 | 14 | typedef struct { 15 | mp_limb_t data[2*NUM_LIMBS]; 16 | int neg; 17 | int limbs; 18 | } secp256k1_num; 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/secp256k1/src/num_implfff.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_NUM_IMPL_H_ 8 | #define _SECP256K1_NUM_IMPL_H_ 9 | 10 | #if defined HAVE_CONFIG_H 11 | #include "libsecp256k1-config.h" 12 | #endif 13 | 14 | #include "num.h" 15 | 16 | #if defined(USE_NUM_GMP) 17 | #include "num_gmp_impl.h" 18 | #elif defined(USE_NUM_NONE) 19 | /* Nothing. */ 20 | #else 21 | #error "Please select num implementation" 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/secp256k1/src/scalar_4x64.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_SCALAR_REPR_ 8 | #define _SECP256K1_SCALAR_REPR_ 9 | 10 | #include 11 | 12 | /** A scalar modulo the group order of the secp256k1 curve. */ 13 | typedef struct { 14 | uint64_t d[4]; 15 | } secp256k1_scalar; 16 | 17 | #define SECP256K1_SCALAR_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{((uint64_t)(d1)) << 32 | (d0), ((uint64_t)(d3)) << 32 | (d2), ((uint64_t)(d5)) << 32 | (d4), ((uint64_t)(d7)) << 32 | (d6)}} 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/secp256k1/src/scalar_8x2fff.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_SCALAR_REPR_ 8 | #define _SECP256K1_SCALAR_REPR_ 9 | 10 | #include 11 | 12 | /** A scalar modulo the group order of the secp256k1 curve. */ 13 | typedef struct { 14 | uint32_t d[8]; 15 | } secp256k1_scalar; 16 | 17 | #define SECP256K1_SCALAR_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)}} 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/secp256k1/src/testrandfff.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * Copyright (c) 2013, 2014 Pieter Wuille * 3 | * Distributed under the MIT software license, see the accompanying * 4 | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* 5 | **********************************************************************/ 6 | 7 | #ifndef _SECP256K1_TESTRAND_H_ 8 | #define _SECP256K1_TESTRAND_H_ 9 | 10 | #if defined HAVE_CONFIG_H 11 | #include "libsecp256k1-config.h" 12 | #endif 13 | 14 | /* A non-cryptographic RNG used only for test infrastructure. */ 15 | 16 | /** Seed the pseudorandom number generator for testing. */ 17 | SECP256K1_INLINE static void secp256k1_rand_seed(const unsigned char *seed16); 18 | 19 | /** Generate a pseudorandom number in the range [0..2**32-1]. */ 20 | static uint32_t secp256k1_rand32(void); 21 | 22 | /** Generate a pseudorandom number in the range [0..2**bits-1]. Bits must be 1 or 23 | * more. */ 24 | static uint32_t secp256k1_rand_bits(int bits); 25 | 26 | /** Generate a pseudorandom number in the range [0..range-1]. */ 27 | static uint32_t secp256k1_rand_int(uint32_t range); 28 | 29 | /** Generate a pseudorandom 32-byte array. */ 30 | static void secp256k1_rand256(unsigned char *b32); 31 | 32 | /** Generate a pseudorandom 32-byte array with long sequences of zero and one bits. */ 33 | static void secp256k1_rand256_test(unsigned char *b32); 34 | 35 | /** Generate pseudorandom bytes with long sequences of zero and one bits. */ 36 | static void secp256k1_rand_bytes_test(unsigned char *bytes, size_t len); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/secp256k1/todo: -------------------------------------------------------------------------------- 1 | * Unit tests for fieldelem/groupelem, including ones intended to 2 | trigger fieldelem's boundary cases. 3 | * Complete constant-time operations for signing/keygen 4 | -------------------------------------------------------------------------------- /src/structs/amountf.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) www.fff.network 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #include "structs/amount.h" 5 | 6 | #include "utils/tinyformat.h" 7 | 8 | CFeeRate::CFeeRate(const CAmount& nFeePaid, size_t nSize) 9 | { 10 | if (nSize > 0) 11 | nSatoshisPerK = nFeePaid*1000/nSize; 12 | else 13 | nSatoshisPerK = 0; 14 | } 15 | 16 | CAmount CFeeRate::GetFee(size_t nSize) const 17 | { 18 | CAmount nFee = nSatoshisPerK*nSize / 1000; 19 | 20 | if (nFee == 0 && nSatoshisPerK > 0) 21 | nFee = nSatoshisPerK; 22 | 23 | return nFee; 24 | } 25 | 26 | std::string CFeeRate::ToString() const 27 | { 28 | /* MCHN START */ 29 | if(COIN == 0) 30 | { 31 | return strprintf("%d.%08d BTC/kB", nSatoshisPerK, nSatoshisPerK); 32 | } 33 | /* MCHN END */ 34 | return strprintf("%d.%08d BTC/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN); 35 | } 36 | -------------------------------------------------------------------------------- /src/ui/nouif.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The FFF developers 2 | // Original code was distributed under the MIT/X11 software license. 3 | // Copyright (c) 2014-2019 Coin Sciences Ltd 4 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 5 | 6 | #ifndef FFF_NOUI_H 7 | #define FFF_NOUI_H 8 | 9 | extern void noui_connect(); 10 | 11 | #endif // FFF_NOUI_H 12 | -------------------------------------------------------------------------------- /src/utils/core_io.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2014 The FFF developers 2 | // Original code was distributed under the MIT/X11 software license. 3 | // Copyright (c) 2014-2019 Coin Sciences Ltd 4 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 5 | 6 | #ifndef FFF_CORE_IO_H 7 | #define FFF_CORE_IO_H 8 | 9 | #include 10 | #include 11 | 12 | class CBlock; 13 | class CScript; 14 | class CTransaction; 15 | class uint256; 16 | class UniValue; 17 | 18 | // core_read.cpp 19 | extern CScript ParseScript(std::string s); 20 | extern bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx); 21 | extern bool DecodeHexBlk(CBlock&, const std::string& strHexBlk); 22 | extern uint256 ParseHashUV(const UniValue& v, const std::string& strName); 23 | extern uint256 ParseHashStr(const std::string&, const std::string& strName); 24 | extern std::vector ParseHexUV(const UniValue& v, const std::string& strName); 25 | 26 | // core_write.cpp 27 | extern std::string FormatScript(const CScript& script); 28 | extern std::string EncodeHexTx(const CTransaction& tx); 29 | extern void ScriptPubKeyToUniv(const CScript& scriptPubKey, 30 | UniValue& out, bool fIncludeHex); 31 | extern void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry); 32 | 33 | #endif // FFF_CORE_IO_H 34 | -------------------------------------------------------------------------------- /src/utils/utilmoneystr.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) www.fff.network 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | /** 5 | * Money parsing/formatting utilities. 6 | */ 7 | #ifndef FFF_UTILMONEYSTR_H 8 | #define FFF_UTILMONEYSTR_H 9 | 10 | #include 11 | #include 12 | 13 | #include "structs/amount.h" 14 | 15 | std::string FormatMoney(const CAmount& n, bool fPlus=false); 16 | bool ParseMoney(const std::string& str, CAmount& nRet); 17 | bool ParseMoney(const char* pszIn, CAmount& nRet); 18 | 19 | #endif // FFF_UTILMONEYSTR_H 20 | -------------------------------------------------------------------------------- /src/utils/utiltimef.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) www.fff.network 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef FFF_UTILTIME_H 5 | #define FFF_UTILTIME_H 6 | 7 | #include 8 | #include 9 | 10 | int64_t GetTime(); 11 | int64_t GetTimeMillis(); 12 | int64_t GetTimeMicros(); 13 | void SetMockTime(int64_t nMockTimeIn); 14 | void MilliSleep(int64_t n); 15 | 16 | std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime); 17 | 18 | #endif // FFF_UTILTIME_H 19 | -------------------------------------------------------------------------------- /src/v8/callbacksf.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef FFF_Core_CALLBACKS_H_ 5 | #define FFF_Core_CALLBACKS_H_ 6 | 7 | #include 8 | #include 9 | 10 | namespace mc_v8 11 | { 12 | extern std::map callbackLookup; 13 | std::string callbackFixedName(std::string name); 14 | } // namespace mc_v8 15 | 16 | #endif /* FFF_Core_CALLBACKS_H_ */ 17 | -------------------------------------------------------------------------------- /src/v8/fixturef.js: -------------------------------------------------------------------------------- 1 | Math.random = function(){ 2 | return 0; 3 | }; 4 | 5 | Date.now = function() { 6 | return 0; 7 | }; 8 | 9 | var bind = Function.bind; 10 | var unbind = bind.bind(bind); 11 | 12 | function instantiate(constructor, args) { 13 | return new (unbind(constructor, null).apply(null, args)); 14 | } 15 | 16 | Date = function (Date) { 17 | var names = Object.getOwnPropertyNames(Date); 18 | for (var i = 0; i < names.length; i++) { 19 | // Skip props already in the MyDate object 20 | if (names[i] in MyDate) continue; 21 | var desc = Object.getOwnPropertyDescriptor(Date, names[i]); 22 | Object.defineProperty(MyDate, names[i], desc); 23 | } 24 | 25 | return MyDate; 26 | 27 | function MyDate() { 28 | if (arguments.length == 0) { 29 | arguments = [0]; 30 | } 31 | return instantiate(Date, arguments); 32 | } 33 | }(Date); 34 | -------------------------------------------------------------------------------- /src/v8/v8blobfff.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #include "v8blob.h" 5 | #include 6 | 7 | namespace mc_v8 8 | { 9 | BlobPtr Blob::Instance(std::string name) 10 | { 11 | auto it = m_instances.find(name); 12 | if (it == m_instances.end()) 13 | { 14 | it = m_instances.insert(std::make_pair(name, std::make_shared())).first; 15 | } 16 | return it->second; 17 | } 18 | 19 | Blob::~Blob() 20 | { 21 | if (m_buffer != nullptr) 22 | { 23 | delete[] m_buffer; 24 | } 25 | } 26 | 27 | void Blob::Reset() 28 | { 29 | m_size = 0; 30 | } 31 | 32 | void Blob::Set(void *data, size_t size) 33 | { 34 | this->Reset(); 35 | this->Append(data, size); 36 | } 37 | 38 | void Blob::Append(void *data, size_t size) 39 | { 40 | this->Resize(size); 41 | std::memcpy(m_buffer + m_size, data, size); 42 | m_size += size; 43 | } 44 | 45 | void Blob::Remove(std::string name) 46 | { 47 | m_instances.erase(name); 48 | } 49 | 50 | void Blob::Resize(size_t add_size) 51 | { 52 | if (m_size + add_size > m_allocated) 53 | { 54 | size_t new_size = ((m_size + add_size - 1) / size_increment + 1) * size_increment; 55 | auto new_buffer = new unsigned char[new_size]; 56 | if (m_allocated > 0) 57 | { 58 | std::memcpy(new_buffer, m_buffer, m_allocated); 59 | delete[] m_buffer; 60 | } 61 | m_buffer = new_buffer; 62 | m_allocated = new_size; 63 | } 64 | } 65 | 66 | std::map Blob::m_instances; 67 | } // namespace mc_v8 68 | -------------------------------------------------------------------------------- /src/v8/v8blobfff.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef V8BLOB_H 5 | #define V8BLOB_H 6 | 7 | #include "v8_win/declspec.h" 8 | #include 9 | #include 10 | #include 11 | 12 | namespace mc_v8 13 | { 14 | class V8_WIN_EXPORTS Blob; 15 | using BlobPtr = std::shared_ptr; 16 | 17 | class V8_WIN_EXPORTS Blob 18 | { 19 | public: 20 | const size_t size_increment = 4096; 21 | 22 | static BlobPtr Instance(std::string name = ""); 23 | ~Blob(); 24 | 25 | void Reset(); 26 | 27 | void Set(void *data, size_t size); 28 | 29 | void Append(void *data, size_t size); 30 | 31 | unsigned char *Data() 32 | { 33 | return m_buffer; 34 | } 35 | 36 | size_t DataSize() const 37 | { 38 | return m_size; 39 | } 40 | 41 | bool IsEmpty() const 42 | { 43 | return m_size == 0; 44 | } 45 | 46 | static void Remove(std::string name); 47 | 48 | private: 49 | Blob() 50 | { 51 | } 52 | 53 | void Resize(size_t add_size); 54 | 55 | static std::map m_instances; 56 | 57 | unsigned char *m_buffer = nullptr; 58 | size_t m_size = 0; 59 | size_t m_allocated = 0; 60 | }; 61 | } // namespace mc_v8 62 | 63 | #endif // V8BLOB_H 64 | -------------------------------------------------------------------------------- /src/v8/v8json_spirit.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef V8JSON_SPIRIT_H 5 | #define V8JSON_SPIRIT_H 6 | 7 | #include "json/json_spirit.h" 8 | #include 9 | 10 | namespace mc_v8 11 | { 12 | v8::Local Jsp2V8(v8::Isolate *isolate, const json_spirit::Value &j); 13 | json_spirit::Value V82Jsp(v8::Isolate *isolate, v8::Local v); 14 | } // namespace mc_v8 15 | 16 | #endif // V8JSON_SPIRIT_H 17 | -------------------------------------------------------------------------------- /src/v8/v8ubjsonf.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef V8UBJSON_H 5 | #define V8UBJSON_H 6 | 7 | #include "v8/v8blob.h" 8 | #include 9 | 10 | namespace mc_v8 11 | { 12 | class Blob; 13 | 14 | int V82Ubj(v8::Isolate *isolate, v8::Local value, BlobPtr blob); 15 | v8::Local Ubj2V8(v8::Isolate *isolate, BlobPtr blob, int *err); 16 | 17 | } // namespace mc_v8 18 | 19 | #endif // V8UBJSON_H 20 | -------------------------------------------------------------------------------- /src/v8_win/callbacksf.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef FFF_Core_CALLBACKS_H_ 5 | #define FFF_Core_CALLBACKS_H_ 6 | 7 | #include 8 | #include 9 | 10 | namespace mc_v8 11 | { 12 | extern std::map callbackLookup; 13 | std::string callbackFixedName(std::string name); 14 | 15 | } // namespace mc_v8 16 | 17 | #endif /* FFF_Core_CALLBACKS_H_ */ 18 | -------------------------------------------------------------------------------- /src/v8_win/declspecf.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef DECLSPEC_H 5 | #define DECLSPEC_H 6 | 7 | #ifdef WIN32 8 | #ifdef FFF_Core_v8_EXPORTS 9 | /*Enabled as "export" while compiling the dll project*/ 10 | #define DLLEXPORT __declspec(dllexport) 11 | #else 12 | /*Enabled as "import" in the Client side for using already created dll file*/ 13 | #define DLLEXPORT __declspec(dllimport) 14 | #endif 15 | #else 16 | #define DLLEXPORT 17 | #endif // WIN32 18 | 19 | #endif // DECLSPEC_H 20 | -------------------------------------------------------------------------------- /src/v8_win/fffcore-v8.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fff-source/FFF_Protocol_Core/f7284c0b6024bdfb8decb2f9c78065e98d03094a/src/v8_win/fffcore-v8.rc -------------------------------------------------------------------------------- /src/v8_win/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by FFF_Core-v8.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /src/v8_win/v8json_spiritf.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef V8JSON_SPIRIT_H 5 | #define V8JSON_SPIRIT_H 6 | 7 | #include "json/json_spirit.h" 8 | #include 9 | 10 | namespace mc_v8 11 | { 12 | /** 13 | * Convert a json_spirit Value to a V8 Value. 14 | * 15 | * @param isolate The V8 Isolate to use. 16 | * @param j The json_spirit Value to convert. 17 | * @return The converted value if all is well, a blank V8 Value if not. 18 | */ 19 | v8::Local Jsp2V8(v8::Isolate *isolate, const json_spirit::Value &j); 20 | 21 | /** 22 | * Convert a V8 Value to a json_spirit Value. 23 | * 24 | * @param isolate The V8 Isolate to use. 25 | * @param v The V8 Value to convert. 26 | * @return The converted value if all is well, a null json_spirit Value if not. 27 | */ 28 | json_spirit::Value V82Jsp(v8::Isolate *isolate, v8::Local v); 29 | } // namespace mc_v8 30 | 31 | #endif // V8JSON_SPIRIT_H 32 | -------------------------------------------------------------------------------- /src/v8_win/v8ubjson.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #ifndef V8UBJSON_H 5 | #define V8UBJSON_H 6 | 7 | #include 8 | extern void _v8_internal_Print_Object(void *object); 9 | 10 | namespace mc_v8 11 | { 12 | class Blob; 13 | using BlobPtr = std::shared_ptr; 14 | 15 | /** 16 | * Convert a V8 Value to UBJSON. 17 | * 18 | * @param isolate The V8 Isolate to use. 19 | * @param value The V8 value to convert. 20 | * @param blob The Blob containing the resulting UBJSON content. 21 | * @return MC_ERR_NOERROR if all is well, error code if not. 22 | */ 23 | int V82Ubj(v8::Isolate *isolate, v8::Local value, BlobPtr blob); 24 | 25 | /** 26 | * Convert a UBJSON blob to a V8 Value. 27 | * 28 | * @param isolate The V8 Isolate to use. 29 | * @param blob The Blob containing the UBJSON to convert. 30 | * @param err Output error code. 31 | * @return The converted value if all is well, a blank V8 Value if not. 32 | */ 33 | v8::MaybeLocal Ubj2V8(v8::Isolate *isolate, BlobPtr blob, int *err); 34 | 35 | } // namespace mc_v8 36 | 37 | #endif // V8UBJSON_H 38 | -------------------------------------------------------------------------------- /src/v8_win/v8utils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 Coin Sciences Ltd 2 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 3 | 4 | #include "v8_win/v8utils.h" 5 | #include "spdlog/sinks/stdout_color_sinks.h" 6 | #include "spdlog/sinks/basic_file_sink.h" 7 | 8 | namespace mc_v8 9 | { 10 | void CreateLogger() 11 | { 12 | auto console_sink = std::make_shared(); 13 | console_sink->set_level(spdlog::level::warn); 14 | // console_sink->set_pattern("[multi_sink_example] [%^%l%$] %v"); 15 | 16 | auto file_sink = std::make_shared((dataDir / "v8_win.log").string(), true); 17 | file_sink->set_level(spdlog::level::trace); 18 | 19 | std::vector sinks = { console_sink, file_sink }; 20 | logger = std::make_shared("v8_win", sinks.begin(), sinks.end()); 21 | logger->set_level(spdlog::level::trace); 22 | } 23 | 24 | bool fDebug = false; 25 | fs::path dataDir; 26 | std::shared_ptr logger; 27 | } // namespace mc_v8 28 | -------------------------------------------------------------------------------- /src/version/bcversion.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2014 The FFF developers 2 | // Original code was distributed under the MIT software license. 3 | // Copyright (c) 2014-2019 Coin Sciences Ltd 4 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 5 | 6 | #ifndef FFF_VERSION_H 7 | #define FFF_VERSION_H 8 | 9 | /** 10 | * network protocol versioning 11 | */ 12 | 13 | static const int PROTOCOL_VERSION = 70002; 14 | 15 | //! initial proto version, to be increased after version/verack negotiation 16 | static const int INIT_PROTO_VERSION = 209; 17 | 18 | //! In this version, 'getheaders' was introduced. 19 | static const int GETHEADERS_VERSION = 31800; 20 | 21 | //! disconnect from peers older than this proto version 22 | static const int MIN_PEER_PROTO_VERSION = GETHEADERS_VERSION; 23 | 24 | //! nTime field added to CAddress, starting with this version; 25 | //! if possible, avoid requesting addresses nodes older than this 26 | static const int CADDR_TIME_VERSION = 31402; 27 | 28 | //! only request blocks from nodes outside this range of versions 29 | static const int NOBLKS_VERSION_START = 32000; 30 | static const int NOBLKS_VERSION_END = 32400; 31 | 32 | //! BIP 0031, pong message, is enabled for all versions AFTER this one 33 | static const int BIP0031_VERSION = 60000; 34 | 35 | //! "mempool" command, enhanced "getdata" behavior starts with this version 36 | static const int MEMPOOL_GD_VERSION = 60002; 37 | 38 | #endif // FFF_VERSION_H 39 | -------------------------------------------------------------------------------- /src/wallet/coincontrol.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2016 The FFF Core developers 2 | // Original code was distributed under the MIT software license. 3 | // Copyright (c) 2014-2019 Coin Sciences Ltd 4 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 5 | 6 | #ifndef FFF_COINCONTROL_H 7 | #define FFF_COINCONTROL_H 8 | 9 | #include "primitives/transaction.h" 10 | 11 | /** Coin Control Features. */ 12 | class CCoinControl 13 | { 14 | public: 15 | CTxDestination destChange; 16 | 17 | CCoinControl() 18 | { 19 | SetNull(); 20 | } 21 | 22 | void SetNull() 23 | { 24 | destChange = CNoDestination(); 25 | setSelected.clear(); 26 | } 27 | 28 | bool HasSelected() const 29 | { 30 | return (setSelected.size() > 0); 31 | } 32 | 33 | bool IsSelected(const uint256& hash, unsigned int n) const 34 | { 35 | COutPoint outpt(hash, n); 36 | return (setSelected.count(outpt) > 0); 37 | } 38 | 39 | void Select(const COutPoint& output) 40 | { 41 | setSelected.insert(output); 42 | } 43 | 44 | void UnSelect(const COutPoint& output) 45 | { 46 | setSelected.erase(output); 47 | } 48 | 49 | void UnSelectAll() 50 | { 51 | setSelected.clear(); 52 | } 53 | 54 | void ListSelected(std::vector& vOutpoints) 55 | { 56 | vOutpoints.assign(setSelected.begin(), setSelected.end()); 57 | } 58 | 59 | private: 60 | std::set setSelected; 61 | }; 62 | 63 | #endif // FFF_COINCONTROL_H 64 | -------------------------------------------------------------------------------- /src/wallet/dbconst.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2016 The FFF Core developers 2 | // Original code was distributed under the MIT software license. 3 | // Copyright (c) 2014-2019 Coin Sciences Ltd 4 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 5 | 6 | 7 | #ifndef FFF_Core_DBCONST_H 8 | #define FFF_Core_DBCONST_H 9 | 10 | // Codes consistent with db.h 11 | 12 | #define MC_DBW_CODE_DB_NEXT 16 13 | #define MC_DBW_CODE_DB_SET_RANGE 28 14 | #define MC_DBW_CODE_DB_NOTFOUND -30988 15 | #define MC_DBW_CODE_DB_NOSERVER -30991 16 | #define MC_DBW_CODE_DB_TXN_WRITE_NOSYNC 0x00000020 17 | 18 | class CDBConstEnv 19 | { 20 | public: 21 | mutable CCriticalSection cs_dbwrap; 22 | 23 | CDBConstEnv(){}; 24 | ~CDBConstEnv(){}; 25 | 26 | 27 | enum VerifyResult { VERIFY_OK, 28 | RECOVER_OK, 29 | RECOVER_FAIL }; 30 | 31 | typedef std::pair, std::vector > KeyValPair; 32 | }; 33 | 34 | 35 | #endif /* DBCONST_H */ 36 | 37 | -------------------------------------------------------------------------------- /src/wallet/wallet_ismine.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto 2 | // Copyright (c) 2014-2016 The FFF Core developers 3 | // Original code was distributed under the MIT software license. 4 | // Copyright (c) 2014-2019 Coin Sciences Ltd 5 | // FFF_Core code distributed under the GPLv3 license, see COPYING file. 6 | 7 | #ifndef FFF_WALLET_ISMINE_H 8 | #define FFF_WALLET_ISMINE_H 9 | 10 | #include "keys/key.h" 11 | #include "script/standard.h" 12 | 13 | class CKeyStore; 14 | class CScript; 15 | 16 | /** IsMine() return codes */ 17 | enum isminetype 18 | { 19 | ISMINE_NO = 0, 20 | ISMINE_WATCH_ONLY = 1, 21 | ISMINE_SPENDABLE = 2, 22 | ISMINE_ALL = ISMINE_WATCH_ONLY | ISMINE_SPENDABLE 23 | }; 24 | /** used for bitflags of isminetype */ 25 | typedef uint8_t isminefilter; 26 | 27 | isminetype IsMine(const CKeyStore& keystore, const CScript& scriptPubKey); 28 | isminetype IsMine(const CKeyStore& keystore, const CTxDestination& dest); 29 | 30 | isminetype IsMineKeyID(const CKeyStore& keystore, const CKeyID& dest); 31 | isminetype IsMineScriptID(const CKeyStore& keystore, const CScriptID& dest); 32 | 33 | #endif // FFF_WALLET_ISMINE_H 34 | --------------------------------------------------------------------------------