NBXplorer: replacement tx not detected as replacement (replacing: [])

A newtransaction event contains a replacing property that lists all tracked transactions that this new transaction replaces.

This works fine most of the time, but at times NBX fails to set the replacing property correctly, and instead sets it to [].

We have two NBX instances tracking the same set of addresses and both of them shows the same behavior on every address (I mean for a specific replacement, either both instances show the replacing property properly, or both fails to do it).

An example is txid 96e08ce4b137fd8025fcc7cbc529444e90deb094b65988d8311daed257a3663c which is replaced by 85b52cecc22077c6a02cf7d45c0452d6f5333b1dbdc02e5ddcdf591da0c19f90

The newtransaction events stored in the NBX database for these transactions are, respectively:

Event ID: 531245 (Created at 2023-08-21 07:45:50.946705 +00:00)
{"data": {"blockId": null, "outputs": [{"index": 0, "value": 290435, "address": "bc1q8xv78yyuf3eqpch7w4f8xnalz3nvu48qzn5gzy", "keyPath": "0/YYYYY", "scriptPubKey": "00143999e3909c4c7200e2fe7552734fbf1466ce54e0"}], "replacing": [], "cryptoCode": "BTC", "trackedSource": "DERIVATIONSCHEME:xpubXXXXXXXXXXXXXXXXXXXX", "transactionData": {"height": null, "blockId": null, "timestamp": 1692603950, "replacedBy": null, "transaction": "02000000000101e3934c150e3b249fe1a7b80f319197e49eae4610826365a6a20b68e8154ea86f01000000000000008002836e0400000000001600143999e3909c4c7200e2fe7552734fbf1466ce54e0514825000000000016001439e9d8d06cc61f11ccff05c8a1afa172e44e6e4d0248304502210081e289c7ddcee3b3e72b6b41597e58dcfd72c780598aee34d93b927683989f3502203c9f8e4628eb34b47317ddabc5cf50801ec2fe999e02aa2e580457915206373f012103ef68e0004ec17595fd920aaee7872e01d3a6f0f55842d0fe58066b00484b89d100000000", "confirmations": 0, "transactionHash": "96e08ce4b137fd8025fcc7cbc529444e90deb094b65988d8311daed257a3663c"}, "derivationStrategy": "xpubXXXXXXXXXXXXXXXXXXXX"}, "type": "newtransaction"}

Event ID: 531247 (Created at 2023-08-21 07:46:33.605007 +00:00)
{"data": {"blockId": null, "outputs": [{"index": 0, "value": 290435, "address": "bc1q8xv78yyuf3eqpch7w4f8xnalz3nvu48qzn5gzy", "keyPath": "0/YYYYY", "scriptPubKey": "00143999e3909c4c7200e2fe7552734fbf1466ce54e0"}], "replacing": [], "cryptoCode": "BTC", "trackedSource": "DERIVATIONSCHEME:xpubXXXXXXXXXXXXXXXXXXXX", "transactionData": {"height": null, "blockId": null, "timestamp": 1692603993, "replacedBy": null, "transaction": "02000000000101e3934c150e3b249fe1a7b80f319197e49eae4610826365a6a20b68e8154ea86f01000000000100008002836e0400000000001600143999e3909c4c7200e2fe7552734fbf1466ce54e02d47250000000000160014ad8cdfd59db9321e1f95d8477ae1eadcee347f6902473044022069d9bf1fd404a88e557d4801a3e2ebd369cc4d275e2290740e5eba82a640650102207d000ed6891d7ec50fdade22aaa64301720761fee8dddff6ab9ce7fe2c4c41fe012103ef68e0004ec17595fd920aaee7872e01d3a6f0f55842d0fe58066b00484b89d100000000", "confirmations": 0, "transactionHash": "85b52cecc22077c6a02cf7d45c0452d6f5333b1dbdc02e5ddcdf591da0c19f90"}, "derivationStrategy": "xpubXXXXXXXXXXXXXXXXXXXX"}, "type": "newtransaction"}

I expected the replacing property of event 531247 to include 96e08ce4b137fd8025fcc7cbc529444e90deb094b65988d8311daed257a3663c, but it does not.

Here’s a screenshot from mempool.space showing that it recognized it as a replacement (I screenshot it because mempool dot space doesn’t keep the replacement data forever): Screenshot from 2023-08-21 14-14-57

Also, decoding the two transactions clearly shows that they spend the same output:

