From 15289fe0cfc3c8b48a1b477a407dc0cc3ce7d044 Mon Sep 17 00:00:00 2001 From: Jonathan Underwood Date: Mon, 10 Dec 2018 01:01:55 +0900 Subject: [PATCH] Add notes for learners about nSequence + LockTime --- test/integration/cltv.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/integration/cltv.js b/test/integration/cltv.js index 2c39b2c..8bf1c4a 100644 --- a/test/integration/cltv.js +++ b/test/integration/cltv.js @@ -50,6 +50,7 @@ describe('bitcoinjs-lib (transactions w/ CLTV)', function () { const txb = new bitcoin.TransactionBuilder(regtest) txb.setLockTime(lockTime) + // Note: nSequence MUST be <= 0xfffffffe otherwise LockTime is ignored, and is immediately spendable. txb.addInput(unspent.txId, unspent.vout, 0xfffffffe) txb.addOutput(regtestUtils.RANDOM_ADDRESS, 7e4) @@ -96,6 +97,7 @@ describe('bitcoinjs-lib (transactions w/ CLTV)', function () { const txb = new bitcoin.TransactionBuilder(regtest) txb.setLockTime(lockTime) + // Note: nSequence MUST be <= 0xfffffffe otherwise LockTime is ignored, and is immediately spendable. txb.addInput(unspent.txId, unspent.vout, 0xfffffffe) txb.addOutput(regtestUtils.RANDOM_ADDRESS, 7e4) @@ -147,6 +149,7 @@ describe('bitcoinjs-lib (transactions w/ CLTV)', function () { const txb = new bitcoin.TransactionBuilder(regtest) txb.setLockTime(lockTime) + // Note: nSequence MUST be <= 0xfffffffe otherwise LockTime is ignored, and is immediately spendable. txb.addInput(unspent.txId, unspent.vout, 0xfffffffe) txb.addOutput(regtestUtils.RANDOM_ADDRESS, 8e4) @@ -191,6 +194,7 @@ describe('bitcoinjs-lib (transactions w/ CLTV)', function () { const txb = new bitcoin.TransactionBuilder(regtest) txb.setLockTime(lockTime) + // Note: nSequence MUST be <= 0xfffffffe otherwise LockTime is ignored, and is immediately spendable. txb.addInput(unspent.txId, unspent.vout, 0xfffffffe) txb.addOutput(regtestUtils.RANDOM_ADDRESS, 1e4)