Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"searchrawtransactions" returns duplicates of transactions #346

Closed
aakselrod opened this issue Mar 11, 2015 · 1 comment
Closed

"searchrawtransactions" returns duplicates of transactions #346

aakselrod opened this issue Mar 11, 2015 · 1 comment

Comments

@aakselrod
Copy link
Contributor

While btcd was running, I broadcast two transactions: ba1eecb28b363f40ee8ad4796989c8eb3d552e8ab85c146fac00d161147dbf1d and 271c05315790682c964d9ab29d3e84cc79a8f0d80bf6acf638186ce36ea780ae (not through the same btcd I'm querying).

After the transactions got confirmed, I am seeing something like the blockquote below. It looks like transactions may not be getting removed from txMemPool.addrindex when they're confirmed in a block, because the duplicate 0-confirm transactions go away after restarting btcd.

If I get a chance soon, I will try and see why this is happening/try to fix it.

$ ./btcctl -u x -P xx --testnet searchrawtransactions "miSTbp6DUSA3v46j3bTT6gKV1JQS21rEqN"
[
{
"hex": "01000000011dbf7d1461d100ac6f145cb88a2e553debc8896979d48aee403f368bb2ec1eba010000006a473044022015052ca8ad3593300048cd16efd2ecc99ea6d2a860562cfd341f7859a79696900220687091479b412d864df8c5003581db0a49f755f51b1f7dfb0940d8cd9409dfa9012102d4e5142c293fff6ca2d6eb134ab1a01e782889d2a913b063da6829756e096e91ffffffff0240787d01000000001976a914200ec2d84e94db949d8bcd472463d9280c04579b88ac00ed6831000000001976a914875d60b7ce1fd2eb5778d9c5c89031873832728c88ac00000000",
"txid": "271c05315790682c964d9ab29d3e84cc79a8f0d80bf6acf638186ce36ea780ae",
"version": 1,
"locktime": 0,
"vin": [
{
"txid": "ba1eecb28b363f40ee8ad4796989c8eb3d552e8ab85c146fac00d161147dbf1d",
"vout": 1,
"scriptSig": {
"asm": "3044022015052ca8ad3593300048cd16efd2ecc99ea6d2a860562cfd341f7859a79696900220687091479b412d864df8c5003581db0a49f755f51b1f7dfb0940d8cd9409dfa901 02d4e5142c293fff6ca2d6eb134ab1a01e782889d2a913b063da6829756e096e91",
"hex": "473044022015052ca8ad3593300048cd16efd2ecc99ea6d2a860562cfd341f7859a79696900220687091479b412d864df8c5003581db0a49f755f51b1f7dfb0940d8cd9409dfa9012102d4e5142c293fff6ca2d6eb134ab1a01e782889d2a913b063da6829756e096e91"
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.25,
"n": 0,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 200ec2d84e94db949d8bcd472463d9280c04579b OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914200ec2d84e94db949d8bcd472463d9280c04579b88ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"miSTbp6DUSA3v46j3bTT6gKV1JQS21rEqN"
]
}
},
{
"value": 8.2896,
"n": 1,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 875d60b7ce1fd2eb5778d9c5c89031873832728c OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914875d60b7ce1fd2eb5778d9c5c89031873832728c88ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"msrhNxKzFUNgaeTv4WXFBwfgDyZWe5ZDFh"
]
}
}
],
"confirmations": 0
},
{
"hex": "0100000001ae80a76ee36c1838f6acf60bd8f0a879cc843e9db29a4d962c68905731051c27000000006a47304402205572b73b95d6c55105d04faaf1c4f419e67bada14ecd5673dfb9e31b33546b5d022041496c850e4c9cec7e43f90ff897be317d3f5867e4a7084d22efd0fe9951ed4b0121020bd363a535f35c32cd00f7fe3fba003574b0f9f1b884f7ea2009855cf01ed0d5ffffffff0280969800000000001976a91485eb47fe98f349065d6f044e27a4ac541af79ee288acd8dde400000000001976a9144ec6d00b3a4295e05c87893e27d3085719ae188e88ac00000000",
"txid": "4cbcedea4a897af4c756eb7df67967d13994c2d16c53ee569d91e115fb24aac2",
"version": 1,
"locktime": 0,
"vin": [
{
"txid": "271c05315790682c964d9ab29d3e84cc79a8f0d80bf6acf638186ce36ea780ae",
"vout": 0,
"scriptSig": {
"asm": "304402205572b73b95d6c55105d04faaf1c4f419e67bada14ecd5673dfb9e31b33546b5d022041496c850e4c9cec7e43f90ff897be317d3f5867e4a7084d22efd0fe9951ed4b01 020bd363a535f35c32cd00f7fe3fba003574b0f9f1b884f7ea2009855cf01ed0d5",
"hex": "47304402205572b73b95d6c55105d04faaf1c4f419e67bada14ecd5673dfb9e31b33546b5d022041496c850e4c9cec7e43f90ff897be317d3f5867e4a7084d22efd0fe9951ed4b0121020bd363a535f35c32cd00f7fe3fba003574b0f9f1b884f7ea2009855cf01ed0d5"
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.1,
"n": 0,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 85eb47fe98f349065d6f044e27a4ac541af79ee2 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a91485eb47fe98f349065d6f044e27a4ac541af79ee288ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"msj42CCGruhRsFrGATiUuh25dtxYtnpbTx"
]
}
},
{
"value": 0.14999,
"n": 1,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 4ec6d00b3a4295e05c87893e27d3085719ae188e OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a9144ec6d00b3a4295e05c87893e27d3085719ae188e88ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"mnhVAmEDyD8L95WfJZXyL7tXSwWPvZVBTF"
]
}
}
],
"confirmations": 0
},
{
"hex": "01000000011dbf7d1461d100ac6f145cb88a2e553debc8896979d48aee403f368bb2ec1eba010000006a473044022015052ca8ad3593300048cd16efd2ecc99ea6d2a860562cfd341f7859a79696900220687091479b412d864df8c5003581db0a49f755f51b1f7dfb0940d8cd9409dfa9012102d4e5142c293fff6ca2d6eb134ab1a01e782889d2a913b063da6829756e096e91ffffffff0240787d01000000001976a914200ec2d84e94db949d8bcd472463d9280c04579b88ac00ed6831000000001976a914875d60b7ce1fd2eb5778d9c5c89031873832728c88ac00000000",
"txid": "271c05315790682c964d9ab29d3e84cc79a8f0d80bf6acf638186ce36ea780ae",
"version": 1,
"locktime": 0,
"vin": [
{
"txid": "ba1eecb28b363f40ee8ad4796989c8eb3d552e8ab85c146fac00d161147dbf1d",
"vout": 1,
"scriptSig": {
"asm": "3044022015052ca8ad3593300048cd16efd2ecc99ea6d2a860562cfd341f7859a79696900220687091479b412d864df8c5003581db0a49f755f51b1f7dfb0940d8cd9409dfa901 02d4e5142c293fff6ca2d6eb134ab1a01e782889d2a913b063da6829756e096e91",
"hex": "473044022015052ca8ad3593300048cd16efd2ecc99ea6d2a860562cfd341f7859a79696900220687091479b412d864df8c5003581db0a49f755f51b1f7dfb0940d8cd9409dfa9012102d4e5142c293fff6ca2d6eb134ab1a01e782889d2a913b063da6829756e096e91"
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.25,
"n": 0,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 200ec2d84e94db949d8bcd472463d9280c04579b OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914200ec2d84e94db949d8bcd472463d9280c04579b88ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"miSTbp6DUSA3v46j3bTT6gKV1JQS21rEqN"
]
}
},
{
"value": 8.2896,
"n": 1,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 875d60b7ce1fd2eb5778d9c5c89031873832728c OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914875d60b7ce1fd2eb5778d9c5c89031873832728c88ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"msrhNxKzFUNgaeTv4WXFBwfgDyZWe5ZDFh"
]
}
}
],
"blockhash": "0000000078795147204b7ee7b67002a58f1119c114b2e63802db464a0c86c946",
"confirmations": 225,
"time": 1425942546,
"blocktime": 1425942546
},
{
"hex": "0100000001ae80a76ee36c1838f6acf60bd8f0a879cc843e9db29a4d962c68905731051c27000000006a47304402205572b73b95d6c55105d04faaf1c4f419e67bada14ecd5673dfb9e31b33546b5d022041496c850e4c9cec7e43f90ff897be317d3f5867e4a7084d22efd0fe9951ed4b0121020bd363a535f35c32cd00f7fe3fba003574b0f9f1b884f7ea2009855cf01ed0d5ffffffff0280969800000000001976a91485eb47fe98f349065d6f044e27a4ac541af79ee288acd8dde400000000001976a9144ec6d00b3a4295e05c87893e27d3085719ae188e88ac00000000",
"txid": "4cbcedea4a897af4c756eb7df67967d13994c2d16c53ee569d91e115fb24aac2",
"version": 1,
"locktime": 0,
"vin": [
{
"txid": "271c05315790682c964d9ab29d3e84cc79a8f0d80bf6acf638186ce36ea780ae",
"vout": 0,
"scriptSig": {
"asm": "304402205572b73b95d6c55105d04faaf1c4f419e67bada14ecd5673dfb9e31b33546b5d022041496c850e4c9cec7e43f90ff897be317d3f5867e4a7084d22efd0fe9951ed4b01 020bd363a535f35c32cd00f7fe3fba003574b0f9f1b884f7ea2009855cf01ed0d5",
"hex": "47304402205572b73b95d6c55105d04faaf1c4f419e67bada14ecd5673dfb9e31b33546b5d022041496c850e4c9cec7e43f90ff897be317d3f5867e4a7084d22efd0fe9951ed4b0121020bd363a535f35c32cd00f7fe3fba003574b0f9f1b884f7ea2009855cf01ed0d5"
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.1,
"n": 0,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 85eb47fe98f349065d6f044e27a4ac541af79ee2 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a91485eb47fe98f349065d6f044e27a4ac541af79ee288ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"msj42CCGruhRsFrGATiUuh25dtxYtnpbTx"
]
}
},
{
"value": 0.14999,
"n": 1,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 4ec6d00b3a4295e05c87893e27d3085719ae188e OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a9144ec6d00b3a4295e05c87893e27d3085719ae188e88ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"mnhVAmEDyD8L95WfJZXyL7tXSwWPvZVBTF"
]
}
}
],
"blockhash": "000000005921ac7e47f4a70f617db1dea79466805f55e84126396b6a56057ce9",
"confirmations": 206,
"time": 1425953078,
"blocktime": 1425953078
}
]

