Skip to content

Conversation

fjahr
Copy link
Contributor

@fjahr fjahr commented Oct 19, 2024

Note: This is just a proof of concept put here for discussion/feedback/brainstorming/improvement. I am not sure if we want to merge this into core at all since it can be dealt with externally as well. But this was the simplest way for me to make it work and it's probably also simpler for many miners to run this branch rather than another external software.

Context

Testnet4 fixes block storms but it kept the minimum-difficulty exception in place. The rationale was that this would be the only way developers could still get their non-standard transactions into the blockchain. However, probably due to the public discussion of this feature, this has attracted the attention of people whose motivation might be A) grab as many testnet coins as possible or B) to annoy developers. There are currently one or more actors who just max out the min-difficulty exception as much as possible and as quickly as possible, see https://mempool.space/testnet4. There are always several min-difficulty blocks appearing instantly after a normal difficulty mined block.

There are several implications to this:

  • Developers can not get their non-standard transactions into the blockchain using the min-exception blocks, unless they put in significant effort to outrace the spammers
  • The actual difficulty is artificially raised
  • Less coins are going to faucets (though this is a very minor issue)

Solution

The solution to this problem was already briefly discussed in the original pull request for Testnet4: The min-difficulty blocks can all be easily re-orged by a single block with the actual difficulty. The code here implements this functionality within the getblocktemplate RPC. All blocks with min-difficulty (including forks) are temporarily marked invalid while the template is created. The blocks are only temporarily marked invalid since another miner might find an actual difficulty block on top of the min-difficulty blocks and we don't want to create a fork in the chain in that case.

We do want to keep the transactions from the blocks and include them in the block template. That should work with this solution via the orphan pool but I haven't done extensive testing on this yet. In reality it seems like there are several transactions in these min-difficulty blocks with a minimum block height and these can not be included in the re-org block (except the ones that are in the first one). However, given that these transactions appear in almost every block it might just be self-transfers created by the spammer.

Mining Pool

The follow-up to this would be to run a public (solo) pool with this enabled so that we can get some more hash rate behind this without requiring any effort on the side of those with hash rate and demotivate the spammers.

Acknowledgement

I worked on this at Bitcoin++ in Berlin a week ago together with Emzy and Sjors. Together we were able to demo a pool running a previous version of this PR and connected a miner to it. That pool isn't public yet though.

Demo

Here are some log outputs showing how first the orphan blocks are invalidated and then the actual chain is rolled back. Then, after the template was constructed, the blocks are reconsidered.

Logs
2024-10-19T13:14:29Z InvalidChainFound: invalid block=00000000004967e9a55121ced9a1b5df2bbf794edef6eaeca56985180dca178a  height=50944  log2_work=71.373305  date=2024-10-19T13:58:13Z
2024-10-19T13:14:29Z InvalidChainFound:  current best=000000000097f5f8174415729790d2d83b90af466564ddf416247a050681caee  height=50947  log2_work=71.373305  date=2024-10-19T14:58:16Z
2024-10-19T13:14:29Z InvalidChainFound: invalid block=00000000002663fc47b4f47626296cc2d3118320581c4ff0eaa6317812bffdb2  height=50945  log2_work=71.373305  date=2024-10-19T14:18:14Z
2024-10-19T13:14:29Z InvalidChainFound:  current best=000000000097f5f8174415729790d2d83b90af466564ddf416247a050681caee  height=50947  log2_work=71.373305  date=2024-10-19T14:58:16Z
2024-10-19T13:14:29Z InvalidChainFound: invalid block=000000000062e7e0743d4e97085a1696c7352096ea53e58daad468fc8995f397  height=50946  log2_work=71.373305  date=2024-10-19T14:38:15Z
2024-10-19T13:14:29Z InvalidChainFound:  current best=000000000097f5f8174415729790d2d83b90af466564ddf416247a050681caee  height=50947  log2_work=71.373305  date=2024-10-19T14:58:16Z
2024-10-19T13:14:29Z UpdateTip: new best=0000000000638927100cc5578d750a9fcb763020fdab55bf27ba39ba26a57000 height=50946 version=0x2840e000 log2_work=71.373305 tx=862937 date='2024-10-19T14:38:15Z' progress=1.000000 cache=0.6MiB(2838txo)
2024-10-19T13:14:29Z InvalidChainFound: invalid block=000000000097f5f8174415729790d2d83b90af466564ddf416247a050681caee  height=50947  log2_work=71.373305  date=2024-10-19T14:58:16Z
2024-10-19T13:14:29Z InvalidChainFound:  current best=0000000000638927100cc5578d750a9fcb763020fdab55bf27ba39ba26a57000  height=50946  log2_work=71.373305  date=2024-10-19T14:38:15Z
2024-10-19T13:14:29Z UpdateTip: new best=0000000000d35f958ad057b68c5822990b8b91325f6e549a2386b578e231a8b0 height=50945 version=0x27b82000 log2_work=71.373305 tx=862933 date='2024-10-19T14:18:14Z' progress=1.000000 cache=0.6MiB(2834txo)
2024-10-19T13:14:29Z InvalidChainFound: invalid block=0000000000638927100cc5578d750a9fcb763020fdab55bf27ba39ba26a57000  height=50946  log2_work=71.373305  date=2024-10-19T14:38:15Z
2024-10-19T13:14:29Z InvalidChainFound:  current best=0000000000d35f958ad057b68c5822990b8b91325f6e549a2386b578e231a8b0  height=50945  log2_work=71.373305  date=2024-10-19T14:18:14Z
2024-10-19T13:14:29Z UpdateTip: new best=0000000000c0704c802da78900f465ea3eaeba55719b76c88bc9f2a43bacb58c height=50944 version=0x22de4000 log2_work=71.373305 tx=862930 date='2024-10-19T13:58:13Z' progress=1.000000 cache=0.6MiB(2832txo)
2024-10-19T13:14:29Z InvalidChainFound: invalid block=0000000000d35f958ad057b68c5822990b8b91325f6e549a2386b578e231a8b0  height=50945  log2_work=71.373305  date=2024-10-19T14:18:14Z
2024-10-19T13:14:29Z InvalidChainFound:  current best=0000000000c0704c802da78900f465ea3eaeba55719b76c88bc9f2a43bacb58c  height=50944  log2_work=71.373305  date=2024-10-19T13:58:13Z
2024-10-19T13:14:29Z UpdateTip: new best=0000000000f6f9d3588bbc15a2bd5da43c4470301b4361104a9781e530830bfb height=50943 version=0x224c4000 log2_work=71.373305 tx=862929 date='2024-10-19T13:38:12Z' progress=1.000000 cache=0.6MiB(2832txo)
2024-10-19T13:14:29Z InvalidChainFound: invalid block=0000000000c0704c802da78900f465ea3eaeba55719b76c88bc9f2a43bacb58c  height=50944  log2_work=71.373305  date=2024-10-19T13:58:13Z
2024-10-19T13:14:29Z InvalidChainFound:  current best=0000000000f6f9d3588bbc15a2bd5da43c4470301b4361104a9781e530830bfb  height=50943  log2_work=71.373305  date=2024-10-19T13:38:12Z
2024-10-19T13:14:29Z UpdateTip: new best=0000000000000005a8ae7897cfd4a0a9f1f45c89bf9f4dc090d7074b2b7a4586 height=50942 version=0x20000000 log2_work=71.373305 tx=862928 date='2024-10-19T13:18:11Z' progress=1.000000 cache=0.6MiB(2832txo)
2024-10-19T13:14:29Z InvalidChainFound: invalid block=0000000000f6f9d3588bbc15a2bd5da43c4470301b4361104a9781e530830bfb  height=50943  log2_work=71.373305  date=2024-10-19T13:38:12Z
2024-10-19T13:14:29Z InvalidChainFound:  current best=0000000000000005a8ae7897cfd4a0a9f1f45c89bf9f4dc090d7074b2b7a4586  height=50942  log2_work=71.373305  date=2024-10-19T13:18:11Z
2024-10-19T13:14:29Z CreateNewBlock(): block weight: 14069 txs: 18 fees: 35293 sigops 412
2024-10-19T13:14:29Z UpdateTip: new best=0000000000f6f9d3588bbc15a2bd5da43c4470301b4361104a9781e530830bfb height=50943 version=0x224c4000 log2_work=71.373305 tx=862929 date='2024-10-19T13:38:12Z' progress=1.000000 cache=0.6MiB(2832txo)
2024-10-19T13:14:29Z UpdateTip: new best=0000000000c0704c802da78900f465ea3eaeba55719b76c88bc9f2a43bacb58c height=50944 version=0x22de4000 log2_work=71.373305 tx=862930 date='2024-10-19T13:58:13Z' progress=1.000000 cache=0.6MiB(2832txo)
2024-10-19T13:14:29Z UpdateTip: new best=0000000000d35f958ad057b68c5822990b8b91325f6e549a2386b578e231a8b0 height=50945 version=0x27b82000 log2_work=71.373305 tx=862933 date='2024-10-19T14:18:14Z' progress=1.000000 cache=0.6MiB(2834txo)
2024-10-19T13:14:29Z UpdateTip: new best=0000000000638927100cc5578d750a9fcb763020fdab55bf27ba39ba26a57000 height=50946 version=0x2840e000 log2_work=71.373305 tx=862937 date='2024-10-19T14:38:15Z' progress=1.000000 cache=0.6MiB(2838txo)
2024-10-19T13:14:29Z UpdateTip: new best=000000000097f5f8174415729790d2d83b90af466564ddf416247a050681caee height=50947 version=0x25f34000 log2_work=71.373305 tx=862947 date='2024-10-19T14:58:16Z' progress=1.000000 cache=0.6MiB(2853txo)

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 19, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31117.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #31785 (Have createNewBlock() wait for tip, make rpc handle shutdown during long poll and wait methods by Sjors)
  • #30635 (rpc: add optional blockhash to waitfornewblock, unhide wait methods in help by Sjors)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@fjahr fjahr marked this pull request as draft October 19, 2024 16:40
