question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

a negative number of confirmations?

See original GitHub issue

Hello,

I am currently testing my app built with bit. I’m using the bitcoin testnet and I noticed the function .get_balance took in account unconfirmed transactions. I would like the transactions to have at least one confirmation (and if possible a configurable number) to be counted in the balance. I then tried to create my own function:

    def fetch_balance(self):
        balance = 0
        for unspent in self.key.get_unspents():
            print(unspent)
            if unspent.confirmations >= BitcoinTicket.validations:
                balance += unspent.amount
        return balance

Here is what I got from the print:

Unspent(amount=50000, confirmations=-1805169, script='a914b98e3212e5afe4363942ce9b7b21c7057241782f87', txid='d594eb22bafcb8363271734e6d2e71d35e72cffc635e64f4f7b840ca605f6283', txindex=0, segwit=True)
Unspent(amount=1, confirmations=-1804929, script='a914b98e3212e5afe4363942ce9b7b21c7057241782f87', txid='194e7b59a8ea2fa1ce21664a81784dc7f7cf0cde0892df2356ff6da34b14f314', txindex=0, segwit=True)

According to this website: https://blockstream.info/testnet/address/2NAAMLhL3gGsPb67LwZ3bgPkbX93j8e3Vn9 I should have get 6 and 246 confirmations. What does that mean? Is this only for testnet?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pedr0-frcommented, Aug 8, 2020

I think you can leave it open as it will be closed when #129 is merged

1reaction
pedr0-frcommented, Aug 8, 2020

@bjarnemagnussen The PR I submitted (#129) just now should fix it. Also noticed that the confirmations from the BlockstreamAPI were off by one.

@Th0rgal , as @bjarnemagnussen said, that’s a bug that won’t occur on mainnet due to #120 . For now, just assume that a negative number of confirmations means zero confirmations.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Negative number of confirmations for a testnet transaction on ...
I have two questions: Why is there such a difference in the number of confirmations? Is there something wrong with this transaction?
Read more >
Negative confirmation definition - AccountingTools
A negative confirmation is a document issued by an auditor to the customers of a client company. The letter asks the customers to...
Read more >
What is a negative confirmation? - Universal CPA Review
Negative confirmations are different from positive confirmations as they will not require a response by the recipient. They are only asked to indicate...
Read more >
What's the difference between positive and negative ...
Negative confirmations request a response only if the amount stated is incorrect. For example, a confirmation request letter indicates that your ...
Read more >
Negative Confirmation - Overview, Types, When To Use
Negative confirmation is a common industry practice for auditors to gather audit evidence from external stakeholders. A negative confirmation is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found