Add notes for learners about nSequence + LockTime
This commit is contained in:
parent
9a8552acda
commit
15289fe0cf
1 changed files with 4 additions and 0 deletions
|
@ -50,6 +50,7 @@ describe('bitcoinjs-lib (transactions w/ CLTV)', function () {
|
||||||
|
|
||||||
const txb = new bitcoin.TransactionBuilder(regtest)
|
const txb = new bitcoin.TransactionBuilder(regtest)
|
||||||
txb.setLockTime(lockTime)
|
txb.setLockTime(lockTime)
|
||||||
|
// Note: nSequence MUST be <= 0xfffffffe otherwise LockTime is ignored, and is immediately spendable.
|
||||||
txb.addInput(unspent.txId, unspent.vout, 0xfffffffe)
|
txb.addInput(unspent.txId, unspent.vout, 0xfffffffe)
|
||||||
txb.addOutput(regtestUtils.RANDOM_ADDRESS, 7e4)
|
txb.addOutput(regtestUtils.RANDOM_ADDRESS, 7e4)
|
||||||
|
|
||||||
|
@ -96,6 +97,7 @@ describe('bitcoinjs-lib (transactions w/ CLTV)', function () {
|
||||||
|
|
||||||
const txb = new bitcoin.TransactionBuilder(regtest)
|
const txb = new bitcoin.TransactionBuilder(regtest)
|
||||||
txb.setLockTime(lockTime)
|
txb.setLockTime(lockTime)
|
||||||
|
// Note: nSequence MUST be <= 0xfffffffe otherwise LockTime is ignored, and is immediately spendable.
|
||||||
txb.addInput(unspent.txId, unspent.vout, 0xfffffffe)
|
txb.addInput(unspent.txId, unspent.vout, 0xfffffffe)
|
||||||
txb.addOutput(regtestUtils.RANDOM_ADDRESS, 7e4)
|
txb.addOutput(regtestUtils.RANDOM_ADDRESS, 7e4)
|
||||||
|
|
||||||
|
@ -147,6 +149,7 @@ describe('bitcoinjs-lib (transactions w/ CLTV)', function () {
|
||||||
|
|
||||||
const txb = new bitcoin.TransactionBuilder(regtest)
|
const txb = new bitcoin.TransactionBuilder(regtest)
|
||||||
txb.setLockTime(lockTime)
|
txb.setLockTime(lockTime)
|
||||||
|
// Note: nSequence MUST be <= 0xfffffffe otherwise LockTime is ignored, and is immediately spendable.
|
||||||
txb.addInput(unspent.txId, unspent.vout, 0xfffffffe)
|
txb.addInput(unspent.txId, unspent.vout, 0xfffffffe)
|
||||||
txb.addOutput(regtestUtils.RANDOM_ADDRESS, 8e4)
|
txb.addOutput(regtestUtils.RANDOM_ADDRESS, 8e4)
|
||||||
|
|
||||||
|
@ -191,6 +194,7 @@ describe('bitcoinjs-lib (transactions w/ CLTV)', function () {
|
||||||
|
|
||||||
const txb = new bitcoin.TransactionBuilder(regtest)
|
const txb = new bitcoin.TransactionBuilder(regtest)
|
||||||
txb.setLockTime(lockTime)
|
txb.setLockTime(lockTime)
|
||||||
|
// Note: nSequence MUST be <= 0xfffffffe otherwise LockTime is ignored, and is immediately spendable.
|
||||||
txb.addInput(unspent.txId, unspent.vout, 0xfffffffe)
|
txb.addInput(unspent.txId, unspent.vout, 0xfffffffe)
|
||||||
txb.addOutput(regtestUtils.RANDOM_ADDRESS, 1e4)
|
txb.addOutput(regtestUtils.RANDOM_ADDRESS, 1e4)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue