vulpemventures / ldk

Liquid Development Kit provides abstractions to speed-up implementation of elements-based wallets for browsers and NodeJS
MIT License
10 stars 11 forks source link

fetchAndUnblindTxsGenerator() is losing vin of claim pegin txs #74

Closed Janaka-Steph closed 3 years ago

Janaka-Steph commented 3 years ago

Tx from Esplora


{
  "txid": "f4b25e1c71b93c901075f1477477620dcc8c88218a607529c178a4a69360585a",
  "version": 2,
  "locktime": 0,
  "vin": [
    {
      "txid": "733da2a4766fa2c3e8f2d0f82d687d2f8d11a3639364bfe93fd2b56d1f857db0",
      "vout": 1,
      "prevout": null,
      "scriptsig": "",
      "scriptsig_asm": "",
      "witness": [
        "30440220583f4d77440f15501eb944ac7dcd5974747360df9e5b43b546f6a988145e575802200bce3580356ea2f04f496d76514505db61ef650b4115452bd74dad9c38f992f401",
        "02ac530af3b8705d0063083a82ec5b1cad96ff99d02ba6bb3b98ebcd1dc1eac011"
      ],
      "is_coinbase": false,
      "sequence": 4294967295,
      "is_pegin": true
    }
  ],
  "vout": [
    {
      "scriptpubkey": "001442acdb02844ac41e6b4359f52412769731bac8be",
      "scriptpubkey_asm": "OP_0 OP_PUSHBYTES_20 42acdb02844ac41e6b4359f52412769731bac8be",
      "scriptpubkey_type": "v0_p2wpkh",
      "scriptpubkey_address": "ert1qg2kdkq5yftzpu66rt86jgynkjucm4j97c0nne4",
      "value": 199999744,
      "asset": "056293ee681516f2d61bb7ce63030351d5e02d61aef9fb00d30f27f55d935b18"
    },
    {
      "scriptpubkey": "",
      "scriptpubkey_asm": "",
      "scriptpubkey_type": "fee",
      "value": 256,
      "asset": "056293ee681516f2d61bb7ce63030351d5e02d61aef9fb00d30f27f55d935b18"
    }
  ],
  "size": 641,
  "weight": 1127,
  "fee": 0,
  "status": {
    "confirmed": true,
    "block_height": 3,
    "block_hash": "167984d0e1a6780343e4fbc54e786cae8e9a4463e039b74ac0b8c902485fe47e",
    "block_time": 1629371903
  }
}

Same tx from fetchAndUnblindTxsGenerator()


{
  f4b25e1c71b93c901075f1477477620dcc8c88218a607529c178a4a69360585a: {
    txid: 'f4b25e1c71b93c901075f1477477620dcc8c88218a607529c178a4a69360585a',
    vin: [],
    vout: [
      {
        asset: '056293ee681516f2d61bb7ce63030351d5e02d61aef9fb00d30f27f55d935b18',
        value: 199999744,
        script: '001442acdb02844ac41e6b4359f52412769731bac8be',
        assetBlinder: '0000000000000000000000000000000000000000000000000000000000000000',
        valueBlinder: '0000000000000000000000000000000000000000000000000000000000000000'
      },
      {
        asset: '056293ee681516f2d61bb7ce63030351d5e02d61aef9fb00d30f27f55d935b18',
        value: 256,
        script: '',
        assetBlinder: '0000000000000000000000000000000000000000000000000000000000000000',
        valueBlinder: '0000000000000000000000000000000000000000000000000000000000000000'
      }
    ],
    fee: 0,
    status: {
      confirmed: true,
      blockHash: '167984d0e1a6780343e4fbc54e786cae8e9a4463e039b74ac0b8c902485fe47e',
      blockHeight: 3,
      blockTime: 1629371903
    }
  }
}
louisinger commented 3 years ago

Note that we can't fetch the peginWitness of pegin inputs from esplora: https://github.com/Blockstream/esplora/issues/103. Only prevout and script witness.