@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed.
Debug: https://github.com/bitcoin/bitcoin/runs/31773418335

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

@fjahr
Copy link
Contributor Author

fjahr commented Oct 21, 2024

CI is broken because BIP94 is also active on regtest and this change breaks some functional tests that are not related to the issue. I don't think I need to work on fixing those tests unless I get an indication that people think this is actually interesting to merge.

We are getting some report that the getblocktemplate sometimes hangs on a small-ish debian 12 server. I have not been able to reproduce this locally or on a small-ish ubuntu server. Would be great if anyone is interested in testing this on their setup or has an idea what might cause this by looking at the code. So far, I have not been able to find the problem.

@fjahr fjahr force-pushed the 2024-10-t4-reorg-miner branch from f1f9d54 to 7864871 Compare October 21, 2024 14:54
@murchandamus
Copy link
Contributor

In addition to the immediate minimum difficulty blocks after each full difficulty block, someone appears to have started bloating the UTXO set. They have created about 1.5 M UTXOs today so far: https://mempool.space/testnet4/address/tb1q8z0jcrdmfuhyafz06ukhyvfnx4vhcn5azv6jkr

@garlonicon
Copy link

The rationale was that this would be the only way developers could still get their non-standard transactions into the blockchain.

Well, the solution to that is quite simple: if non-standard transactions would be normally propagated, then developers could simply publish them, and have them confirmed. Unless you want to get an additional spam protection, by requiring every developer to provide 32 leading zero bits in Proof of Work. But in that case, just doing OP_SIZE on a signature will give you the same outcome.

grab as many testnet coins as possible

Note that testnet4 is already traded at 20 satoshis per 1 tBTC4. And testnet5 will also be, if it will be released in a similar way: https://altquick.com/exchange/market/BitcoinTestnet4

There are always several min-difficulty blocks appearing instantly after a normal difficulty mined block.

When coins get non-zero value, then people are simply trying to get the maximum number of blocks, and sell them. And the original algorithm from Bitcoin Core is far from optimal. If you pick future timestamps, then you can for example instantly mine as many CPU blocks as possible, and then put some ASIC block on top of that. Which means, that staying 2 hours in the future is profitable. And also: mining ASIC blocks 2 hours in the future is also profitable, because then, you block potential CPU-mined blocks from being broadcasted, for the next 20 minutes (meanwhile, you prepare such block, and then release it, when the network time will get there).

The actual difficulty is artificially raised

It is always the case, if you count CPU-mined blocks into difficulty adjustments. Because if you have 2016 blocks, where 1008 blocks are CPU-mined, and 1008 blocks are ASIC-mined, then in practice, the real difficulty should be calculated after the next 1008 ASIC blocks. But instead, it is re-adjusted now, so the more CPU-mined blocks are there, the less ASIC-mined blocks remains (until falling above 10 minutes per block on average, when the difficulty then starts falling).

