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.