@davecgh
Copy link
Member

davecgh commented Mar 11, 2015

@Roasbeef: Please take a look at this one.

aakselrod added a commit to aakselrod/btcd that referenced this issue Mar 20, 2015
Fix btcsuite#303 by changing the addrindex key prefix to 3 characters so that
it's easy to check length when dropping the index. To drop the old
index, check to make sure we aren't dropping any entries that end in
"sx" or "tx" as those aren't part of the addrindex.

Fix btcsuite#346 by changing the pointers in the mempool's addrindex map to
wire.ShaHash 32-byte values. This lets them be deleted even if the
transaction data changes places in memory upon expanding the maps.

Change the way addrindex uint32s are stored to big-endian in order to
sort the transactions on disk in chronological/dependency order.

Change the "searchrawtransactions" RPC call to return transactions
from the database before the memory pool so that they're returned in
order. This commit DOES NOT do topological sorting of the memory pool
transactions to ensure they're returned in dependency order. This may
be a good idea for a future enhancement.

Add addrindex versioning to automatically drop the old/incompatible
version of the index and rebuild with the new sort method and key
prefix.
aakselrod added a commit to aakselrod/btcd that referenced this issue Mar 20, 2015
Fix btcsuite#303 by changing the addrindex key prefix to 3 characters so that
it's easy to check length when dropping the index. To drop the old
index, check to make sure we aren't dropping any entries that end in
"sx" or "tx" as those aren't part of the addrindex. Update test to
deal with the new prefix length.