The min-difficulty blocks can all be easily re-orged by a single block with the actual difficulty.

If it will be harder to mine testnet4, then the value per coin will increase. Which means more trading. Unless people will stay in testnet3, where the chain is faster, because of blockstorms.

We do want to keep the transactions from the blocks and include them in the block template.

All of them? Including also those with zero fees, or other non-matching mempool policy?

@Sjors
Copy link
Member

Sjors commented Oct 24, 2024

cc @Emzy

@1440000bytes

This comment was marked as abuse.

@plebhash
Copy link

plebhash commented Oct 24, 2024

Regtest and Signet could work fine for testing.

testnet4 is being used for testing in Stratum V2 development, where a network with realistic mining dynamics is important

neither regtest nor signet allow for this


this is not a statement with regards to core maintainance though, I'm not opinionated with regards to that

just pointing out that there is demand for this kind of network

@garlonicon
Copy link

where a network with realistic mining dynamics is important

What about using "getblocktemplate" on mainnet, and mining blocks, which will quickly become stale? If you want to have worthless coins, then they should be stale, in other cases, they will be traded.

Another possibility is to use "Pay to Proof of Work" addresses on signet/regtest. Then, moving a coin will require grinding a DER signature, to get it below N bytes, so it will require some mining power.

just pointing out that there is demand for this kind of network

Now, testnet4 coins are actively traded, as well as testnet3 coins. Which means, that it is time for testnet5. But: it should have different rules, because if blocks would have any persistence, then they will be traded again. That's why all of them should be stale, so they could be shared between interested parties, while also being worthless at the same time.

@Davidson-Souza
Copy link

In 7864871. If I fire a getblocktemplate before sync is done, I get a segfault.