$ bcli decoderawtransaction 02000000000101e3934c150e3b249fe1a7b80f319197e49eae4610826365a6a20b68e8154ea86f01000000000000008002836e040000000
0001600143999e3909c4c7200e2fe7552734fbf1466ce54e0514825000000000016001439e9d8d06cc61f11ccff05c8a1afa172e44e6e4d0248304502210081e289c7ddcee3b3e72b6b41597e58d
cfd72c780598aee34d93b927683989f3502203c9f8e4628eb34b47317ddabc5cf50801ec2fe999e02aa2e580457915206373f012103ef68e0004ec17595fd920aaee7872e01d3a6f0f55842d0fe5
8066b00484b89d100000000                                                                                                                                     
{                                                                                                                                                           
  "txid": "96e08ce4b137fd8025fcc7cbc529444e90deb094b65988d8311daed257a3663c",                                                                               
  "hash": "dab8e14be9264eaf814ad998152e28d041ab6eac81f959cc2858218103007e94",                                                                               
  "version": 2,                                                                                                                                             
  "size": 223,                                                                                                                                              
  "vsize": 141,                                                                                                                                             
  "weight": 562,                                                                                                                                            
  "locktime": 0,                                                                                                                                            
  "vin": [                                                                                                                                                  
    {                                                                                                                                                       
      "txid": "6fa84e15e8680ba2a66563821046ae9ee49791310fb8a7e19f243b0e154c93e3",                                                                           
      "vout": 1,                                                                                                                                            
      "scriptSig": {                                                                                                                                        
        "asm": "",                                                                                                                                          
        "hex": ""                                                                                                                                           
      },                                                                                                                                                    
      "txinwitness": [                                                                                                                                      
        "304502210081e289c7ddcee3b3e72b6b41597e58dcfd72c780598aee34d93b927683989f3502203c9f8e4628eb34b47317ddabc5cf50801ec2fe999e02aa2e580457915206373f01", 
        "03ef68e0004ec17595fd920aaee7872e01d3a6f0f55842d0fe58066b00484b89d1"                                                                                
      ],                                                                                                                                                    
      "sequence": 2147483648                                                                                                                                
    }                                                                                                                                                       
  ],                                                                                                                                                        
  "vout": [                                                                                                                                                 
    {                                                                                                                                                       
      "value": 0.00290435,                                                                                                                                  
      "n": 0,                                                                                                                                               
      "scriptPubKey": {                                                                                                                                     
        "asm": "0 3999e3909c4c7200e2fe7552734fbf1466ce54e0",                                                                                                
        "desc": "addr(bc1q8xv78yyuf3eqpch7w4f8xnalz3nvu48qzn5gzy)#are7knuz",                                                                                
        "hex": "00143999e3909c4c7200e2fe7552734fbf1466ce54e0",                                                                                              
        "address": "bc1q8xv78yyuf3eqpch7w4f8xnalz3nvu48qzn5gzy",
        "type": "witness_v0_keyhash"
      }
    },
    {
      "value": 0.02443345,
      "n": 1,
      "scriptPubKey": {
        "asm": "0 39e9d8d06cc61f11ccff05c8a1afa172e44e6e4d",
        "desc": "addr(bc1q885a35rvcc03rn8lqhy2rtapwtjyumjd9h6twf)#ejlakcfe",
        "hex": "001439e9d8d06cc61f11ccff05c8a1afa172e44e6e4d",
        "address": "bc1q885a35rvcc03rn8lqhy2rtapwtjyumjd9h6twf",
        "type": "witness_v0_keyhash"
      }
    }
  ]
}

$ bcli decoderawtransaction 02000000000101e3934c150e3b249fe1a7b80f319197e49eae4610826365a6a20b68e8154ea86f01000000000100008002836e0400000000001600143999e3909c4c7200e2fe7552734fbf1466ce54e02d47250000000000160014ad8cdfd59db9321e1f95d8477ae1eadcee347f6902473044022069d9bf1fd404a88e557d4801a3e2ebd369cc4d275e2290740e5eba82a640650102207d000ed6891d7ec50fdade22aaa64301720761fee8dddff6ab9ce7fe2c4c41fe012103ef68e0004ec17595fd920aaee7872e01d3a6f0f55842d0fe58066b00484b89d100000000
{
  "txid": "85b52cecc22077c6a02cf7d45c0452d6f5333b1dbdc02e5ddcdf591da0c19f90",
  "hash": "8f48be08d0d2d7769fb79602a0c2bdf5d87f15a7ed041b95ea2809b9595e156c",
  "version": 2,
  "size": 222,
  "vsize": 141,
  "weight": 561,
  "locktime": 0,
  "vin": [
    {
      "txid": "6fa84e15e8680ba2a66563821046ae9ee49791310fb8a7e19f243b0e154c93e3",
      "vout": 1,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "txinwitness": [
        "3044022069d9bf1fd404a88e557d4801a3e2ebd369cc4d275e2290740e5eba82a640650102207d000ed6891d7ec50fdade22aaa64301720761fee8dddff6ab9ce7fe2c4c41fe01",
        "03ef68e0004ec17595fd920aaee7872e01d3a6f0f55842d0fe58066b00484b89d1"
      ],
      "sequence": 2147483649
    }
  ],
  "vout": [
    {
      "value": 0.00290435,
      "n": 0,
      "scriptPubKey": {
        "asm": "0 3999e3909c4c7200e2fe7552734fbf1466ce54e0",
        "desc": "addr(bc1q8xv78yyuf3eqpch7w4f8xnalz3nvu48qzn5gzy)#are7knuz",
        "hex": "00143999e3909c4c7200e2fe7552734fbf1466ce54e0",
        "address": "bc1q8xv78yyuf3eqpch7w4f8xnalz3nvu48qzn5gzy",
        "type": "witness_v0_keyhash"
      }
    },
    {
      "value": 0.02443053,
      "n": 1,
      "scriptPubKey": {
        "asm": "0 ad8cdfd59db9321e1f95d8477ae1eadcee347f69",
        "desc": "addr(bc1q4kxdl4vahyepu8u4mprh4c02mnhrglmfekskge)#ml6975pv",
        "hex": "0014ad8cdfd59db9321e1f95d8477ae1eadcee347f69",
        "address": "bc1q4kxdl4vahyepu8u4mprh4c02mnhrglmfekskge",
        "type": "witness_v0_keyhash"
      }
    }
  ]
}

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 15 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Also, interestingly, this still holds:

We have two NBX instances tracking the same set of addresses and both of them shows the same behavior on every address (I mean for a specific replacement, either both instances show the replacing property properly, or both fails to do it).