add fixture to verify input type classification
(cherry picked from commit 8f9d8b7)
This commit is contained in:
parent
76a6b17a51
commit
8f9b3443d2
2 changed files with 13 additions and 0 deletions
3
test/fixtures/transaction_builder.json
vendored
3
test/fixtures/transaction_builder.json
vendored
|
@ -1446,6 +1446,9 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"classification": {
|
||||||
|
"hex": "01000000059c06fb641a8cd69be81ca91e68d8a115cb698396876ecd77120ec1e4ab9002279f000000b500483045022100d58f828ab39cfac592f89fe372fb520992975218698c683a893f29e39cf0080302207cc0485dab5ce621089bdd15e1f15db0ecbde8dd4bb661bcf0e3af6ecab075e6014c6952210327e023a353d111808f61d554c2e1934721eaf87f33b7a771e807006908a493722103251670bb6a179a0d43b75476c7e580c0ba274378a18077e8de0832c870e5381f2102cca7f9a64425a0466d26d5c7e9eb3ad6b64cd48ea89edb38bc08f58a792dde4753aeffffffff0821dc00213d2b7993f8f2a1553800c6f2f31106da176505d0ade467b68401d795000000b400473044022028e937a7bba888fe3428f442f6e22d92ce2ddba01548c38780d40890fa6cc305022043204d0bcfb1150b045d54cf9b13462e44e2ef47fee03d3cea08e84a8060fc30014c6952210327e023a353d111808f61d554c2e1934721eaf87f33b7a771e807006908a493722103251670bb6a179a0d43b75476c7e580c0ba274378a18077e8de0832c870e5381f2102cca7f9a64425a0466d26d5c7e9eb3ad6b64cd48ea89edb38bc08f58a792dde4753aeffffffffaa997ac385dc666af1f5947ef615431024eb314cac2308d5e1b903e28ca466f499000000b50048304502210093efc26facedc5f51e304aa270a7b4f1a911b2d912c3674e5c6e2ad4ac7a410402201cf0b62c240461902f9f16d8a0bc3a210b7bfcd2c06523dd4b4b63be22e85252014c6952210327e023a353d111808f61d554c2e1934721eaf87f33b7a771e807006908a493722103251670bb6a179a0d43b75476c7e580c0ba274378a18077e8de0832c870e5381f2102cca7f9a64425a0466d26d5c7e9eb3ad6b64cd48ea89edb38bc08f58a792dde4753aeffffffffd9f61bf98a021ee144f33ba5a6b04274de8fcb5c05f1ff7c12367fb7a608b2dd9e000000b4004730440220456e1201c1fa727288cba7fa0054dc02d8dd6c7418cae1e97006ef0652891c9202201192d0fbf3a9c00afb99a415f2bf515509e1150805acd8de95c496c27cb6570f014c6952210327e023a353d111808f61d554c2e1934721eaf87f33b7a771e807006908a493722103251670bb6a179a0d43b75476c7e580c0ba274378a18077e8de0832c870e5381f2102cca7f9a64425a0466d26d5c7e9eb3ad6b64cd48ea89edb38bc08f58a792dde4753aeffffffff1f8119e3bc7c2f451feaa79f42ec5a63502afb425c253c935e43d217d5c29bdea1000000b500483045022100f669004f770490093eba4ac4903cb7581f7d18ea9245c538585ef5367e520e4702205485fafe0be178563a599d41e0cc172bb01314ed65d0e48df19a5258f17bdbc4014c6952210327e023a353d111808f61d554c2e1934721eaf87f33b7a771e807006908a493722103251670bb6a179a0d43b75476c7e580c0ba274378a18077e8de0832c870e5381f2102cca7f9a64425a0466d26d5c7e9eb3ad6b64cd48ea89edb38bc08f58a792dde4753aeffffffff0380f0fa02000000001976a91439692085cf9d27e8c1cf63e76bd32d9bd15cab8b88ac50c300000000000017a9147204bb26950ce1595255897f63d205779f033f3e875b5409000000000017a9142538893d984a4b5695e4bfde1a90a9f02fabf8e38700000000"
|
||||||
|
},
|
||||||
"multisig": [
|
"multisig": [
|
||||||
{
|
{
|
||||||
"description": "P2SH 2-of-2 multisig, signed in correct order",
|
"description": "P2SH 2-of-2 multisig, signed in correct order",
|
||||||
|
|
|
@ -125,6 +125,16 @@ describe('TransactionBuilder', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('correctly classifies transaction inputs', function() {
|
||||||
|
var tx = Transaction.fromHex(fixtures.valid.classification.hex)
|
||||||
|
var txb = TransactionBuilder.fromTransaction(tx)
|
||||||
|
txb.inputs.forEach(function(i) {
|
||||||
|
assert.strictEqual(i.prevOutType, 'scripthash')
|
||||||
|
assert.strictEqual(i.redeemScriptType, 'multisig')
|
||||||
|
assert.strictEqual(i.signType, 'multisig')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
fixtures.invalid.fromTransaction.forEach(function (f) {
|
fixtures.invalid.fromTransaction.forEach(function (f) {
|
||||||
it('throws ' + f.exception, function () {
|
it('throws ' + f.exception, function () {
|
||||||
var tx = Transaction.fromHex(f.txHex)
|
var tx = Transaction.fromHex(f.txHex)
|
||||||
|
|
Loading…
Reference in a new issue