MetacoSA / QBitNinja

An Open Source and powerful blockchain API
MIT License
68 stars 42 forks source link

TaskCanceledException When Getting Balance on TestNet #93

Closed msharp19 closed 5 years ago

msharp19 commented 5 years ago

Message: System.AggregateException : One or more errors occurred. ----> System.Threading.Tasks.TaskCanceledException : A task was canceled.

I have 4.1.1.98 NBitcoin & 1.0.3.47 QBitNinjaClient installed.

This happens at points daily for anywhere from 1-5 hours. This is thrown on the following line: var balance = await client.GetBalance(new BitcoinPubKeyAddress(ssAddress), ssIsUnspentOnly); Then after a period of time all of a sudden is fine again.

I have 2 integration unit tests that make this call, one for TestNet (where this fails) and one for MainNet where it always works fine - exactly the same code but the network is different. MainNet works absolutely fine all the time but TestNet is so unreliable. I cannot drill into these errors any further and I am not sure what to do as I cannot have a test site that constantly has this call failing - I cannot test properly. To be clear I am using QBitNinjaClient client = new QBitNinjaClient(Network.TestNet);

So I did some further drilling before I made this post and have found that https://tapi.qbit.ninja/ comes back as Service Unavailable. I would imagine this is the issue... The only weird thing is tho that the create public key still works via this api!?!

If this is about the server going down, is there some sort of downtime planned? Is there somewhere I can find out about this or is the server just overloaded or something.. what is going on?

Alternatively is there something I am doing wrong?

NicolasDorier commented 5 years ago

I am badly maintaining the servers and I don't have time to look over it. The best workaround is for you to have your own server, or use https://github.com/dgarage/NBXplorer/ that is better adapted for managing a wallet. (easy to install and do not require indexing the whole chain on Azure)

msharp19 commented 5 years ago

Ok, I will have a look into that then! Thanks very much for getting back to me so quickly.

NicolasDorier commented 5 years ago

Take a look at this code example, https://programmingblockchain.gitbook.io/programmingblockchain/wallet/web-api

msharp19 commented 5 years ago

Thanks for pointing me in the right direction!