Valgrind stack trace
==1025895== Thread 7 b-httpworker.3:
==1025895== Invalid read of size 4
==1025895==    at 0x36A95F: node::(anonymous namespace)::MinerImpl::rollbackTestnet4() (interfaces.cpp:997)
==1025895==    by 0x42F759: getblocktemplate()::{lambda(RPCHelpMan const&, JSONRPCRequest const&)#1}::operator()(RPCHelpMan const&, JSONRPCRequest const&) const [clone .isra.0] (mining.cpp:666)
==1025895==    by 0x433821: __invoke_impl<UniValue, getblocktemplate()::<lambda(const RPCHelpMan&, const JSONRPCRequest&)>&, const RPCHelpMan&, const JSONRPCRequest&> (invoke.h:61)
==1025895==    by 0x433821: __invoke_r<UniValue, getblocktemplate()::<lambda(const RPCHelpMan&, const JSONRPCRequest&)>&, const RPCHelpMan&, const JSONRPCRequest&> (invoke.h:116)
==1025895==    by 0x433821: std::_Function_handler<UniValue (RPCHelpMan const&, JSONRPCRequest const&), getblocktemplate()::{lambda(RPCHelpMan const&, JSONRPCRequest const&)#1}>::_M_invoke(std::_Any_data const&, RPCHelpMan const&, JSONRPCRequest const&) (std_function.h:291)
==1025895==    by 0x8B74B1: operator() (std_function.h:591)
==1025895==    by 0x8B74B1: RPCHelpMan::HandleRequest(JSONRPCRequest const&) const (util.cpp:679)
==1025895==    by 0x3FC5E7: CRPCCommand::CRPCCommand(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RPCHelpMan (*)())::{lambda(JSONRPCRequest const&, UniValue&, bool)#1}::operator()(JSONRPCRequest const&, UniValue&, bool) const [clone .isra.0] (server.h:101)
==1025895==    by 0x3FC92F: __invoke_impl<bool, CRPCCommand::CRPCCommand(std::string, RpcMethodFnType)::<lambda(const JSONRPCRequest&, UniValue&, bool)>&, const JSONRPCRequest&, UniValue&, bool> (invoke.h:61)
==1025895==    by 0x3FC92F: __invoke_r<bool, CRPCCommand::CRPCCommand(std::string, RpcMethodFnType)::<lambda(const JSONRPCRequest&, UniValue&, bool)>&, const JSONRPCRequest&, UniValue&, bool> (invoke.h:114)
==1025895==    by 0x3FC92F: std::_Function_handler<bool (JSONRPCRequest const&, UniValue&, bool), CRPCCommand::CRPCCommand(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RPCHelpMan (*)())::{lambda(JSONRPCRequest const&, UniValue&, bool)#1}>::_M_invoke(std::_Any_data const&, JSONRPCRequest const&, UniValue&, bool&&) (std_function.h:290)
==1025895==    by 0x4B77FF: operator() (std_function.h:591)
==1025895==    by 0x4B77FF: ExecuteCommand(CRPCCommand const&, JSONRPCRequest const&, UniValue&, bool) (server.cpp:512)
==1025895==    by 0x4B8CF7: ExecuteCommands (server.cpp:477)
==1025895==    by 0x4B8CF7: CRPCTable::execute(JSONRPCRequest const&) const (server.cpp:497)
==1025895==    by 0x4B8DE6: JSONRPCExec(JSONRPCRequest const&, bool) (server.cpp:353)
==1025895==    by 0x59B80B: HTTPReq_JSONRPC(std::any const&, HTTPRequest*) (httprpc.cpp:218)
==1025895==    by 0x5A95E9: operator() (std_function.h:591)
==1025895==    by 0x5A95E9: operator() (httpserver.cpp:62)
==1025895==    by 0x5A95E9: WorkQueue<HTTPClosure>::Run() (httpserver.cpp:117)
==1025895==    by 0x5A5594: HTTPWorkQueueRun(WorkQueue<HTTPClosure>*, int) (httpserver.cpp:415)
==1025895==  Address 0x84 is not stack'd, malloc'd or (recently) free'd
==1025895== 
==1025895== 
==1025895== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==1025895==  Access not within mapped region at address 0x84
==1025895==    at 0x36A95F: node::(anonymous namespace)::MinerImpl::rollbackTestnet4() (interfaces.cpp:997)
==1025895==    by 0x42F759: getblocktemplate()::{lambda(RPCHelpMan const&, JSONRPCRequest const&)#1}::operator()(RPCHelpMan const&, JSONRPCRequest const&) const [clone .isra.0] (mining.cpp:666)
==1025895==    by 0x433821: __invoke_impl<UniValue, getblocktemplate()::<lambda(const RPCHelpMan&, const JSONRPCRequest&)>&, const RPCHelpMan&, const JSONRPCRequest&> (invoke.h:61)
==1025895==    by 0x433821: __invoke_r<UniValue, getblocktemplate()::<lambda(const RPCHelpMan&, const JSONRPCRequest&)>&, const RPCHelpMan&, const JSONRPCRequest&> (invoke.h:116)
==1025895==    by 0x433821: std::_Function_handler<UniValue (RPCHelpMan const&, JSONRPCRequest const&), getblocktemplate()::{lambda(RPCHelpMan const&, JSONRPCRequest const&)#1}>::_M_invoke(std::_Any_data const&, RPCHelpMan const&, JSONRPCRequest const&) (std_function.h:291)
==1025895==    by 0x8B74B1: operator() (std_function.h:591)
==1025895==    by 0x8B74B1: RPCHelpMan::HandleRequest(JSONRPCRequest const&) const (util.cpp:679)
==1025895==    by 0x3FC5E7: CRPCCommand::CRPCCommand(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RPCHelpMan (*)())::{lambda(JSONRPCRequest const&, UniValue&, bool)#1}::operator()(JSONRPCRequest const&, UniValue&, bool) const [clone .isra.0] (server.h:101)
==1025895==    by 0x3FC92F: __invoke_impl<bool, CRPCCommand::CRPCCommand(std::string, RpcMethodFnType)::<lambda(const JSONRPCRequest&, UniValue&, bool)>&, const JSONRPCRequest&, UniValue&, bool> (invoke.h:61)
==1025895==    by 0x3FC92F: __invoke_r<bool, CRPCCommand::CRPCCommand(std::string, RpcMethodFnType)::<lambda(const JSONRPCRequest&, UniValue&, bool)>&, const JSONRPCRequest&, UniValue&, bool> (invoke.h:114)
==1025895==    by 0x3FC92F: std::_Function_handler<bool (JSONRPCRequest const&, UniValue&, bool), CRPCCommand::CRPCCommand(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RPCHelpMan (*)())::{lambda(JSONRPCRequest const&, UniValue&, bool)#1}>::_M_invoke(std::_Any_data const&, JSONRPCRequest const&, UniValue&, bool&&) (std_function.h:290)
==1025895==    by 0x4B77FF: operator() (std_function.h:591)
==1025895==    by 0x4B77FF: ExecuteCommand(CRPCCommand const&, JSONRPCRequest const&, UniValue&, bool) (server.cpp:512)
==1025895==    by 0x4B8CF7: ExecuteCommands (server.cpp:477)
==1025895==    by 0x4B8CF7: CRPCTable::execute(JSONRPCRequest const&) const (server.cpp:497)
==1025895==    by 0x4B8DE6: JSONRPCExec(JSONRPCRequest const&, bool) (server.cpp:353)
==1025895==    by 0x59B80B: HTTPReq_JSONRPC(std::any const&, HTTPRequest*) (httprpc.cpp:218)
==1025895==    by 0x5A95E9: operator() (std_function.h:591)
==1025895==    by 0x5A95E9: operator() (httpserver.cpp:62)
==1025895==    by 0x5A95E9: WorkQueue<HTTPClosure>::Run() (httpserver.cpp:117)
==1025895==    by 0x5A5594: HTTPWorkQueueRun(WorkQueue<HTTPClosure>*, int) (httpserver.cpp:415)

@orangesurf
Copy link

A miner (earning coinbase rewards to tb1q2dsc... is currently overwhelmingly dominant on testnet4.

image

Since block 000000000000000167286a4bea3bca60d6c3ab2cbbef79537bdf07b6420a2d2d / 54780 this miner has mined every block with a difficulty = 1.0

image

@fjahr fjahr force-pushed the 2024-10-t4-reorg-miner branch from 7864871 to 2e3fcb0 Compare November 24, 2024 15:21
@fjahr
Copy link
Contributor Author

fjahr commented Nov 24, 2024

Now, testnet4 coins are actively traded

@garlonicon Can you provide a link? Otherwise I don't think I can follow your ideas how they can be used for a open test network without creating other issues. I am happy to review a proposal if you write it up in more detail.

@fjahr
Copy link
Contributor Author

fjahr commented Nov 24, 2024

In 7864871. If I fire a getblocktemplate before sync is done, I get a segfault.

Valgrind stack trace

Thanks @Davidson-Souza , good find! I pushed an update that prevents the rollback during IBD and that should fix it.

@fjahr
Copy link
Contributor Author

fjahr commented Nov 24, 2024

@orangesurf Thanks for the insight, I have seen some your comments on Twitter too, just pretty busy at the moment :)

It seems now the latest block with a real difficulty is 55100 so from time to time real miners still get luck but it seems to be much less frequently than in the beginning. This might be due to honest miners pointing their hashrate elsewhere or just shutting them down. At least that's the only explanation I have for seeing less non-difficulty 1 blocks.

@1440000bytes

This comment was marked as abuse.

@Sjors
Copy link
Member

Sjors commented Dec 18, 2024

I'd like to try this with Stratum v2 which doesn't use the getblocktemplate RPC. Can you move the implementation of this logic to a deeper level, either the createNewBlock implementation in interfaces.cpp or CreateNewBlock in miner.cpp? Preferable on a recent master.

@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

@DrahtBot
Copy link
Contributor

⌛ There hasn't been much activity lately and the patch still needs rebase. What is the status here?

  • Is it still relevant? ➡️ Please solve the conflicts to make it ready for review and to ensure the CI passes.
  • Is it no longer relevant? ➡️ Please close.
  • Did the author lose interest or time to work on this? ➡️ Please close it and mark it 'Up for grabs' with the label, so that it can be picked up in the future.

@average-gary
Copy link

https://github.com/average-gary/bitcoin-garrys-mod/tree/testnet4-reorg-sv2

I had Claude implement changes from this PR with https://github.com/Sjors/bitcoin/tree/sv2 branch so I could use Sv2 for mining. Hoping to leave it hashing to see if we can't reduce the difficulty on TN4 to normalized levels.

I mined this block with it: https://mempool.space/testnet4/block/0000000000000000b92517e2fe1c4d68d8dcf5ad0068297355d7adfd867fe95c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants