Skip to content

No event created for tracked address in 2-block reorg #409

@kallerosenbaum

Description

@kallerosenbaum

I'm running NBX on a regtest node. If the current tip is at height 103 and

  • I have a transaction for a tracked address at height 102
  • I invalidateblock for height 102

I expect to get a newtransaction event that says confirmations: 0 in nbxv1_evts.

I get no such event.

But if the current tip is 102, and the tx is at 102, and I invalidateblock 102, then I do get a newtransaction event that says confirmations: 0.

To me this seems like a bug, but I'm also open to the possibility that I'm making a stupid mistake.

Details

2 blocks reorg

Reorg 2 block deep (invalidateblock 102) with tx at block 102.

nbxv1_evts:

BTC,1,newblock,"{""data"": {""hash"": ""1afac9f05ca68788c4917df23b7274cc846cdbb368a3a5e3ca7aad5418c718af"", ""height"": 101, ""cryptoCode"": ""BTC"", ""confirmations"": 1, ""previousBlockHash"": ""6d48d7ff7fa0f6dea50891a82f4a3bc472c98cf4a9ffe24a75b1d68f30b7ed3b""}, ""type"": ""newblock""}",2023-03-08 13:05:36.916884 +00:00
BTC,2,newblock,"{""data"": {""hash"": ""3fddb543a9f9ab97b71378fed4d29764589515fa48cd75424bb578ff857e3cdc"", ""height"": 102, ""cryptoCode"": ""BTC"", ""confirmations"": 1, ""previousBlockHash"": ""1afac9f05ca68788c4917df23b7274cc846cdbb368a3a5e3ca7aad5418c718af""}, ""type"": ""newblock""}",2023-03-08 13:05:38.135028 +00:00
BTC,3,newtransaction,"{""data"": {""blockId"": ""3fddb543a9f9ab97b71378fed4d29764589515fa48cd75424bb578ff857e3cdc"", ""outputs"": [{""index"": 1, ""value"": 100000, ""address"": ""bcrt1q3xk3q07c3ksvggq6rqul30atgy7ltc589dx9et"", ""keyPath"": ""0/0"", ""scriptPubKey"": ""001489ad103fd88da0c4201a1839f8bfab413df5e287""}], ""cryptoCode"": ""BTC"", ""trackedSource"": ""DERIVATIONSCHEME:tpubDDGWeYrppbmruHLpMzn6uKukGzULVJnGc3gTDbGZJ3dA1EpMMjRjLxTz8KW6rmt9W6YuajREU1z1YQEXy594uDDkcHTt8tv8JFGfr8CNtEJ"", ""transactionData"": {""height"": 102, ""blockId"": ""3fddb543a9f9ab97b71378fed4d29764589515fa48cd75424bb578ff857e3cdc"", ""timestamp"": 1678280737, ""transaction"": ""0200000000010184c2aff4156aa8ee965eb45411c2bc7d2fb2396afe34b9024f50a4b1fcc4d6970000000000fdffffff02d36a042a01000000160014e6b3dde7d24400cdf76f2c9ef99775ebda820386a08601000000000016001489ad103fd88da0c4201a1839f8bfab413df5e2870247304402202dfff30b6788216da724fa40991c84ddeed18a13e295b9e31649e2a8fa7d617e02207dc2bbe123ff8e65552dccbab6a3e73eb22f56ed6e25cbdeee55a3d9d2b7c3670121037e595b2681094f5ed1430ce923bdece753546edc3aae70fae6ceb4a2cbc4413865000000"", ""confirmations"": 1, ""transactionHash"": ""61abc278066dfafc1dad7e7dd074086816e2b877893fed66ff0d4907dd40f2ee""}, ""derivationStrategy"": ""tpubDDGWeYrppbmruHLpMzn6uKukGzULVJnGc3gTDbGZJ3dA1EpMMjRjLxTz8KW6rmt9W6YuajREU1z1YQEXy594uDDkcHTt8tv8JFGfr8CNtEJ""}, ""type"": ""newtransaction""}",2023-03-08 13:05:38.177769 +00:00
BTC,4,newblock,"{""data"": {""hash"": ""6fb32aa5e8788f90d1b9a549e1dfdd998d8eef5dd78a7c9ee44432fbde401178"", ""height"": 103, ""cryptoCode"": ""BTC"", ""confirmations"": 1, ""previousBlockHash"": ""3fddb543a9f9ab97b71378fed4d29764589515fa48cd75424bb578ff857e3cdc""}, ""type"": ""newblock""}",2023-03-08 13:05:38.212417 +00:00

