Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd9e6d1d5e | ||
|
|
1051946f00 | ||
|
|
55207e5742 | ||
|
|
3ed77c4820 | ||
|
|
54ec449a75 | ||
|
|
cf9a35f59b |
@ -32,7 +32,7 @@ __removed__
|
|||||||
- Removed `bufferutils` (#1035)
|
- Removed `bufferutils` (#1035)
|
||||||
- Removed `networks.litecoin`, BYO non-Bitcoin networks instead (#1095)
|
- Removed `networks.litecoin`, BYO non-Bitcoin networks instead (#1095)
|
||||||
- Removed `script.isCanonicalSignature`, use `script.isCanonicalScriptSignature` instead (#1094)
|
- Removed `script.isCanonicalSignature`, use `script.isCanonicalScriptSignature` instead (#1094)
|
||||||
- Removed `script.*.input/output/check` functions (`templates`), use `payments.*` instead (`templates` previously added in #681, #682) (#1119)
|
- Removed `script.*.input/output/check` functions (`templates`) (previously added in #681, #682) (#1119)
|
||||||
- Removed dependency `bigi`, uses `bn.js` internally now (via `tiny-secp256k1`) (#1070, #1112)
|
- Removed dependency `bigi`, uses `bn.js` internally now (via `tiny-secp256k1`) (#1070, #1112)
|
||||||
- Removed public access to `ECPair` constructor, use exported functions `ECPair.fromPrivateKey`, `ECPair.fromWIF`, `ECPair.makeRandom`, or `ECPair.fromPublicKey` (#1070)
|
- Removed public access to `ECPair` constructor, use exported functions `ECPair.fromPrivateKey`, `ECPair.fromWIF`, `ECPair.makeRandom`, or `ECPair.fromPublicKey` (#1070)
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ Mistakes and bugs happen, but with your help in resolving and reporting [issues]
|
|||||||
- Friendly, with a strong and helpful community, ready to answer questions.
|
- Friendly, with a strong and helpful community, ready to answer questions.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
Presently, we do not have any formal documentation other than our [examples](#examples), please [ask for help](https://github.com/bitcoinjs/bitcoinjs-lib/issues/new) if our examples aren't enough to guide you.
|
Presently, we do not have any formal documentation other than our [examples](#Examples), please [ask for help](https://github.com/bitcoinjs/bitcoinjs-lib/issues/new) if our examples aren't enough to guide you.
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|||||||
@ -5,6 +5,9 @@ const types = require('./types')
|
|||||||
const wif = require('wif')
|
const wif = require('wif')
|
||||||
|
|
||||||
const NETWORKS = require('./networks')
|
const NETWORKS = require('./networks')
|
||||||
|
|
||||||
|
// TODO: why is the function name toJSON weird?
|
||||||
|
function isPoint (x) { return ecc.isPoint(x) }
|
||||||
const isOptions = typeforce.maybe(typeforce.compile({
|
const isOptions = typeforce.maybe(typeforce.compile({
|
||||||
compressed: types.maybe(types.Boolean),
|
compressed: types.maybe(types.Boolean),
|
||||||
network: types.maybe(types.Network)
|
network: types.maybe(types.Network)
|
||||||
@ -54,7 +57,7 @@ function fromPrivateKey (buffer, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function fromPublicKey (buffer, options) {
|
function fromPublicKey (buffer, options) {
|
||||||
typeforce(ecc.isPoint, buffer)
|
typeforce(isPoint, buffer)
|
||||||
typeforce(isOptions, options)
|
typeforce(isOptions, options)
|
||||||
return new ECPair(null, buffer, options)
|
return new ECPair(null, buffer, options)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
let lazy = require('./lazy')
|
const lazy = require('./lazy')
|
||||||
let typef = require('typeforce')
|
const typef = require('typeforce')
|
||||||
let OPS = require('bitcoin-ops')
|
const OPS = require('bitcoin-ops')
|
||||||
let ecc = require('tiny-secp256k1')
|
const ecc = require('tiny-secp256k1')
|
||||||
|
|
||||||
let bscript = require('../script')
|
const bscript = require('../script')
|
||||||
let BITCOIN_NETWORK = require('../networks').bitcoin
|
const BITCOIN_NETWORK = require('../networks').bitcoin
|
||||||
|
|
||||||
// input: {signature}
|
// input: {signature}
|
||||||
// output: {pubKey} OP_CHECKSIG
|
// output: {pubKey} OP_CHECKSIG
|
||||||
@ -27,10 +27,10 @@ function p2pk (a, opts) {
|
|||||||
input: typef.maybe(typef.Buffer)
|
input: typef.maybe(typef.Buffer)
|
||||||
}, a)
|
}, a)
|
||||||
|
|
||||||
let _chunks = lazy.value(function () { return bscript.decompile(a.input) })
|
const _chunks = lazy.value(function () { return bscript.decompile(a.input) })
|
||||||
|
|
||||||
let network = a.network || BITCOIN_NETWORK
|
const network = a.network || BITCOIN_NETWORK
|
||||||
let o = { network }
|
const o = { network }
|
||||||
|
|
||||||
lazy.prop(o, 'output', function () {
|
lazy.prop(o, 'output', function () {
|
||||||
if (!a.pubkey) return
|
if (!a.pubkey) return
|
||||||
@ -58,22 +58,19 @@ function p2pk (a, opts) {
|
|||||||
|
|
||||||
// extended validation
|
// extended validation
|
||||||
if (opts.validate) {
|
if (opts.validate) {
|
||||||
if (a.pubkey && a.output) {
|
|
||||||
if (!a.pubkey.equals(o.pubkey)) throw new TypeError('Pubkey mismatch')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a.output) {
|
if (a.output) {
|
||||||
if (a.output[a.output.length - 1] !== OPS.OP_CHECKSIG) throw new TypeError('Output is invalid')
|
if (a.output[a.output.length - 1] !== OPS.OP_CHECKSIG) throw new TypeError('Output is invalid')
|
||||||
if (!ecc.isPoint(o.pubkey)) throw new TypeError('Output pubkey is invalid')
|
if (!ecc.isPoint(o.pubkey)) throw new TypeError('Output pubkey is invalid')
|
||||||
|
if (a.pubkey && !a.pubkey.equals(o.pubkey)) throw new TypeError('Pubkey mismatch')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a.signature) {
|
if (a.signature) {
|
||||||
if (a.input && !a.input.equals(o.input)) throw new TypeError('Input mismatch')
|
if (a.input && !a.input.equals(o.input)) throw new TypeError('Signature mismatch')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a.input) {
|
if (a.input) {
|
||||||
if (_chunks().length !== 1) throw new TypeError('Input is invalid')
|
if (_chunks().length !== 1) throw new TypeError('Input is invalid')
|
||||||
if (!bscript.isCanonicalScriptSignature(_chunks()[0])) throw new TypeError('Input has invalid signature')
|
if (!bscript.isCanonicalScriptSignature(o.signature)) throw new TypeError('Input has invalid signature')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -106,18 +106,19 @@ function p2pkh (a, opts) {
|
|||||||
a.output[23] !== OPS.OP_EQUALVERIFY ||
|
a.output[23] !== OPS.OP_EQUALVERIFY ||
|
||||||
a.output[24] !== OPS.OP_CHECKSIG) throw new TypeError('Output is invalid')
|
a.output[24] !== OPS.OP_CHECKSIG) throw new TypeError('Output is invalid')
|
||||||
|
|
||||||
if (hash && !hash.equals(a.output.slice(3, 23))) throw new TypeError('Hash mismatch')
|
const hash2 = a.output.slice(3, 23)
|
||||||
else hash = a.output.slice(3, 23)
|
if (hash && !hash.equals(hash2)) throw new TypeError('Hash mismatch')
|
||||||
|
else hash = hash2
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a.pubkey) {
|
if (a.pubkey) {
|
||||||
let pkh = bcrypto.hash160(a.pubkey)
|
const pkh = bcrypto.hash160(a.pubkey)
|
||||||
if (hash && !hash.equals(pkh)) throw new TypeError('Hash mismatch')
|
if (hash && !hash.equals(pkh)) throw new TypeError('Hash mismatch')
|
||||||
else hash = pkh
|
else hash = pkh
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a.input) {
|
if (a.input) {
|
||||||
let chunks = _chunks()
|
const chunks = _chunks()
|
||||||
if (chunks.length !== 2) throw new TypeError('Input is invalid')
|
if (chunks.length !== 2) throw new TypeError('Input is invalid')
|
||||||
if (!bscript.isCanonicalScriptSignature(chunks[0])) throw new TypeError('Input has invalid signature')
|
if (!bscript.isCanonicalScriptSignature(chunks[0])) throw new TypeError('Input has invalid signature')
|
||||||
if (!ecc.isPoint(chunks[1])) throw new TypeError('Input has invalid pubkey')
|
if (!ecc.isPoint(chunks[1])) throw new TypeError('Input has invalid pubkey')
|
||||||
@ -125,7 +126,7 @@ function p2pkh (a, opts) {
|
|||||||
if (a.signature && !a.signature.equals(chunks[0])) throw new TypeError('Signature mismatch')
|
if (a.signature && !a.signature.equals(chunks[0])) throw new TypeError('Signature mismatch')
|
||||||
if (a.pubkey && !a.pubkey.equals(chunks[1])) throw new TypeError('Pubkey mismatch')
|
if (a.pubkey && !a.pubkey.equals(chunks[1])) throw new TypeError('Pubkey mismatch')
|
||||||
|
|
||||||
let pkh = bcrypto.hash160(chunks[1])
|
const pkh = bcrypto.hash160(chunks[1])
|
||||||
if (hash && !hash.equals(pkh)) throw new TypeError('Hash mismatch')
|
if (hash && !hash.equals(pkh)) throw new TypeError('Hash mismatch')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,7 +58,7 @@ function p2sh (a, opts) {
|
|||||||
const _redeem = lazy.value(function () {
|
const _redeem = lazy.value(function () {
|
||||||
const chunks = _chunks()
|
const chunks = _chunks()
|
||||||
return {
|
return {
|
||||||
network: network,
|
network,
|
||||||
output: chunks[chunks.length - 1],
|
output: chunks[chunks.length - 1],
|
||||||
input: bscript.compile(chunks.slice(0, -1)),
|
input: bscript.compile(chunks.slice(0, -1)),
|
||||||
witness: a.witness || []
|
witness: a.witness || []
|
||||||
@ -111,7 +111,7 @@ function p2sh (a, opts) {
|
|||||||
if (a.address) {
|
if (a.address) {
|
||||||
if (_address().version !== network.scriptHash) throw new TypeError('Invalid version or Network mismatch')
|
if (_address().version !== network.scriptHash) throw new TypeError('Invalid version or Network mismatch')
|
||||||
if (_address().hash.length !== 20) throw new TypeError('Invalid address')
|
if (_address().hash.length !== 20) throw new TypeError('Invalid address')
|
||||||
else hash = _address().hash
|
hash = _address().hash
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a.hash) {
|
if (a.hash) {
|
||||||
@ -125,6 +125,7 @@ function p2sh (a, opts) {
|
|||||||
a.output[0] !== OPS.OP_HASH160 ||
|
a.output[0] !== OPS.OP_HASH160 ||
|
||||||
a.output[1] !== 0x14 ||
|
a.output[1] !== 0x14 ||
|
||||||
a.output[22] !== OPS.OP_EQUAL) throw new TypeError('Output is invalid')
|
a.output[22] !== OPS.OP_EQUAL) throw new TypeError('Output is invalid')
|
||||||
|
|
||||||
const hash2 = a.output.slice(2, 22)
|
const hash2 = a.output.slice(2, 22)
|
||||||
if (hash && !hash.equals(hash2)) throw new TypeError('Hash mismatch')
|
if (hash && !hash.equals(hash2)) throw new TypeError('Hash mismatch')
|
||||||
else hash = hash2
|
else hash = hash2
|
||||||
@ -165,9 +166,10 @@ function p2sh (a, opts) {
|
|||||||
|
|
||||||
if (a.redeem) {
|
if (a.redeem) {
|
||||||
if (a.redeem.network && a.redeem.network !== network) throw new TypeError('Network mismatch')
|
if (a.redeem.network && a.redeem.network !== network) throw new TypeError('Network mismatch')
|
||||||
if (o.redeem) {
|
if (a.input) {
|
||||||
if (a.redeem.output && !a.redeem.output.equals(o.redeem.output)) throw new TypeError('Redeem.output mismatch')
|
const redeem = _redeem()
|
||||||
if (a.redeem.input && !a.redeem.input.equals(o.redeem.input)) throw new TypeError('Redeem.input mismatch')
|
if (a.redeem.output && !a.redeem.output.equals(redeem.output)) throw new TypeError('Redeem.output mismatch')
|
||||||
|
if (a.redeem.input && !a.redeem.input.equals(redeem.input)) throw new TypeError('Redeem.input mismatch')
|
||||||
}
|
}
|
||||||
|
|
||||||
checkRedeem(a.redeem)
|
checkRedeem(a.redeem)
|
||||||
|
|||||||
@ -93,7 +93,6 @@ function p2wpkh (a, opts) {
|
|||||||
if (network && network.bech32 !== _address().prefix) throw new TypeError('Invalid prefix or Network mismatch')
|
if (network && network.bech32 !== _address().prefix) throw new TypeError('Invalid prefix or Network mismatch')
|
||||||
if (_address().version !== 0x00) throw new TypeError('Invalid address version')
|
if (_address().version !== 0x00) throw new TypeError('Invalid address version')
|
||||||
if (_address().data.length !== 20) throw new TypeError('Invalid address data')
|
if (_address().data.length !== 20) throw new TypeError('Invalid address data')
|
||||||
// if (hash && !hash.equals(_address().data)) throw new TypeError('Hash mismatch')
|
|
||||||
hash = _address().data
|
hash = _address().data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -122,7 +122,7 @@ function p2wsh (a, opts) {
|
|||||||
if (_address().prefix !== network.bech32) throw new TypeError('Invalid prefix or Network mismatch')
|
if (_address().prefix !== network.bech32) throw new TypeError('Invalid prefix or Network mismatch')
|
||||||
if (_address().version !== 0x00) throw new TypeError('Invalid address version')
|
if (_address().version !== 0x00) throw new TypeError('Invalid address version')
|
||||||
if (_address().data.length !== 32) throw new TypeError('Invalid address data')
|
if (_address().data.length !== 32) throw new TypeError('Invalid address data')
|
||||||
else hash = _address().data
|
hash = _address().data
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a.hash) {
|
if (a.hash) {
|
||||||
|
|||||||
@ -22,23 +22,7 @@ const GROUP_ORDER = Buffer.from('fffffffffffffffffffffffffffffffebaaedce6af48a03
|
|||||||
const GROUP_ORDER_LESS_1 = Buffer.from('fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140', 'hex')
|
const GROUP_ORDER_LESS_1 = Buffer.from('fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140', 'hex')
|
||||||
|
|
||||||
describe('ECPair', function () {
|
describe('ECPair', function () {
|
||||||
describe('getPublicKey', function () {
|
describe('constructor', function () {
|
||||||
let keyPair
|
|
||||||
|
|
||||||
beforeEach(function () {
|
|
||||||
keyPair = ECPair.fromPrivateKey(ONE)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('calls pointFromScalar lazily', hoodwink(function () {
|
|
||||||
assert.strictEqual(keyPair.__Q, null)
|
|
||||||
|
|
||||||
// .publicKey forces the memoization
|
|
||||||
assert.strictEqual(keyPair.publicKey.toString('hex'), '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798')
|
|
||||||
assert.strictEqual(keyPair.__Q.toString('hex'), '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798')
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('fromPrivateKey', function () {
|
|
||||||
it('defaults to compressed', function () {
|
it('defaults to compressed', function () {
|
||||||
const keyPair = ECPair.fromPrivateKey(ONE)
|
const keyPair = ECPair.fromPrivateKey(ONE)
|
||||||
|
|
||||||
@ -65,6 +49,8 @@ describe('ECPair', function () {
|
|||||||
fixtures.valid.forEach(function (f) {
|
fixtures.valid.forEach(function (f) {
|
||||||
it('derives public key for ' + f.WIF, function () {
|
it('derives public key for ' + f.WIF, function () {
|
||||||
const d = Buffer.from(f.d, 'hex')
|
const d = Buffer.from(f.d, 'hex')
|
||||||
|
console.log(d)
|
||||||
|
|
||||||
const keyPair = ECPair.fromPrivateKey(d, {
|
const keyPair = ECPair.fromPrivateKey(d, {
|
||||||
compressed: f.compressed
|
compressed: f.compressed
|
||||||
})
|
})
|
||||||
@ -73,25 +59,37 @@ describe('ECPair', function () {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
fixtures.invalid.fromPrivateKey.forEach(function (f) {
|
fixtures.invalid.constructor.forEach(function (f) {
|
||||||
it('throws ' + f.exception, function () {
|
it('throws ' + f.exception, function () {
|
||||||
const d = Buffer.from(f.d, 'hex')
|
if (f.d) {
|
||||||
assert.throws(function () {
|
const d = Buffer.from(f.d, 'hex')
|
||||||
ECPair.fromPrivateKey(d, f.options)
|
assert.throws(function () {
|
||||||
}, new RegExp(f.exception))
|
ECPair.fromPrivateKey(d, f.options)
|
||||||
|
}, new RegExp(f.exception))
|
||||||
|
} else {
|
||||||
|
const Q = Buffer.from(f.Q, 'hex')
|
||||||
|
assert.throws(function () {
|
||||||
|
ECPair.fromPublicKey(Q, f.options)
|
||||||
|
}, new RegExp(f.exception))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('fromPublicKey', function () {
|
describe('getPublicKey', function () {
|
||||||
fixtures.invalid.fromPublicKey.forEach(function (f) {
|
let keyPair
|
||||||
it('throws ' + f.exception, function () {
|
|
||||||
const Q = Buffer.from(f.Q, 'hex')
|
beforeEach(function () {
|
||||||
assert.throws(function () {
|
keyPair = ECPair.fromPrivateKey(ONE)
|
||||||
ECPair.fromPublicKey(Q, f.options)
|
|
||||||
}, new RegExp(f.exception))
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('calls pointFromScalar lazily', hoodwink(function () {
|
||||||
|
assert.strictEqual(keyPair.__Q, null)
|
||||||
|
|
||||||
|
// .publicKey forces the memoization
|
||||||
|
assert.strictEqual(keyPair.publicKey.toString('hex'), '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798')
|
||||||
|
assert.strictEqual(keyPair.__Q.toString('hex'), '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798')
|
||||||
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('fromWIF', function () {
|
describe('fromWIF', function () {
|
||||||
|
|||||||
23
test/fixtures/ecpair.json
vendored
23
test/fixtures/ecpair.json
vendored
@ -66,7 +66,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"invalid": {
|
"invalid": {
|
||||||
"fromPrivateKey": [
|
"constructor": [
|
||||||
{
|
{
|
||||||
"exception": "Private key not in range \\[1, n\\)",
|
"exception": "Private key not in range \\[1, n\\)",
|
||||||
"d": "0000000000000000000000000000000000000000000000000000000000000000"
|
"d": "0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
@ -93,26 +93,7 @@
|
|||||||
"network": {}
|
"network": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"fromPublicKey": [
|
|
||||||
{
|
|
||||||
"exception": "Expected isPoint, got Buffer",
|
|
||||||
"Q": "",
|
|
||||||
"options": {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"exception": "Expected property \"network.messagePrefix\" of type Buffer|String, got undefined",
|
|
||||||
"Q": "044289801366bcee6172b771cf5a7f13aaecd237a0b9a1ff9d769cabc2e6b70a34cec320a0565fb7caf11b1ca2f445f9b7b012dda5718b3cface369ee3a034ded6",
|
|
||||||
"options": {
|
|
||||||
"network": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "Bad X coordinate (== P)",
|
|
||||||
"exception": "Expected isPoint, got Buffer",
|
|
||||||
"Q": "040000000000000000000000000000000000000000000000000000000000000001fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",
|
|
||||||
"options": {}
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"fromWIF": [
|
"fromWIF": [
|
||||||
{
|
{
|
||||||
|
|||||||
17
test/fixtures/p2pk.json
vendored
17
test/fixtures/p2pk.json
vendored
@ -7,7 +7,7 @@
|
|||||||
},
|
},
|
||||||
"expected": {
|
"expected": {
|
||||||
"pubkey": "030000000000000000000000000000000000000000000000000000000000000001",
|
"pubkey": "030000000000000000000000000000000000000000000000000000000000000001",
|
||||||
"signatures": null,
|
"signature": null,
|
||||||
"input": null,
|
"input": null,
|
||||||
"witness": null
|
"witness": null
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@
|
|||||||
},
|
},
|
||||||
"expected": {
|
"expected": {
|
||||||
"output": "030000000000000000000000000000000000000000000000000000000000000001 OP_CHECKSIG",
|
"output": "030000000000000000000000000000000000000000000000000000000000000001 OP_CHECKSIG",
|
||||||
"signatures": null,
|
"signature": null,
|
||||||
"input": null,
|
"input": null,
|
||||||
"witness": null
|
"witness": null
|
||||||
}
|
}
|
||||||
@ -116,6 +116,19 @@
|
|||||||
"pubkey": "030000000000000000000000000000000000000000000000000000000000000001",
|
"pubkey": "030000000000000000000000000000000000000000000000000000000000000001",
|
||||||
"input": "ffffffffffffffff"
|
"input": "ffffffffffffffff"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"exception": "Input has invalid signature",
|
||||||
|
"arguments": {
|
||||||
|
"input": "30060201ff0201ff01"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"exception": "Signature mismatch",
|
||||||
|
"arguments": {
|
||||||
|
"signature": "300602010002010001",
|
||||||
|
"input": "300602010302010301"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dynamic": {
|
"dynamic": {
|
||||||
|
|||||||
7
test/fixtures/p2pkh.json
vendored
7
test/fixtures/p2pkh.json
vendored
@ -204,6 +204,13 @@
|
|||||||
"hash": "ffffffffffffffffffffffffffffffffffffffff",
|
"hash": "ffffffffffffffffffffffffffffffffffffffff",
|
||||||
"input": "300602010002010001 030000000000000000000000000000000000000000000000000000000000000001"
|
"input": "300602010002010001 030000000000000000000000000000000000000000000000000000000000000001"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"exception": "Signature mismatch",
|
||||||
|
"arguments": {
|
||||||
|
"signature": "300602010002010001",
|
||||||
|
"input": "300602010302010301 030000000000000000000000000000000000000000000000000000000000000001"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dynamic": {
|
"dynamic": {
|
||||||
|
|||||||
14
test/fixtures/p2wsh.json
vendored
14
test/fixtures/p2wsh.json
vendored
@ -269,6 +269,20 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"exception": "Witness and redeem.witness mismatch",
|
||||||
|
"arguments": {
|
||||||
|
"redeem": {
|
||||||
|
"output": "OP_TRUE",
|
||||||
|
"witness": [
|
||||||
|
"04000000ff"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"witness": [
|
||||||
|
"04000000ee"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"exception": "Ambiguous witness source",
|
"exception": "Ambiguous witness source",
|
||||||
"arguments": {
|
"arguments": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user