KomodoPlatform / komodo-defi-framework

This is the official Komodo DeFi Framework repository
https://komodoplatform.com/en/docs/komodo-defi-framework/
105 stars 94 forks source link

[BUG] NAV tx history throws errors for some tx #1450

Closed smk762 closed 1 year ago

smk762 commented 2 years ago

error from logs:

· 2022-08-22 22:05:17 +0200 [tx_history coin=NAV] utxo_common:2197] Error "utxo_common:2395] rpc_clients:1974] JsonRpcError { client_info: \"coin: NAV\", request: JsonRpcRequest { jsonrpc: \"2.0\", id: \"4080\", method: \"blockchain.transaction.get\", params: [String(\"0dd22eceb2a4f0ffe211d62c7933ffbe71a01d9d635dfcde83617965ae459047\"), Bool(true)] }, error: Parse(electrum3.nav.community:40002, \"jsonrpc_client:463] error Error(\\\"invalid value: string \\\\\\\"cold_staking\\\\\\\", expected script type\\\", line: 0, column: 0) parsing result from response JsonRpcResponse { jsonrpc: \\\"2.0\\\", id: \\\"4080\\\", result: Object({\\\"hex\\\": String(\\\"03000000c403026301e905930a66e55a2d87275f10691630020b2a03a7ba44d08b1073fae7a6acf805010000006b483045022100dfb178b7313f58ad2079acd1994afd2218f02ccc8282bde738a0591ba712a8c9022059477b147747403c8658444598d5ca403ba8c039affbf3e1a66e3ca9facae5c00121023f95034812ec3c19e55eb592382d60865d781be852e932775b73323a89aa6aecffffffff0200ca9a3b000000001976a914e6761d199b7a3137c98056e49b7339b9a7ab3f5e88ac603d39830901000036c66376a914d5169fad89fc585816fb53615440b4cec510e46088ac6776a9142523d5cf81a07f0a7591af6733ea582da364306988ac680000000000\\\"), \\\"txid\\\": String(\\\"0dd22eceb2a4f0ffe211d62c7933ffbe71a01d9d635dfcde83617965ae459047\\\"), \\\"hash\\\": String(\\\"0dd22eceb2a4f0ffe211d62c7933ffbe71a01d9d635dfcde83617965ae459047\\\"), \\\"size\\\": Number(260), \\\"vsize\\\": Number(260), \\\"version\\\": Number(3), \\\"locktime\\\": Number(0), \\\"strdzeel\\\": String(\\\"\\\"), \\\"vchTxSig\\\": String(\\\"\\\"), \\\"vchBalanceSig\\\": String(\\\"\\\"), \\\"vin\\\": Array([Object({\\\"txid\\\": String(\\\"05f8aca6e7fa73108bd044baa7032a0b02301669105f27872d5ae5660a9305e9\\\"), \\\"vout\\\": Number(1), \\\"scriptSig\\\": Object({\\\"asm\\\": String(\\\"3045022100dfb178b7313f58ad2079acd1994afd2218f02ccc8282bde738a0591ba712a8c9022059477b147747403c8658444598d5ca403ba8c039affbf3e1a66e3ca9facae5c0[ALL] 023f95034812ec3c19e55eb592382d60865d781be852e932775b73323a89aa6aec\\\"), \\\"hex\\\": String(\\\"483045022100dfb178b7313f58ad2079acd1994afd2218f02ccc8282bde738a0591ba712a8c9022059477b147747403c8658444598d5ca403ba8c039affbf3e1a66e3ca9facae5c00121023f95034812ec3c19e55eb592382d60865d781be852e932775b73323a89aa6aec\\\")}), \\\"sequence\\\": Number(4294967295)})]), \\\"vout\\\": Array([Object({\\\"value\\\": Number(10.0), \\\"valueSat\\\": Number(1000000000), \\\"n\\\": Number(0), \\\"scriptPubKey\\\": Object({\\\"asm\\\": String(\\\"OP_DUP OP_HASH160 e6761d199b7a3137c98056e49b7339b9a7ab3f5e OP_EQUALVERIFY OP_CHECKSIG\\\"), \\\"hex\\\": String(\\\"76a914e6761d199b7a3137c98056e49b7339b9a7ab3f5e88ac\\\"), \\\"reqSigs\\\": Number(1), \\\"type\\\": String(\\\"pubkeyhash\\\"), \\\"addresses\\\": Array([String(\\\"NgvY6ZMtLoo2Zseh9MBgTTHN2Uvt6R5XsB\\\")])}), \\\"spendingKey\\\": String(\\\"\\\"), \\\"outputKey\\\": String(\\\"\\\"), \\\"ephemeralKey\\\": String(\\\"\\\"), \\\"vData\\\": String(\\\"\\\"), \\\"tokenId\\\": String(\\\"0000000000000000000000000000000000000000000000000000000000000000\\\"), \\\"rangeProof\\\": Bool(false)}), Object({\\\"value\\\": Number(11403.679), \\\"valueSat\\\": Number(1140367900000), \\\"n\\\": Number(1), \\\"scriptPubKey\\\": Object({\\\"asm\\\": String(\\\"OP_COINSTAKE OP_IF OP_DUP OP_HASH160 d5169fad89fc585816fb53615440b4cec510e460 OP_EQUALVERIFY OP_CHECKSIG OP_ELSE OP_DUP OP_HASH160 2523d5cf81a07f0a7591af6733ea582da3643069 OP_EQUALVERIFY OP_CHECKSIG OP_ENDIF\\\"), \\\"hex\\\": String(\\\"c66376a914d5169fad89fc585816fb53615440b4cec510e46088ac6776a9142523d5cf81a07f0a7591af6733ea582da364306988ac68\\\"), \\\"reqSigs\\\": Number(1), \\\"type\\\": String(\\\"cold_staking\\\"), \\\"addresses\\\": Array([String(\\\"NfLgDYL4C3KKXDS8tLRAFM7spvLykV8v9A\\\"), String(\\\"NPJM7j7P9VhChdXCKRWFto1feWPYcAPQqW\\\")])}), \\\"spendingKey\\\": String(\\\"\\\"), \\\"outputKey\\\": String(\\\"\\\"), \\\"ephemeralKey\\\": String(\\\"\\\"), \\\"vData\\\": String(\\\"\\\"), \\\"tokenId\\\": String(\\\"0000000000000000000000000000000000000000000000000000000000000000\\\"), \\\"rangeProof\\\": Bool(false)})]), \\\"blockhash\\\": String(\\\"f7e67905738ff277497d730a405cbf61752cd728973081dd83862fa57d964d4b\\\"), \\\"height\\\": Number(6506904), \\\"confirmations\\\": Number(4001), \\\"time\\\": Number(1661076480), \\\"blocktime\\\": Number(1661076480)}), error: Null }\") }" on getting the details of 4cc8e8ff9b4128f8c013c6bea74d756b44f5f2c7faf9a6303acf9ffc1c4cdb46, skipping the tx

This looks like the details we need are part of the response, but they are being thwarted by the presence of an invalid value cold_staking within the response. I'll reach out to NAV to get more info about this param.

aguycalled commented 2 years ago

The response to that transaction is this:

  "vout": [
    {
      "value": 10,
      "valuesat": 1000000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 e6761d199b7a3137c98056e49b7339b9a7ab3f5e OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914e6761d199b7a3137c98056e49b7339b9a7ab3f5e88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "NgvY6ZMtLoo2Zseh9MBgTTHN2Uvt6R5XsB"
        ]
      },
      "spentTxId": "4cc8e8ff9b4128f8c013c6bea74d756b44f5f2c7faf9a6303acf9ffc1c4cdb46",
      "spentHeight": 6506904
    },
    {
      "value": 11403.679,
      "valuesat": 1140367900000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_COINSTAKE OP_IF OP_DUP OP_HASH160 d5169fad89fc585816fb53615440b4cec510e460 OP_EQUALVERIFY OP_CHECKSIG OP_ELSE OP_DUP OP_HASH160 2523d5cf81a07f0a7591af6733ea582da3643069 OP_EQUALVERIFY OP_CHECKSIG OP_ENDIF",
        "hex": "c66376a914d5169fad89fc585816fb53615440b4cec510e46088ac6776a9142523d5cf81a07f0a7591af6733ea582da364306988ac68",
        "reqSigs": 1,
        "type": "cold_staking",
        "addresses": [
          "NfLgDYL4C3KKXDS8tLRAFM7spvLykV8v9A",
          "NPJM7j7P9VhChdXCKRWFto1feWPYcAPQqW"
        ]
      }
    }
  ]

I think it just needs to accept the cold_staking type and consider the second element of the array addresses as the spending address. That output is spendable as a normal P2PKH script of that address.

shamardy commented 2 years ago

@smk762 can you please check if NAV tx history is working correctly now in the dev branch?

smk762 commented 2 years ago

@smk762 can you please check if NAV tx history is working correctly now in the dev branch?

I dont have any of these cold_staking addresses in any of my wallets, but have contacted willoncio#5015 who reported the issue and will create a custom gui build for him to test it (or figure out how to get one of these tx in my wallet)

artemii235 commented 2 years ago

@smk762 Can we consider this as done?

smk762 commented 2 years ago

User has not responded - we can close it. Will chase up again and they make contact I will let you know the outcome