From debug.log (wallet user is the wallet containing the tracked address).

2023-03-08T13:05:37Z [rpc] ThreadRPCServer method=generatetoaddress user=__cookie__
2023-03-08T13:05:37Z CreateNewBlock(): block weight: 1449 txs: 1 fees: 141 sigops 401
2023-03-08T13:05:37Z UpdateTip: new best=3fddb543a9f9ab97b71378fed4d29764589515fa48cd75424bb578ff857e3cdc height=102 version=0x20000000 log2_work=7.686501 tx=104 date='2023-03-08T13:05:45Z' progress=1.000000 cache=0.0MiB(104txo)
2023-03-08T13:05:37Z CreateNewBlock(): block weight: 888 txs: 0 fees: 0 sigops 400
2023-03-08T13:05:37Z UpdateTip: new best=6fb32aa5e8788f90d1b9a549e1dfdd998d8eef5dd78a7c9ee44432fbde401178 height=103 version=0x20000000 log2_work=7.700440 tx=105 date='2023-03-08T13:05:45Z' progress=1.000000 cache=0.0MiB(105txo)
2023-03-08T13:05:37Z [miner] AddToWallet 61abc278066dfafc1dad7e7dd074086816e2b877893fed66ff0d4907dd40f2ee  
2023-03-08T13:05:37Z [user] AddToWallet 61abc278066dfafc1dad7e7dd074086816e2b877893fed66ff0d4907dd40f2ee  new
2023-03-08T13:05:37Z [miner] AddToWallet 053cc5e2c9ca437e6a229e6f9251e0b86bc032eacb53dd717df87bb1c45bf55f  new
2023-03-08T13:05:37Z [miner] AddToWallet 61abc278066dfafc1dad7e7dd074086816e2b877893fed66ff0d4907dd40f2ee  update
2023-03-08T13:05:37Z [user] AddToWallet 61abc278066dfafc1dad7e7dd074086816e2b877893fed66ff0d4907dd40f2ee  update
2023-03-08T13:05:38Z [miner] AddToWallet 1fc69e036123ebdefca3b627285435e3a2166e1698e7a23aaca64866232d4a3b  new
2023-03-08T13:05:38Z [rpc] ThreadRPCServer method=getblockchaininfo user=__cookie__
2023-03-08T13:05:38Z [rpc] ThreadRPCServer method=getblock user=__cookie__
2023-03-08T13:05:38Z [rpc] ThreadRPCServer method=getblock user=__cookie__
2023-03-08T13:05:38Z [rpc] ThreadRPCServer method=invalidateblock user=__cookie__
2023-03-08T13:05:38Z UpdateTip: new best=3fddb543a9f9ab97b71378fed4d29764589515fa48cd75424bb578ff857e3cdc height=102 version=0x20000000 log2_work=7.686501 tx=104 date='2023-03-08T13:05:45Z' progress=1.000000 cache=0.0MiB(105txo)
2023-03-08T13:05:38Z UpdateTip: new best=1afac9f05ca68788c4917df23b7274cc846cdbb368a3a5e3ca7aad5418c718af height=101 version=0x20000000 log2_work=7.672425 tx=102 date='2023-03-08T13:05:45Z' progress=1.000000 cache=0.0MiB(103txo)
2023-03-08T13:05:38Z InvalidChainFound: invalid block=3fddb543a9f9ab97b71378fed4d29764589515fa48cd75424bb578ff857e3cdc  height=102  log2_work=7.686501  date=2023-03-08T13:05:45Z
2023-03-08T13:05:38Z InvalidChainFound:  current best=1afac9f05ca68788c4917df23b7274cc846cdbb368a3a5e3ca7aad5418c718af  height=101  log2_work=7.672425  date=2023-03-08T13:05:45Z
2023-03-08T13:05:38Z [rpc] ThreadRPCServer method=getblockchaininfo user=__cookie__
2023-03-08T13:05:38Z [miner] AddToWallet 1fc69e036123ebdefca3b627285435e3a2166e1698e7a23aaca64866232d4a3b  update
2023-03-08T13:05:38Z [miner] AddToWallet 053cc5e2c9ca437e6a229e6f9251e0b86bc032eacb53dd717df87bb1c45bf55f  update
2023-03-08T13:05:38Z [miner] AddToWallet 61abc278066dfafc1dad7e7dd074086816e2b877893fed66ff0d4907dd40f2ee  update
2023-03-08T13:05:38Z [user] AddToWallet 61abc278066dfafc1dad7e7dd074086816e2b877893fed66ff0d4907dd40f2ee  update
2023-03-08T13:05:38Z [miner] AddToWallet 61abc278066dfafc1dad7e7dd074086816e2b877893fed66ff0d4907dd40f2ee  update
2023-03-08T13:05:38Z [user] AddToWallet 61abc278066dfafc1dad7e7dd074086816e2b877893fed66ff0d4907dd40f2ee  update
2023-03-08T13:06:26Z Adding fixed seeds as 60 seconds have passed and addrman is empty
2023-03-08T13:06:26Z Added 0 fixed seeds from reachable networks.
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=getblockchaininfo user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=getnetworkinfo user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=scantxoutset user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=signrawtransactionwithkey user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=testmempoolaccept user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=estimatesmartfee user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=generatetoaddress user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=validateaddress user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=validateaddress user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=getpeerinfo user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=getnetworkinfo user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=getblockchaininfo user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=createwallet user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=getblockheader user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=getnetworkinfo user=__cookie__
2023-03-08T13:06:38Z [rpc] ThreadRPCServer method=getblockchaininfo user=__cookie__

1 block reorg (exact same test otherwise)

Reorg 1 block deep (invalidateblock 102) with tx at block 102

nbxv1_evts:

BTC,1,newblock,"{""data"": {""hash"": ""7f5cd488d39d95fce3bea91a96a01a66cf57a05f428d811ec66af704691da5c3"", ""height"": 101, ""cryptoCode"": ""BTC"", ""confirmations"": 1, ""previousBlockHash"": ""1164487b7acd8b5136ae472c1522593bdaabb21aed7330093fb3130a87bf8221""}, ""type"": ""newblock""}",2023-03-08 12:55:51.619419 +00:00
BTC,2,newblock,"{""data"": {""hash"": ""0cab7c088f2ab58b3a3b5bf2b48ae2a76278390df539344d9a2845155cce8fc2"", ""height"": 102, ""cryptoCode"": ""BTC"", ""confirmations"": 1, ""previousBlockHash"": ""7f5cd488d39d95fce3bea91a96a01a66cf57a05f428d811ec66af704691da5c3""}, ""type"": ""newblock""}",2023-03-08 12:55:52.734499 +00:00
BTC,3,newtransaction,"{""data"": {""blockId"": ""0cab7c088f2ab58b3a3b5bf2b48ae2a76278390df539344d9a2845155cce8fc2"", ""outputs"": [{""index"": 0, ""value"": 100000, ""address"": ""bcrt1q27gsv4uzjguu5d6m57qsx8aqm07jfaxqrswsdy"", ""keyPath"": ""0/0"", ""scriptPubKey"": ""001457910657829239ca375ba781031fa0dbfd24f4c0""}], ""cryptoCode"": ""BTC"", ""trackedSource"": ""DERIVATIONSCHEME:tpubDCkMhRuTmmCHCwJjfqSSKLtJ2VjzfJRCUxvCYBqYyCeMxNw6QiEqxHWcxhK1hZfwVYVFCso5UxWXJEWWRjnaNGQfUMjUBE3rFfQPdSiiSAe"", ""transactionData"": {""height"": 102, ""blockId"": ""0cab7c088f2ab58b3a3b5bf2b48ae2a76278390df539344d9a2845155cce8fc2"", ""timestamp"": 1678280152, ""transaction"": ""020000000001016766dfd0b042ed3c1216393a001f09d2bfdbc21dc06dfe8e635007fa1d0b45da0000000000fdffffff02a08601000000000016001457910657829239ca375ba781031fa0dbfd24f4c0d36a042a01000000160014630c3572543c867a07cbf0297ddc93dc1941c50e02473044022022729e9a30241a76484616f854fba16404d79d2184bec9e2e4cfee8f45b6a72a022008423a8d4822a44380cffefe39e11c86a790eafdc05225c4606b61c17a416c900121027c967149481e8450ff10b913d1c756b5bb86831ebf8f5979661f56b825f87eea65000000"", ""confirmations"": 1, ""transactionHash"": ""5f297564a0b9fa4503c3b8a89977067fce1481979cb4f2cd6055e5139eb584ed""}, ""derivationStrategy"": ""tpubDCkMhRuTmmCHCwJjfqSSKLtJ2VjzfJRCUxvCYBqYyCeMxNw6QiEqxHWcxhK1hZfwVYVFCso5UxWXJEWWRjnaNGQfUMjUBE3rFfQPdSiiSAe""}, ""type"": ""newtransaction""}",2023-03-08 12:55:52.758034 +00:00
BTC,4,newtransaction,"{""data"": {""blockId"": null, ""outputs"": [{""index"": 0, ""value"": 100000, ""address"": ""bcrt1q27gsv4uzjguu5d6m57qsx8aqm07jfaxqrswsdy"", ""keyPath"": ""0/0"", ""scriptPubKey"": ""001457910657829239ca375ba781031fa0dbfd24f4c0""}], ""cryptoCode"": ""BTC"", ""trackedSource"": ""DERIVATIONSCHEME:tpubDCkMhRuTmmCHCwJjfqSSKLtJ2VjzfJRCUxvCYBqYyCeMxNw6QiEqxHWcxhK1hZfwVYVFCso5UxWXJEWWRjnaNGQfUMjUBE3rFfQPdSiiSAe"", ""transactionData"": {""height"": null, ""blockId"": null, ""timestamp"": 1678280162, ""transaction"": ""020000000001016766dfd0b042ed3c1216393a001f09d2bfdbc21dc06dfe8e635007fa1d0b45da0000000000fdffffff02a08601000000000016001457910657829239ca375ba781031fa0dbfd24f4c0d36a042a01000000160014630c3572543c867a07cbf0297ddc93dc1941c50e02473044022022729e9a30241a76484616f854fba16404d79d2184bec9e2e4cfee8f45b6a72a022008423a8d4822a44380cffefe39e11c86a790eafdc05225c4606b61c17a416c900121027c967149481e8450ff10b913d1c756b5bb86831ebf8f5979661f56b825f87eea65000000"", ""confirmations"": 0, ""transactionHash"": ""5f297564a0b9fa4503c3b8a89977067fce1481979cb4f2cd6055e5139eb584ed""}, ""derivationStrategy"": ""tpubDCkMhRuTmmCHCwJjfqSSKLtJ2VjzfJRCUxvCYBqYyCeMxNw6QiEqxHWcxhK1hZfwVYVFCso5UxWXJEWWRjnaNGQfUMjUBE3rFfQPdSiiSAe""}, ""type"": ""newtransaction""}",2023-03-08 12:56:02.855524 +00:00

From debug.log

2023-03-08T12:55:52Z [rpc] ThreadRPCServer method=generatetoaddress user=__cookie__
2023-03-08T12:55:52Z CreateNewBlock(): block weight: 1449 txs: 1 fees: 141 sigops 401
2023-03-08T12:55:52Z UpdateTip: new best=0cab7c088f2ab58b3a3b5bf2b48ae2a76278390df539344d9a2845155cce8fc2 height=102 version=0x20000000 log2_work=7.686501 tx=104 date='2023-03-08T12:55:58Z' progress=1.000000 cache=0.0MiB(104txo)
2023-03-08T12:55:52Z [miner] AddToWallet 5f297564a0b9fa4503c3b8a89977067fce1481979cb4f2cd6055e5139eb584ed  
2023-03-08T12:55:52Z [user] AddToWallet 5f297564a0b9fa4503c3b8a89977067fce1481979cb4f2cd6055e5139eb584ed  new
2023-03-08T12:55:52Z [miner] AddToWallet 9c12bf0664baf94d3c4c68e11f2a708b3c2e17de6614b38cc6f95d30c5032eed  new
2023-03-08T12:55:52Z [miner] AddToWallet 5f297564a0b9fa4503c3b8a89977067fce1481979cb4f2cd6055e5139eb584ed  update
2023-03-08T12:55:52Z [user] AddToWallet 5f297564a0b9fa4503c3b8a89977067fce1481979cb4f2cd6055e5139eb584ed  update
2023-03-08T12:55:52Z [rpc] ThreadRPCServer method=getblockchaininfo user=__cookie__
2023-03-08T12:55:52Z [rpc] ThreadRPCServer method=getblock user=__cookie__
2023-03-08T12:55:52Z [rpc] ThreadRPCServer method=invalidateblock user=__cookie__
2023-03-08T12:55:52Z UpdateTip: new best=7f5cd488d39d95fce3bea91a96a01a66cf57a05f428d811ec66af704691da5c3 height=101 version=0x20000000 log2_work=7.672425 tx=102 date='2023-03-08T12:55:58Z' progress=1.000000 cache=0.0MiB(102txo)
2023-03-08T12:55:52Z InvalidChainFound: invalid block=0cab7c088f2ab58b3a3b5bf2b48ae2a76278390df539344d9a2845155cce8fc2  height=102  log2_work=7.686501  date=2023-03-08T12:55:58Z
2023-03-08T12:55:52Z InvalidChainFound:  current best=7f5cd488d39d95fce3bea91a96a01a66cf57a05f428d811ec66af704691da5c3  height=101  log2_work=7.672425  date=2023-03-08T12:55:58Z
2023-03-08T12:55:52Z [miner] AddToWallet 9c12bf0664baf94d3c4c68e11f2a708b3c2e17de6614b38cc6f95d30c5032eed  update
2023-03-08T12:55:52Z [miner] AddToWallet 5f297564a0b9fa4503c3b8a89977067fce1481979cb4f2cd6055e5139eb584ed  update
2023-03-08T12:55:52Z [user] AddToWallet 5f297564a0b9fa4503c3b8a89977067fce1481979cb4f2cd6055e5139eb584ed  update
2023-03-08T12:55:52Z [miner] AddToWallet 5f297564a0b9fa4503c3b8a89977067fce1481979cb4f2cd6055e5139eb584ed  update
2023-03-08T12:55:52Z [user] AddToWallet 5f297564a0b9fa4503c3b8a89977067fce1481979cb4f2cd6055e5139eb584ed  update
2023-03-08T12:56:02Z [rpc] ThreadRPCServer method=getmempoolentry user=__cookie__
2023-03-08T12:56:40Z Adding fixed seeds as 60 seconds have passed and addrman is empty
2023-03-08T12:56:40Z Added 0 fixed seeds from reachable networks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions