Remove unnecessary pow updates in rpc #4393
pull jtimon wants to merge 1 commits into bitcoin:master from jtimon:rpcpow changing 1 files +0 −4-
jtimon commented at 1:45 pm on June 23, 2014: contributorThe time is already set in CreateNewBlock and the nonce is set to zero for no reason (never used after that assignment). In testnet mode the nbits (and thefore target, which is the same with another type) could be affected in testnet mode after finding the block with that additional UpdateTime (which may update nBits), which doesn’t seem very safe. This is not tested yet, but seems straightforward to review and test.
-
Remove unnecessary pow updates in rpc 8ec7329807
-
jtimon commented at 10:42 am on June 25, 2014: contributor
This is not as risky as it may look like, in fact I think it is pretty save and if anything the previous behavior is the wrong one (not saying it doesn’t need testing).
How much time can pass from https://github.com/bitcoin/bitcoin/blob/master/src/miner.cpp#L308 (called from https://github.com/bitcoin/bitcoin/blob/master/src/rpcmining.cpp#L359) to https://github.com/bitcoin/bitcoin/blob/master/src/rpcmining.cpp#L369 ? The nonce is set to zero in both cases and the bits can only change in the second UpdateTime if we’re on testnet.
-
sipa commented at 10:49 am on June 25, 2014: memberUntested ACK. Those calls look redundant.
-
BitcoinPullTester commented at 9:35 pm on June 25, 2014: noneAutomatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4393_8ec7329807a6ce96188c6e6dd3af84602499b07f/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
-
jgarzik commented at 2:07 pm on June 26, 2014: contributorNAK. Obviously wrong. Read the code. If called frequently, those static vars act as a cache.
-
jtimon commented at 2:19 pm on June 26, 2014: contributorI see, so removing this would cause the cached nTime to be used. I think removing the nNonce = 0 assignment is safe though, no? A cached zero should be as good as a fresh one.
-
jtimon closed this on Jun 26, 2014
-
jtimon deleted the branch on Jun 26, 2014
-
MarcoFalke locked this on Sep 8, 2021
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 12:12 UTC
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 12:12 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me