Removed because these RPCs are for tests only and are now unused
[RPC] Remove waitforblock and waitfornewblock #10519
pull achow101 wants to merge 1 commits into bitcoin:master from achow101:rm-waitforblock-rpcs changing 2 files +0 −84-
achow101 commented at 4:36 PM on June 3, 2017: member
- fanquake added the label RPC/REST/ZMQ on Jun 4, 2017
-
NicolasDorier commented at 7:11 AM on June 5, 2017: contributor
I did not know it existed, but I think it is very useful, I would use it if I am sure it stays.
Easier to use than configuring blocknotify or ZMQ.
-
laanwj commented at 1:50 PM on June 5, 2017: member
Would be nice to have a test for them, if we keep them.
-
jnewbery commented at 3:52 PM on June 5, 2017: contributor
@jnewbery Do you have any use for these? Otherwise, I'd be fine with removing.
Not currently, although they may be useful for some tests. On the other hand, it's just as easy to call
getbestblockhashorgetblockin a loop until the desired block has been accepted.I have no issue with these being removed or staying (as long as they remain hidden and not part of the public API).
-
maflcko commented at 5:10 PM on June 5, 2017: member
I am ok with removing or keeping and adding tests. Though, it seems the functionality is redundant:
- waitfornewblock() ---> waitforblockheight(current_height + 1)
- waitforblock(hash) ---> waitforblockheight(hash_height) && getblockhash(hash_height) == hash
-
maflcko commented at 5:10 PM on June 5, 2017: member
utACK 5fc1253bb8b95d34880e565cb2aa193caab06d71
- maflcko added the label Tests on Jun 5, 2017
-
theuni commented at 5:23 PM on June 5, 2017: member
@MarcoFalke They're intended to be atomic operations as we were dealing with some test race issues a while back. They're indeed redundant if atomicity isn't needed.
- achow101 force-pushed on Jun 5, 2017
-
NicolasDorier commented at 1:23 AM on June 6, 2017: contributor
well, I think they are useful. Instead of polling for new block I would definitively use that. I just did not know it existed.
-
sipa commented at 7:02 AM on June 6, 2017: member
utACK b69194916c5fc8ebdaebb04e3cc6c4aab37e1c49
- laanwj added this to the milestone 0.16.0 on Jul 25, 2017
- achow101 force-pushed on Aug 15, 2017
-
achow101 commented at 9:56 PM on August 15, 2017: member
rebased
-
promag commented at 7:27 AM on August 16, 2017: member
utACK b691949.
IMO blocking or long pool RPC/REST calls should be avoided.
-
NicolasDorier commented at 2:43 AM on August 17, 2017: contributor
I think this should not be removed, but documented. Right now the only way to get block notification is to connect to to the P2P layer or use ZeroMQ. Both requires additional configuration. (also, I have never managed to make ZeroMQ notifications works with a .NET Client) I end up connecting to my node by P2P to get new blocks.
I would have known that such RPC method existed, I would have definitively used it in place of my current solution.
I think a
WaitWalletTransactionwould also be higly helpful, as right now, I either end up with pollinglisttransactionsor even implement my own tracking not relying on Core, just because pollinglisttransactionis not reactive enough. -
luke-jr commented at 2:48 AM on August 17, 2017: member
@NicolasDorier FYI there is also
blocknotify -
NicolasDorier commented at 4:25 AM on August 17, 2017: contributor
Same problem as ZeroMQ. It requires additional configuration on the bitcoin node, but it is even worse, because you need additional plumbing code so the
blocknotifyprogram can notify the program interested by the event (by pipe, other queueing mechanism, or HTTP callback which add a dependency to curl, which is not easy to install on all environments).... It add one more layer to the problem than ZeroMQ, this is a pain.WaitBlock/WaitWalletTransaction makes things so much easy, it introduces zero dependency and require zero conf. Please do not remove it. :/
-
jnewbery commented at 2:42 PM on August 17, 2017: contributor
@NicolasDorier - Be careful about using these RPCs in product code. They were introduced as test tools only and there is no guarantee that they will work as you expect. For example, I just managed to break bitcoind's RPC server by running 4
waitfornewblockrequests in parallel. Any request after that fails, and I don't think there's any way to cancel thewaitfornewblockrequests.There are also no tests for them and they are hidden debug RPCs, so it's likely you'd be the only one using them, which increases the risk of regressions.
I'm slightly averse to long-polling RPCs in general, but I'm also not too concerned if these stay (with the provisos above).
-
promag commented at 3:10 PM on August 17, 2017: member
Agree with @jnewbery. You can have a small utility to listen zmq messages and forward in the most suitable transport for your .NET app.
And I think doing that to some kind of queue would benefit both parts, specially if the queue has means to easily notify your app.
-
NicolasDorier commented at 7:54 AM on August 18, 2017: contributor
@jnewbery I know there is a maximum number of concurrent requests, this can be notified to the user when it happens. @promag I enumerated the problems of using ZMQ above. This just make it harder to build stuff on top of Core by making it require more configuration and dependency. It is easier to connect to the P2P layer and listen for new block than it is to setup ZMQ, and listening through it with a cross plateform library.
-
promag commented at 8:05 AM on August 18, 2017: member
making it require more configuration @NicolasDorier IMO that´s fine. Even if there was websocket support, it should have/require configuration before it could be used. You also configure RPC right?
and dependency.
I agree that there should be pure HTTP notifications but for the moment adding some zmq client to the playground doesn't seem like a real issue.
Another option is to allow only one waitforblock and waitfornewblock consumer?
-
NicolasDorier commented at 9:03 AM on August 18, 2017: contributor
@promag no I do not configure RPC. If bitcoin is running with default parameters, I can connect to it through the wellknown port and wellknown cookiefile.
I do not use either blocknotify and ZMQ because it makes my users config stuff and add dependencies. This requires me to document and to know how to install those dependencies on the plateforms I support (as well as testing them).
At one point it will be easier to develop a wallet connected via P2P to a trusted node from scratch than using RPC, which is a shame.
- achow101 force-pushed on Sep 19, 2017
-
achow101 commented at 2:11 AM on September 19, 2017: member
Rebased
- maflcko removed this from the milestone 0.16.0 on Nov 22, 2017
-
NicolasDorier commented at 4:09 PM on January 10, 2018: contributor
If #7949 would be merged, I would see no problem removing this rpc method.
-
laanwj commented at 6:54 PM on March 7, 2018: member
Needs rebase, if still relevant. (seems to have been dorment for a long time)
-
NicolasDorier commented at 7:12 PM on March 7, 2018: contributor
Seems like nobody is using it, and on my side I am not at ease using something that might disappear tomorrow, so feel free to delete it.
But I still think it is a shame, this is the most useful RPC call ever! :(
- achow101 force-pushed on Mar 7, 2018
-
achow101 commented at 7:17 PM on March 7, 2018: member
Rebased
-
in src/rpc/blockchain.cpp:1572 in c26ffdb5ad outdated
1568 | @@ -1649,8 +1569,6 @@ static const CRPCCommand commands[] = 1569 | /* Not shown in help */ 1570 | { "hidden", "invalidateblock", &invalidateblock, {"blockhash"} }, 1571 | { "hidden", "reconsiderblock", &reconsiderblock, {"blockhash"} }, 1572 | - { "hidden", "waitfornewblock", &waitfornewblock, {"timeout"} }, 1573 | - { "hidden", "waitforblock", &waitforblock, {"blockhash","timeout"} }, 1574 | { "hidden", "waitforblockheight", &waitforblockheight, {"height","timeout"} },
maflcko commented at 2:11 AM on March 8, 2018: memberutACK c26ffdb5adcbab58ab12509d22123b96ae2ae4a8, but I'd prefer if we removed all of their kind.
nopara73 commented at 11:52 AM on March 8, 2018: noneNACK.
waitfor...RPC calls are very useful. They should be documented rather than removed. If they ruin some coding best practices, then remove it, otherwise don't.Imagine a wallet daemon that gives you p2pkh only through RPC, it gives you p2wpkh only through ZMQ and it gives you p2wpkh over p2sh only through websockets. Sure that works, but you must have 3 different communication channels properly implemented and configured in order to get all three of them. The more communication protocols a software uses the less reliable it is. Networking may be the trickiest coding challenge, where so many little things can go wrong.
https://github.com/MetacoSA/NBitcoin/pull/363 https://github.com/nopara73/MagicalCryptoWallet/issues/32 https://github.com/nopara73/MagicalCryptoWallet/issues/40
adf30f96bfRemove waitforblock and waitfornewblock RPCs
Removed because these RPCs are for tests only and are unused
achow101 force-pushed on Mar 8, 2018maflcko added the label Needs rebase on Jun 6, 2018laanwj commented at 10:56 AM on August 31, 2018: memberAs both @NicolasDorier and @nopara73 are apparently using these calls (or would if they aren't goin to be removed) and think they are useful, I don't think they should be removed, then. Closing.
laanwj closed this on Aug 31, 2018nopara73 commented at 1:29 PM on August 31, 2018: nonePersonally we were using but removed them, due to this change, so it's fine by me. Although I'd still not be happy if the user space breaks (like ever.) But that's more an API design philosophical question.
jnewbery commented at 2:18 PM on August 31, 2018: contributorAlthough I'd still not be happy if the user space breaks (like ever.)
These RPC methods were introduced as hidden calls for testing only. They shouldn't be used in production systems. They should either be removed (since they're unused in testing now), or made unhidden and fully supported. I'd vote for removing them.
maflcko added the label Up for grabs on Aug 31, 2018maflcko commented at 2:44 PM on August 31, 2018: memberMarked up for grabs for someone to address my feedback: #10519 (review)
laanwj removed the label Needs rebase on Oct 24, 2019bitcoin locked this on Dec 16, 2021maflcko removed the label Up for grabs on Dec 12, 2023
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: 2026-04-13 15:15 UTC
More mirrored repositories can be found on mirror.b10c.me