EAWF / BTC-Toolbox

A collection of simple programming tools to aid entities in the action of accepting BTC payments directly to HD Wallets within their control.
The Unlicense
9 stars 6 forks source link

getBTCBalance returns NULL for addresses that have not been seen on the Blockchain #26

Closed EAWF closed 4 years ago

EAWF commented 4 years ago

Running the query for an address which has never been seen by the blockchain returns "[]".

It seems there are ~5 possible conditions at play:

How can this be handled so as to report back to the calling program the current status of the address?

Septem151 commented 4 years ago

I just ran a test using an address never seen before and it didn’t return null. It returned 0.00000000 as expected, since if the query returns no UTXOs it doesn’t iterate over anything, but still returns 0 because it’s returning balance variable which has been set to 0.

Can you provide an example of a test run you’ve done showing when null is returned?

EAWF commented 4 years ago

My mistake...it was when I ran the query from the command line that it produced the [].

I guess it only matters that the amount of 0 is returned in the long run.