Author

Topic: can't find some transaction in my bitcoind (Read 1039 times)

kjj
legendary
Activity: 1302
Merit: 1026

Code:
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1002,7 +1002,7 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock
                 if (view.GetCoins(hash, coins))
                     nHeight = coins.nHeight;
             }
-            if (nHeight > 0)
+            if (nHeight >= 0)
                 pindexSlow = FindBlockByHeight(nHeight);
         }
     }

Just FYI, this is a dangerous patch and should not be used.  The genesis generation should not be in your index.  If it is in your index, your node is vulnerable to a fork attack.  An extremely unlikely fork, to be sure, but a hard one.

If you really need the information from that block, you should get it out-of-band, not from your client.
legendary
Activity: 4228
Merit: 1313
If I understand your question correctly, my understanding is that the reference client does not include block 0 in its database (e.g. the list of known transactions etc) at startup because it is structured differently than the other blocks since it is not a "normal" block.  This could be why you can not get information on that transaction with bitcoind.   Smiley




This transactino is in block 0. See: http://blockexplorer.com/tx/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b.

Should I remove all data and start with a empty bitcoind to get all transaction?
member
Activity: 64
Merit: 10
btc.com

I do recall reading somewhere that there is perhaps a bug that prevents this particular tx (i.e. in block 0) from being seen via "getrawtransaction" - perhaps Pieter would know more about this.

At the same time I would be curious to know if "-blocknotify=cmd" would work (is that how blockexplorer got its information?).

In any case that 50 BTC *cannot* be spent (so no need to worry about this tx as being an UTXO).


can't find raw tx:
1. pblocktree->ReadTxIndex(hash, postx) read failure, tx is NOT in pblocktree.
2. view.GetCoins(hash, coins) get failure too, this tx's coin is not in CCoinsViewCache.

because this tx is in block 0, so I modify source code as below:

--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1002,7 +1002,7 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock
                 if (view.GetCoins(hash, coins))
                     nHeight = coins.nHeight;
             }
-            if (nHeight > 0)
+            if (nHeight >= 0)
                 pindexSlow = FindBlockByHeight(nHeight);
         }
     }

rebuild it and run, still not work.

Write tx index code is in function CBlock::ConnectBlock:

bool CBlock::ConnectBlock(CValidationState &state, CBlockIndex* pindex, CCoinsViewCache &view, bool fJustCheck) {
...
    if (fTxIndex)
        if (!pblocktree->WriteTxIndex(vPos))
            return state.Abort(_("Failed to write transaction index"));
...
}

maybe forget to ConnectBlock 'GenesisBlock', so I try bitcoind -loadblock="~/Library/Application\ Support/Bitcoin/blocks/blk00000.dat", and it works:

$ bitcoind getrawtransaction 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b 1
{
    "hex" : "01000000010000000000000000000000000000000000000000000000000000000000000000fffff fff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c 6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b7 3ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909 a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11 d5fac00000000",
    "txid" : "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "coinbase" : "04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f7 2206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73",
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 50.00000000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3 8c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f OP_CHECKSIG",
                "hex" : "4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4ce f38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac",
                "reqSigs" : 1,
                "type" : "pubkey",
                "addresses" : [
                    "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
                ]
            }
        }
    ],
    "blockhash" : "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
    "confirmations" : 238323,
    "time" : 1231006505,
    "blocktime" : 1231006505
}


but after I restart bitcoind, it does not work anymore.
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer

I do recall reading somewhere that there is perhaps a bug that prevents this particular tx (i.e. in block 0) from being seen via "getrawtransaction" - perhaps Pieter would know more about this.

At the same time I would be curious to know if "-blocknotify=cmd" would work (is that how blockexplorer got its information?).

In any case that 50 BTC *cannot* be spent (so no need to worry about this tx as being an UTXO).
member
Activity: 64
Merit: 10
btc.com
Nope but by default "getrawtransaction" will not allow you to access tx's that do not involve your own addresses (http://bitcoin.stackexchange.com/questions/9147/getrawtransaction-error-code-5 for details and how to fix this).

Getrawtransaction queries the blockchain, not your wallet. Whether the transaction is in your wallet is irrelevant; without txindex=1, it only works for unspent transactions (slowly). With txindex=1, it will work for any transaction.

