0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-09 10:43:19 -05:00
bitcoin-bitcoin-core/src
MarcoFalke 51e2ce45d6
Merge #17693: rpc: Add generateblock to mine a custom set of transactions
7524b6479c Add tests for generateblock (Andrew Toth)
dcc8332543 Add generateblock rpc (Andrew Toth)

Pull request description:

  The existing block generation rpcs for regtest, `generatetoaddress` and `generatetodescriptor`, mine everything in the mempool up to the block weight limit. This makes it difficult to test a system for several scenarios where a different set of transactions are mined. For example:
  - Testing the common scenario where a transaction is replaced in the mempool but the replaced transaction is mined instead.
  - Testing for a double-spent transaction where a transaction that conflicts with the mempool is mined.
  - Testing for non-standard transactions that are mined.
  - Testing the scenario where several blocks are mined without a specific transaction in the mempool being included in a block.

  This PR introduces a new rpc, `generateblock`, that takes an array of raw transactions and txids and mines only those and the coinbase. Any txids must be in the mempool, but the raw txs can be anything conforming to consensus rules. The coinbase can be specified as either an address or descriptor.

  This reopens #17653 since it was closed by mistake.

  Thanks to instagibbs for code suggestions that I used here.

ACKs for top commit:
  MarcoFalke:
    re-ACK 7524b6479c 📁

