MetacoSA / NBitcoin

Comprehensive Bitcoin library for the .NET framework.
MIT License
1.87k stars 846 forks source link

Fixing that Id should be increment when batching requests with certain RPC providers. #1208

Closed dlebee closed 5 months ago

dlebee commented 5 months ago

We are currently transitioning our RPCs to Chainstack. When multiple requests are combined into a single HTTP request, we ensure that each RPC request is assigned a unique ID.

NicolasDorier commented 5 months ago

@dlebee can you confirm if it works? Maybe the results come back unordered and something else need to change (unsure)

dlebee commented 5 months ago

I only confirmed its no longer crashing, we had to use child class and reflection to fix it for now, so I can confirm tomorrow.

right now the batch code assumes the response code in the same order they are sent, so I assume the order should remain the same?

NicolasDorier commented 5 months ago

I think the assumption that the order is the same hold with a real bitcoin core, but fail with Chainstack. In such case, you should just order the responses based on the id.