Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
Fix test/bitcoincash.test.js
Browse files Browse the repository at this point in the history
Enable test again and fix imports
  • Loading branch information
OttoAllmendinger committed Jan 8, 2020
1 parent 67c0cb2 commit a6930c5
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions test/bitcoincash.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
/* global describe, xit */
/* global describe, it */

var assert = require('assert')
var bscript = require('../src/script')
var ECPair = require('../src/ecpair')
var NETWORKS = require('../src/networks')
var TransactionBuilder = require('../src/transaction_builder')
var Transaction = require('../src/transaction')

const {
networks,
ECPair,
Transaction,
TransactionBuilder,
script
} = require('../src')

describe('TransactionBuilder', function () {
var network = NETWORKS['bitcoincash']
xit('cashtestcase3', function () {
var network = networks.bitcoincashTestnet
it('Build and sign p2pkh', function () {
var value = 50 * 1e8
var txid = '40c8a218923f23df3692530fa8e475251c50c7d630dccbdfbd92ba8092f4aa13'
var vout = 0
Expand All @@ -18,7 +21,7 @@ describe('TransactionBuilder', function () {
var keyPair = ECPair.fromWIF(wif, network)

var pk = keyPair.getPublicKeyBuffer()
var spk = bscript.pubKey.output.encode(pk)
var spk = script.pubKey.output.encode(pk)

var txb = new TransactionBuilder(network)
txb.addInput(txid, vout, Transaction.DEFAULT_SEQUENCE, spk)
Expand All @@ -31,6 +34,10 @@ describe('TransactionBuilder', function () {

var tx = txb.build()
var hex = tx.toHex()
assert.equal('020000000113aaf49280ba92bddfcbdc30d6c7501c2575e4a80f539236df233f9218a2c8400000000049483045022100c5874e39da4dd427d35e24792bf31dcd63c25684deec66b426271b4043e21c3002201bfdc0621ad4237e8db05aa6cad69f3d5ab4ae32ebb2048f65b12165da6cc69341ffffffff0100f2052a010000001976a914cd29cc97826c37281ac61301e4d5ed374770585688ac00000000', hex)
assert.equal(
'020000000113aaf49280ba92bddfcbdc30d6c7501c2575e4a80f539236df233f9218a2c8400000000049483045022100c587' +
'4e39da4dd427d35e24792bf31dcd63c25684deec66b426271b4043e21c3002201bfdc0621ad4237e8db05aa6cad69f3d5ab4' +
'ae32ebb2048f65b12165da6cc69341ffffffff0100f2052a010000001976a914cd29cc97826c37281ac61301e4d5ed374770' +
'585688ac00000000', hex)
})
})

0 comments on commit a6930c5

Please sign in to comment.