Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batched test RPC calls cause incorrect reports #864

Closed
Kixunil opened this issue May 27, 2020 · 11 comments
Closed

Batched test RPC calls cause incorrect reports #864

Kixunil opened this issue May 27, 2020 · 11 comments

Comments

@Kixunil
Copy link

Kixunil commented May 27, 2020

Batching various calls during RPC test causes that if one of them fails, all of them fail. This interferes with ability to discover the capabilities correctly.

@NicolasDorier
Copy link
Collaborator

This is not the case, see the test I just added.

@NicolasDorier
Copy link
Collaborator

I think your problem is that you send an HTTP error code if any of the request does not work.
Batched request never send HTTP error code

@Kixunil
Copy link
Author

Kixunil commented May 28, 2020

Hmm, this is interesting. Not returning 404 actually looks like a bug in bitcoind - someone missed a comment about not using error code publicly and it looks like the mapping code doesn't iterate over results, but it should. The new version of bitcoind with native command filtering will apparently behave same as my proxy, so the code will still break eventually.

I'd agree that it'd be nicer to be able to batch the requests. I guess the discussion should be handled with core devs.

@NicolasDorier
Copy link
Collaborator

NicolasDorier commented May 28, 2020

@Kixunil do I understand correctly that their code mean that if one of the batched request fails for permission, then ALL the response of the requests are not sent out?

If so that's problematic, as some call may have succeed but the caller can't know.

@Kixunil
Copy link
Author

Kixunil commented May 28, 2020

Yes, exactly that. You can see in the linked code that it pre-checks all the methods in a for loop and if it hits any forbidden method, it bails out right away with 403.

@Kixunil
Copy link
Author

Kixunil commented Aug 7, 2020

I've been thinking about it and since 0.20.0 is out, it basically means that using batching in NBitcoin for scanning is essentially a bug. There are at least two projects tight now that protect their nodes using whitelisting. As a result NBXplorer, which uses NBitcoin doesn't have the correct information about capabilities which in turn causes BTCPayServer to disable PayJoin.

So we have to either sacrifice privacy or security.

Un-batching would resolve the issue and the performance penalty should be reasonably low. Capabilities are scanned only at the beginning, so it's constant increase. If the time becomes too long the requests could be launched in parallel. However I don't believe it will be needed.

Is there anything I, non-C# dev, can do to help getting un-batched scan into NBitcoin/NBXplorer as soon as possible?

Kixunil added a commit to debian-cryptoanarchy/cryptoanarchy-deb-repo-builder that referenced this issue Aug 7, 2020
This is a temporary fix until
MetacoSA/NBitcoin#864 is resolved.
@NicolasDorier
Copy link
Collaborator

@Kixunil I think that's OK to fallback to non-batched. I will check what I can do.

@NicolasDorier
Copy link
Collaborator

fixed in .51, we fallback to serial if batching fails.

@NicolasDorier
Copy link
Collaborator

pushed NBXplorer with the new nbitcoin on 2.1.41

@NicolasDorier
Copy link
Collaborator

please open issue on NBXplorer repo if you still have the problem

@Kixunil
Copy link
Author

Kixunil commented Aug 9, 2020

Thanks a lot! Just sent some sats. :)

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

No branches or pull requests

2 participants