From c855851ca6706642c91d83b8be9d3716c3dbe3da Mon Sep 17 00:00:00 2001 From: Chris Stewart Date: Thu, 15 Jun 2017 11:25:11 -0500 Subject: [PATCH] Adding invariant to EscrowTimeoutHelper.closeWithTimeout to require that the escrowTimeoutSPK.timeout branch has a nested SPK of P2PKH --- .../bitcoins/core/script/locktime/LockTimeInterpreter.scala | 5 ++++- .../core/crypto/TransactionSignatureCreatorSpec.scala | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/scala/org/bitcoins/core/script/locktime/LockTimeInterpreter.scala b/src/main/scala/org/bitcoins/core/script/locktime/LockTimeInterpreter.scala index 882ea02c28..8e112fc515 100644 --- a/src/main/scala/org/bitcoins/core/script/locktime/LockTimeInterpreter.scala +++ b/src/main/scala/org/bitcoins/core/script/locktime/LockTimeInterpreter.scala @@ -177,7 +177,8 @@ trait LockTimeInterpreter extends BitcoinSLogger { true } - /** Checks if the given [[ScriptNumber]] and [[UInt32]] are valid values for locking a OP_CSV by block height */ + /** Checks if the given [[ScriptNumber]] and [[UInt32]] are valid values for spending + * a OP_CSV value by block height */ def isCSVLockByBlockHeight(scriptNumber: ScriptNumber, sequence: UInt32): Boolean = { isCSVLockByBlockHeight(scriptNumber) && isCSVLockByBlockHeight(sequence) } @@ -187,6 +188,8 @@ trait LockTimeInterpreter extends BitcoinSLogger { def isCSVLockByBlockHeight(scriptNumber: ScriptNumber): Boolean = !isCSVLockByRelativeLockTime(scriptNumber) + /** Checks if the given [[ScriptNumber]] and [[UInt32]] are valid values + * for spending an OP_CSV value by time based relative lock time */ def isCSVLockByRelativeLockTime(number: ScriptNumber, sequence: UInt32): Boolean = { isCSVLockByRelativeLockTime(number) && isCSVLockByRelativeLockTime(sequence) } diff --git a/src/test/scala/org/bitcoins/core/crypto/TransactionSignatureCreatorSpec.scala b/src/test/scala/org/bitcoins/core/crypto/TransactionSignatureCreatorSpec.scala index e383a89114..3c6a97a778 100644 --- a/src/test/scala/org/bitcoins/core/crypto/TransactionSignatureCreatorSpec.scala +++ b/src/test/scala/org/bitcoins/core/crypto/TransactionSignatureCreatorSpec.scala @@ -72,7 +72,6 @@ class TransactionSignatureCreatorSpec extends Properties("TransactionSignatureCr val result = ScriptInterpreter.run(program) Seq(ScriptOk, ScriptErrorPushSize).contains(result) } - property("fail to verify a transaction with a relative locktime that has not been satisfied yet") = Prop.forAllNoShrink(TransactionGenerators.unspendableCSVTransaction :| "unspendable csv") { case (txSignatureComponent: TxSigComponent, _) =>