Skip to content

bsv@2.0.0-beta.42 tx.id() not equal to rpc getblock(blockhash, 1) tx id #176

@86chenjie

Description

@86chenjie

test code:

it('check_tx_id', async function () {
    // test 147056 / 00000000000007a678f2e1316e0f7f7acf2b967d998558aed8dadcd4430fd5f1
    const height = 147056
    const blockhash = await chain.getblockhash(height)
    const chain_block_hex = await chain.getblock(blockhash, 0)
    const chain_block = await chain.getblock(blockhash, 1)
    const chain_tx0_id = chain_block.tx[0]

    const block = bsv.Block.fromBuffer(Buffer.from(chain_block_hex, 'hex'))
    const block_tx0_id = block.txs[0].id()
    
    console.log(chain_tx0_id)
    console.log(block_tx0_id)
    expect(chain_tx0_id).to.equal(block_tx0_id);
  });

The two tx ids should be equal. Obviously block_tx0_id is not correct.

  2) bsv
       check_tx_id:

      AssertionError: expected '9fa47592276963ff2b8d44d0f547b03a41ac1e4e18e2a02b5445ade9b021071d' to equal '121f0f093c0e98bb499643bbe781a9746deaf4b9b123f958b2a962b3bb57d873'
      + expected - actual

      -9fa47592276963ff2b8d44d0f547b03a41ac1e4e18e2a02b5445ade9b021071d
      +121f0f093c0e98bb499643bbe781a9746deaf4b9b123f958b2a962b3bb57d873

      at Context.<anonymous> (test/chain.spec.js:59:29)
      at process._tickCallback (internal/process/next_tick.js:68:7)

image

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