I have run bitcoind -txindex=1 -reindex=1 first, than bitcoind -txindex=1 --daemon. But still can't find this transaction:

$ bitcoind getrawtransaction 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b 1
error: {"code":-5,"message":"No information available about transaction"}

This transactino is in block 0. See: http://blockexplorer.com/tx/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b.

Should I remove all data and start with a empty bitcoind to get all transaction?
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
Nope but by default "getrawtransaction" will not allow you to access tx's that do not involve your own addresses (http://bitcoin.stackexchange.com/questions/9147/getrawtransaction-error-code-5 for details and how to fix this).

Getrawtransaction queries the blockchain, not your wallet. Whether the transaction is in your wallet is irrelevant; without txindex=1, it only works for unspent transactions (slowly). With txindex=1, it will work for any transaction.

Oh - thanks for that clarification (funnily enough I gave the link to the correct information that was in fact your answer but read it wrong) - so presumably with txindex=1 it will work quickly for any transaction?
legendary
Activity: 1072
Merit: 1181
Nope but by default "getrawtransaction" will not allow you to access tx's that do not involve your own addresses (http://bitcoin.stackexchange.com/questions/9147/getrawtransaction-error-code-5 for details and how to fix this).

Getrawtransaction queries the blockchain, not your wallet. Whether the transaction is in your wallet is irrelevant; without txindex=1, it only works for unspent transactions (slowly). With txindex=1, it will work for any transaction.
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
Nope. I used cmd "bitcoind getrawtransaction" and got some txs that not belong to my wallet.

Is there any filters in bitcoind that fileter out transactions which came from SatoshiDICE's address?

Nope but by default "getrawtransaction" will not allow you to access tx's that do not involve your own addresses (http://bitcoin.stackexchange.com/questions/9147/getrawtransaction-error-code-5 for details and how to fix this).
member
Activity: 64
Merit: 10
btc.com
tx id: 85966ed46764440edf4fa73ee95c628d5a92b45824ae957a04aa889803df0fc9

can't find it in my bitcoind:

$ bitcoind getrawtransaction 85966ed46764440edf4fa73ee95c628d5a92b45824ae957a04aa889803df0fc9 1
error: {"code":-5,"message":"No information available about transaction"}

It is exist on blockchain: https://blockchain.info/tx/85966ed46764440edf4fa73ee95c628d5a92b45824ae957a04aa889803df0fc9

This tx's input address is: 1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp (SatoshiDICE 48%), is this the reason why it is not in my bitcoind?

Are either of the output addresses part of your wallet?
Nope. I used cmd "bitcoind getrawtransaction" and got some txs that not belong to my wallet.

Is there any filters in bitcoind that fileter out transactions which came from SatoshiDICE's address?
legendary
Activity: 3472
Merit: 4801
tx id: 85966ed46764440edf4fa73ee95c628d5a92b45824ae957a04aa889803df0fc9

can't find it in my bitcoind:

$ bitcoind getrawtransaction 85966ed46764440edf4fa73ee95c628d5a92b45824ae957a04aa889803df0fc9 1
error: {"code":-5,"message":"No information available about transaction"}

It is exist on blockchain: https://blockchain.info/tx/85966ed46764440edf4fa73ee95c628d5a92b45824ae957a04aa889803df0fc9

This tx's input address is: 1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp (SatoshiDICE 48%), is this the reason why it is not in my bitcoind?

Are either of the output addresses part of your wallet?
member
Activity: 64
Merit: 10
btc.com
tx id: 85966ed46764440edf4fa73ee95c628d5a92b45824ae957a04aa889803df0fc9

can't find it in my bitcoind:

$ bitcoind getrawtransaction 85966ed46764440edf4fa73ee95c628d5a92b45824ae957a04aa889803df0fc9 1
error: {"code":-5,"message":"No information available about transaction"}

It is exist on blockchain: https://blockchain.info/tx/85966ed46764440edf4fa73ee95c628d5a92b45824ae957a04aa889803df0fc9

This tx's input address is: 1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp (SatoshiDICE 48%), is this the reason why it is not in my bitcoind?
Jump to: