From 771491bc5ac576335b08420c048f6a458a65be48 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Thu, 9 Mar 2017 10:50:49 +1100 Subject: [PATCH] tests: add coinbase with witness transaction fixture --- test/fixtures/transaction.json | 33 +++++++++++++++++++++++++++++++++ test/transaction.js | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/test/fixtures/transaction.json b/test/fixtures/transaction.json index 04b22e6..7fb5135 100644 --- a/test/fixtures/transaction.json +++ b/test/fixtures/transaction.json @@ -620,6 +620,39 @@ "locktime": 0 }, "coinbase": false + }, + { + "description": "Coinbase transaction w/ witness", + "id": "c881f7b084a367b0603abbcb9c5c639318e6166770e3f9b27a1ee3f8b6a16517", + "hash": "1765a1b6f8e31e7ab2f9e3706716e61893635c9ccbbb3a60b067a384b0f781c8", + "hex": "02000000010000000000000000000000000000000000000000000000000000000000000000ffffffff05022b020101ffffffff02c0cf402500000000232103c6c5964853fd00fb3271ac002831c66825102d223c706ce0ee99e73db3be4aa1ac0000000000000000266a24aa21a9edff828eb21f40ab251d9f107792670aba9299028b894a364fda570f6a089dcfe900000000", + "whex": "020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff05022b020101ffffffff02c0cf402500000000232103c6c5964853fd00fb3271ac002831c66825102d223c706ce0ee99e73db3be4aa1ac0000000000000000266a24aa21a9edff828eb21f40ab251d9f107792670aba9299028b894a364fda570f6a089dcfe90120000000000000000000000000000000000000000000000000000000000000000000000000", + "raw": { + "version": 2, + "ins": [ + { + "hash": "0000000000000000000000000000000000000000000000000000000000000000", + "index": 4294967295, + "data": "022b020101", + "sequence": 4294967295, + "witness": [ + "0000000000000000000000000000000000000000000000000000000000000000" + ] + } + ], + "outs": [ + { + "script": "03c6c5964853fd00fb3271ac002831c66825102d223c706ce0ee99e73db3be4aa1 OP_CHECKSIG", + "value": 625004480 + }, + { + "script": "OP_RETURN aa21a9edff828eb21f40ab251d9f107792670aba9299028b894a364fda570f6a089dcfe9", + "value": 0 + } + ], + "locktime": 0 + }, + "coinbase": true } ], "hashForSignature": [ diff --git a/test/transaction.js b/test/transaction.js index 71e5dea..d4e1cc3 100644 --- a/test/transaction.js +++ b/test/transaction.js @@ -204,7 +204,7 @@ describe('Transaction', function () { describe('isCoinbase', function () { function verify (f) { - it('should return ' + f.coinbase + ' for ' + f.id, function () { + it('should return ' + f.coinbase + ' for ' + f.id + '(' + f.description + ')', function () { var tx = Transaction.fromHex(f.hex) assert.strictEqual(tx.isCoinbase(), f.coinbase)