Remove unnecessary pow updates in rpc#4393
Conversation
|
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 ? |
|
Untested ACK. Those calls look redundant. |
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4393_8ec7329807a6ce96188c6e6dd3af84602499b07f/ for binaries and test log. |
|
NAK. Obviously wrong. Read the code. If called frequently, those static vars act as a cache. |
|
I see, so removing this would cause the cached nTime to be used. |
|
Undo ACK; You're right, @jgarzik. |
|
Sharp catch @jgarzik |
The 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.