Closed periodic1236 closed 6 years ago
My initial theory was wrong (though I didn't see anything in the code to suggest it in the first place).
I checked 1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp (3.2M txs) and other SatoshiDice betting addresses and my local node indexed all of them correctly.
What's special about 1VayNert? It's received a ton of send-to-self change outputs? Should I reindex and report back?
Address indexes include pay-to-script-hash and pay-to-public-key-hash addresses. It looks like some of the transactions are pay-to-public-key.
txid:
txid: 39a7d53f4cf02c35982ee87fc0aebb39cf00bd2267790934bfab952d6abeea1c
hex:
0100000001014f10a000afecc431427cc9063190e2907c72788294d4c9a30ccd8e4558a7c50000000049483045022100fa0afe2190a35c6982a6a814121df996a0849d1728f8ccd581116f3538e3126b022058638283465dba1fbd156c549b9f13d377dfa1eca4498f654322ccb36093e3e801ffffffff0263151f0800000000434104a39b9e4fbd213ef24bb9be69de4a118dd0644082e47c01fd9159d38637b83fbcdc115a5d6e970586a012d1cfe3e3a8b1a3d04e763bdc5a071c0e827c0bd834a5acbaac0f00000000001976a914f095ea5e67b15dd4629d798d10b8b10da0453b4788ac00000000
bitcore tx object:
> tx.toObject()
{ hash: '39a7d53f4cf02c35982ee87fc0aebb39cf00bd2267790934bfab952d6abeea1c',
version: 1,
inputs:
[ { prevTxId: 'c5a758458ecd0ca3c9d4948278727c90e2903106c97c4231c4ecaf00a0104f01',
outputIndex: 0,
sequenceNumber: 4294967295,
script: '483045022100fa0afe2190a35c6982a6a814121df996a0849d1728f8ccd581116f3538e3126b022058638283465dba1fbd156c549b9f13d377dfa1eca4498f654322ccb36093e3e801',
scriptString: '72 0x3045022100fa0afe2190a35c6982a6a814121df996a0849d1728f8ccd581116f3538e3126b022058638283465dba1fbd156c549b9f13d377dfa1eca4498f654322ccb36093e3e801' } ],
outputs:
[ { satoshis: 136254819,
script: '4104a39b9e4fbd213ef24bb9be69de4a118dd0644082e47c01fd9159d38637b83fbcdc115a5d6e970586a012d1cfe3e3a8b1a3d04e763bdc5a071c0e827c0bd834a5ac' },
{ satoshis: 1027258,
script: '76a914f095ea5e67b15dd4629d798d10b8b10da0453b4788ac' } ],
nLockTime: 0 }
first output script:
> s
<Script: 65 0x04a39b9e4fbd213ef24bb9be69de4a118dd0644082e47c01fd9159d38637b83fbcdc115a5d6e970586a012d1cfe3e3a8b1a3d04e763bdc5a071c0e827c0bd834a5 OP_CHECKSIG>
> var publicKey = bitcore.PublicKey('04a39b9e4fbd213ef24bb9be69de4a118dd0644082e47c01fd9159d38637b83fbcdc115a5d6e970586a012d1cfe3e3a8b1a3d04e763bdc5a071c0e827c0bd834a5')
undefined
> publicKey.toAddress()
<Address: 1VayNert3x1KzbpzMGt2qdqrAThiRovi8, type: pubkeyhash, network: livenet>
Ah, that would certainly explain it. Thanks for investigating.
I added some code to handle P2PK transactions and ran a reindex. It's still going but the results appear to match what I expect. I can make a pull request when I'm done.
I like what you've done with indexes built into bitcoind
, but is there a limit to how many transactions are indexed for a given address?Edge cases are fun, so on block explorers I try to look at addresses with a lot of transactions to see if the balances are computed correctly. After I finished syncing my local bitcore node (v0.3.0), I asked for the balance of the old Deepbit payout address 1VayNert3x1KzbpzMGt2qdqrAThiRovi8.
Hmm, that's odd. These other block explorers all show a balance of close to 185 BTC.
I connected a copy of Insight UI to my node and found that it only indexed 100,276 transactions for this address (confirmed through the
getaddresstxids
API call), but there should be 786,916 payments involving it. Is that expected?