Post
Topic
Board Altcoin Discussion
Re: Confirmations in the source code
by
Heisenberg_Hunter
on 27/02/2019, 18:25:13 UTC
Your question is pretty vague to be answered and doesn't seem to make sense actually. For the qt wallet to show the balances, you need to configure minconf option in the configuration file since those are the options which makes the wallet to show the balances. If you set the minconf=1 then the wallet will show the transaction which has got 1 confirmation from the network in the balances. If you set it to 0, you will see transactions with 0 confirmations. Unconfirmed transactions cannot be spent by qt wallet. If your transaction is a coinbase tx, then you need 100 confirmations from the network and here is the relevant code for that present in consensus.h

Code:
/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
static const int COINBASE_MATURITY = 100;

I have read somewhere an attacker can build a raw transaction for unconfirmed transactions, but if you do so and other nodes find that out, your node's IP address will get banned from using the network (in simple terms it would be blacklisted). I assume This code is present in the validations.cpp and can be seen here.

Code:
for (CTxMemPool::txiter ancestorIt : setAncestors)
        {
            const uint256 &hashAncestor = ancestorIt->GetTx().GetHash();
            if (setConflicts.count(hashAncestor))
            {
                return state.DoS(10, false,

                     strprintf("%s spends conflicting transaction %s",
                                           hash.ToString(),
                                           hashAncestor.ToString()));
            }
        }

Here the double spend transaction will be included in setConflict and the node which relayed them will be banned.

In my case, I have the transaction stuck in my altcoin wallet, but the transactions never get confirmed, they are staying in pending stage.

If you didn't specify enough higher fees, the transaction should be staying in the mempool which would be picked up by miner later to add to the block.

Also, move this thread to altcoin section to get better answer here https://bitcointalk.org/index.php?board=67.0
Pretty much bad idea. Do you think this would be answered in the Altcoin board? The spammers present there doesn't even know what a confirmation is! A single question present there about pre-mining is solely being answered by me for past 2 days and there isn't even one guy jumped in to learn what the OP is saying. Also I believe the question is based on a bitcoin fork, so asking questions here is probably right in my opinion.