Tree-SHA512: 857106007465b5b9b8a84b6d07c17cbf8378a33a72d32ff79abea1d5ab4babb4d53a11ddbb14595aa1fac9dfa1391e3a11403d742f69951beea2f683e8a01cd4
2020-04-10 13:12:30 -04:00
..
bench Fix wallet unload race condition 2020-03-27 15:17:35 +00:00
compat scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
config
consensus Update merkle.cpp 2020-03-18 10:34:53 -07:00
crc32c Import crc32c using subtree merge as as 'src/crc32c' 2020-01-28 17:00:01 +01:00
crypto Merge #17691: doc: Add missed copyright headers 2020-01-16 15:58:35 -05:00
index Merge #17477: Remove the mempool's NotifyEntryAdded and NotifyEntryRemoved signals 2020-03-19 17:26:51 +01:00
interfaces Merge #17999: refactor: Add ChainClient setMockTime, getWallets methods 2020-04-10 12:57:35 -04:00
leveldb Update to leveldb upstream using subtree merge 2020-01-28 16:59:07 +01:00
logging doc: Correct spelling errors in comments 2020-03-02 23:07:21 -08:00
node doc: Correct spelling errors in comments 2020-03-02 23:07:21 -08:00
policy scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
primitives Check for overflow when calculating sum of outputs 2020-03-23 16:36:24 +02:00
qt Merge #17737: Add ChainstateManager, remove BlockManager global 2020-04-10 13:02:01 -04:00
rpc Merge #17693: rpc: Add generateblock to mine a custom set of transactions 2020-04-10 13:12:30 -04:00
script Merge #18422: [consensus] MOVEONLY: Move single-sig checking EvalScript code to EvalChecksig 2020-04-10 12:59:29 -04:00
secp256k1 Update the secp256k1 subtree to the latest upstream version 2019-03-31 11:41:05 -07:00
support Merge #15600: lockedpool: When possible, use madvise to avoid including sensitive information in core dumps 2020-03-26 16:56:03 +01:00
test Merge #17737: Add ChainstateManager, remove BlockManager global 2020-04-10 13:02:01 -04:00
univalue Update univalue subtree 2020-02-09 07:44:29 -08:00
util Drop bitcoin-wallet dependency on libevent 2020-04-02 08:35:10 -04:00
wallet Merge #17737: Add ChainstateManager, remove BlockManager global 2020-04-10 13:02:01 -04:00
zmq Merge #17477: Remove the mempool's NotifyEntryAdded and NotifyEntryRemoved signals 2020-03-19 17:26:51 +01:00
.clang-format util: Add AllowShortCaseLabelsOnASingleLine option 2019-10-14 13:24:54 +03:00
addrdb.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
addrdb.h Convert addrdb/addrman to new serialization 2020-01-02 11:05:36 -08:00
addrman.cpp logging: asmap logging and #include fixups 2020-03-04 14:24:19 +01:00
addrman.h logging: asmap logging and #include fixups 2020-03-04 14:24:19 +01:00
amount.h
arith_uint256.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
arith_uint256.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
attributes.h
banman.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
banman.h refactor: move DUMP_BANS_INTERVAL to banman.h 2020-03-10 09:52:53 -04:00
base58.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
base58.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
bech32.cpp Add some general std::vector utility functions 2019-10-16 08:56:57 -07:00
bech32.h Assert that the HRP is lowercase in Bech32::Encode 2019-09-05 13:25:11 +12:00
bitcoin-cli-res.rc
bitcoin-cli.cpp Merge #18504: build: Drop bitcoin-tx and bitcoin-wallet dependencies on libevent 2020-04-10 12:52:37 -04:00
bitcoin-tx-res.rc
bitcoin-tx.cpp Replace std::to_string with locale-independent alternative 2020-03-14 12:23:01 -07:00
bitcoin-wallet-res.rc
bitcoin-wallet.cpp Drop bitcoin-wallet dependency on libevent 2020-04-02 08:35:10 -04:00
bitcoind-res.rc
bitcoind.cpp Drop bitcoin-wallet dependency on libevent 2020-04-02 08:35:10 -04:00
blockencodings.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
blockencodings.h Convert blockencodings.h to new serialization framework 2020-02-25 14:10:44 -08:00
blockfilter.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
blockfilter.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
bloom.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
bloom.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chain.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chain.h Get rid of VARINT default argument 2020-02-10 12:00:10 -08:00
chainparams.cpp chainparams: Bump assumed valid hash 2020-04-02 05:34:47 +08:00
chainparams.h [test] add chainparams property to indicate chain allows time mocking 2020-02-13 08:59:51 -08:00
chainparamsbase.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chainparamsbase.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chainparamsseeds.h net: Hardcoded seeds update for 0.20 2020-04-03 16:29:26 +02:00
checkqueue.h refactor: Remove redundant conditional 2020-01-21 14:07:42 +00:00
clientversion.cpp
clientversion.h
coins.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
coins.h serialization: prevent int overflow for big Coin::nHeight 2020-03-28 08:38:07 +09:00
compat.h
compressor.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
compressor.h Merge #17917: tests: Add amount compression/decompression fuzzing to existing fuzzing harness 2020-03-05 15:25:36 -05:00
core_io.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
core_memusage.h
core_read.cpp Limit decimal range of numbers ParseScript accepts 2020-03-27 15:51:05 +09:00
core_write.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
cuckoocache.h tests: Add fuzzing harness for classes/functions in cuckoocache.h 2020-04-08 14:45:27 +00:00
dbwrapper.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
dbwrapper.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
dummywallet.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
flatfile.cpp Style cleanup. 2019-02-22 17:38:45 -08:00
flatfile.h Get rid of VARINT default argument 2020-02-10 12:00:10 -08:00
fs.cpp scripted-diff: Add missed copyright headers 2020-01-04 20:18:28 +02:00
fs.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
hash.cpp
hash.h Squashed 'src/secp256k1/' changes from 0b70241850..b19c000063 2019-03-31 11:41:05 -07:00
httprpc.cpp scripted-diff: Replace MilliSleep with UninterruptibleSleep 2020-02-21 10:06:21 -08:00
httprpc.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
httpserver.cpp tests: Add fuzzing harness for HTTPRequest, libevent's evhttp and related functions 2020-04-06 13:58:51 +00:00
httpserver.h tests: Add fuzzing harness for HTTPRequest, libevent's evhttp and related functions 2020-04-06 13:58:51 +00:00
indirectmap.h Add missing includes 2020-01-31 12:36:13 +00:00
init.cpp Merge #17737: Add ChainstateManager, remove BlockManager global 2020-04-10 13:02:01 -04:00
init.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
key.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
key.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
key_io.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
key_io.h
limitedmap.h
logging.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
logging.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
Makefile.am Merge #16367: Multiprocess build support 2020-04-10 12:55:12 -04:00
Makefile.bench.include Merge #18429: build: remove double LIBBITCOIN_SERVER from bench-Makefile 2020-03-26 17:20:28 +08:00
Makefile.crc32c.include build: CRC32C build system integration 2020-01-28 17:01:48 +01:00
Makefile.leveldb.include build: CRC32C build system integration 2020-01-28 17:01:48 +01:00
Makefile.qt.include Multiprocess build changes 2020-04-05 21:48:21 -04:00
Makefile.qt_locale.include qt: Translations update pre-branch 2020-04-01 12:49:15 +02:00
Makefile.qttest.include build: Create test utility library from src/test/util/ 2019-11-21 21:13:08 +01:00
Makefile.test.include Merge #17737: Add ChainstateManager, remove BlockManager global 2020-04-10 13:02:01 -04:00
Makefile.test_fuzz.include build: create test_fuzz library from src/test/fuzz/fuzz.cpp 2020-04-05 01:01:13 +02:00
Makefile.test_util.include fuzz: Add process_messages harness 2020-04-05 10:46:24 +08:00
memusage.h Add missing includes 2020-01-31 12:36:13 +00:00
merkleblock.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
merkleblock.h
miner.cpp Add generateblock rpc 2020-03-27 11:00:10 -04:00
miner.h Add generateblock rpc 2020-03-27 11:00:10 -04:00
net.cpp net: Add missing cs_vNodes lock 2020-03-29 11:45:46 -04:00
net.h Merge #18454: net: Make addr relay mockable, add test 2020-04-10 10:12:46 -04:00
net_permissions.cpp net: Avoid using C-style NUL-terminated strings as arguments in the netbase interface 2020-01-08 12:35:59 +00:00
net_permissions.h net: Remove forcerelay of rejected txs 2020-02-11 07:44:12 -08:00
net_processing.cpp Merge #18454: net: Make addr relay mockable, add test 2020-04-10 10:12:46 -04:00
net_processing.h net: Add missing cs_vNodes lock 2020-03-29 11:45:46 -04:00
net_types.h refactor: Remove addrdb.h dependency from node.h 2019-10-29 11:30:12 +02:00
netaddress.cpp net: extract conditional to bool CNetAddr::IsHeNet 2020-03-04 14:31:31 +01:00
netaddress.h net: extract conditional to bool CNetAddr::IsHeNet 2020-03-04 14:31:31 +01:00
netbase.cpp Merge #17754: net: Don't allow resolving of std::string with embedded NUL characters. Add tests. 2020-01-22 20:20:45 +01:00
netbase.h net: Avoid using C-style NUL-terminated strings as arguments in the netbase interface 2020-01-08 12:35:59 +00:00
netmessagemaker.h
noui.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
noui.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
optional.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
outputtype.cpp Revert "Store p2sh scripts in AddAndGetDestinationForScript" 2020-02-12 11:48:30 -05:00
outputtype.h List output types in an array in order to be iterated over 2020-01-23 16:35:06 -05:00
pow.cpp
pow.h
prevector.h Make VectorFormatter support stateful formatters 2020-02-15 19:49:24 -08:00
protocol.cpp net: Fail instead of truncate command name in CMessageHeader 2020-02-06 13:24:40 +01:00
protocol.h net: Fail instead of truncate command name in CMessageHeader 2020-02-06 13:24:40 +01:00
psbt.cpp Merge #17156: psbt: check that various indexes and amounts are within bounds 2020-01-29 19:39:50 +08:00
psbt.h Fix doxygen errors 2020-01-16 18:25:11 -08:00
pubkey.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
pubkey.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
random.cpp build: fix sysctl() detection on macOS 2020-03-19 11:36:38 +08:00
random.h tests: Add fuzzing harness for functions/classes in random.h 2020-03-29 13:17:04 +00:00
randomenv.cpp Drop unused mach time headers 2020-02-28 14:56:49 -08:00
randomenv.h [MOVEONLY] Move perfmon data gathering to new randomenv module 2019-11-12 14:50:44 -08:00
rest.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
reverse_iterator.h
scheduler.cpp scheduler: Make schedule* methods type safe 2020-03-10 09:47:32 -04:00
scheduler.h scheduler: Make schedule* methods type safe 2020-03-10 09:47:32 -04:00
serialize.h Merge #18112: Serialization improvements step 5 (blockencodings) 2020-03-05 19:56:26 +01:00
shutdown.cpp
shutdown.h
span.h Make VerifyWitnessProgram use a Span stack 2020-03-23 14:44:58 -07:00
streams.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
sync.cpp util: Remove unused itostr 2020-03-27 08:59:06 -04:00
sync.h Fix missing header in sync.h 2020-03-15 22:43:39 +00:00
threadinterrupt.cpp
threadinterrupt.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
threadsafety.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
timedata.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
timedata.h
tinyformat.h util: Update tinyformat to upstream 2019-12-06 10:02:08 +01:00
torcontrol.cpp net: Avoid using C-style NUL-terminated strings as arguments in the netbase interface 2020-01-08 12:35:59 +00:00
torcontrol.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
txdb.cpp Get rid of VARINT default argument 2020-02-10 12:00:10 -08:00
txdb.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
txmempool.cpp [mempool] Remove NotifyEntryAdded and NotifyEntryRemoved callbacks 2020-03-11 18:38:33 -04:00
txmempool.h Merge #17477: Remove the mempool's NotifyEntryAdded and NotifyEntryRemoved signals 2020-03-19 17:26:51 +01:00
ui_interface.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
ui_interface.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
uint256.cpp refactor: define a UINT256_ONE global constant 2020-01-23 16:35:08 -05:00
uint256.h refactor: define a UINT256_ONE global constant 2020-01-23 16:35:08 -05:00
undo.h serialization: prevent int overflow for big Coin::nHeight 2020-03-28 08:38:07 +09:00
validation.cpp Merge #17737: Add ChainstateManager, remove BlockManager global 2020-04-10 13:02:01 -04:00
validation.h protect g_chainman with cs_main 2020-03-17 14:07:58 -04:00
validationinterface.cpp Do not clear validationinterface entries being executed 2020-04-07 12:53:40 -07:00
validationinterface.h refactor: drop boost::signals2 in validationinterface 2020-04-04 11:44:39 -04:00
version.h
versionbits.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
versionbits.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
versionbitsinfo.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
versionbitsinfo.h
walletinitinterface.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
warnings.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
warnings.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00