Fix btcsuite#346 by changing the pointers in the mempool's addrindex map to
wire.ShaHash 32-byte values. This lets them be deleted even if the
transaction data changes places in memory upon expanding the maps.

Change the way addrindex uint32s are stored to big-endian in order to
sort the transactions on disk in chronological/dependency order.

Change the "searchrawtransactions" RPC call to return transactions
from the database before the memory pool so that they're returned in
order. This commit DOES NOT do topological sorting of the memory pool
transactions to ensure they're returned in dependency order. This may
be a good idea for a future enhancement.

Add addrindex versioning to automatically drop the old/incompatible
version of the index and rebuild with the new sort method and key
prefix.
aakselrod added a commit to aakselrod/btcd that referenced this issue Mar 23, 2015
Fix btcsuite#303 by changing the addrindex key prefix to 3 characters so that
it's easy to check length when dropping the index. To drop the old
index, check to make sure we aren't dropping any entries that end in
"sx" or "tx" as those aren't part of the addrindex. Update test to
deal with the new prefix length.

Fix btcsuite#346 by changing the pointers in the mempool's addrindex map to
wire.ShaHash 32-byte values. This lets them be deleted even if the
transaction data changes places in memory upon expanding the maps.

Change the way addrindex uint32s are stored to big-endian in order to
sort the transactions on disk in chronological/dependency order.

Change the "searchrawtransactions" RPC call to return transactions
from the database before the memory pool so that they're returned in
order. This commit DOES NOT do topological sorting of the memory pool
transactions to ensure they're returned in dependency order. This may
be a good idea for a future enhancement.

Add addrindex versioning to automatically drop the old/incompatible
version of the index and rebuild with the new sort method and key
prefix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants