Timelock bug fix (#920)

* Fix CLTV bug where timestamps using seconds are not allowed in TxBuilder

* Added test for CLTV second timestamp and ran scalafmt

* Fixed another bug

* Fixed bug where calcLockTime was not looking past first CLTV tx
This commit is contained in:
Nadav Kohen 2019-12-06 09:57:56 -07:00 committed by Chris Stewart
parent 5206353a4a
commit b2e5337827
2 changed files with 11 additions and 5 deletions

View File

@ -10,7 +10,6 @@ class NetworkMessageTest extends BitcoinSUnitTest {
NodeTestUtil.rawNetworkMessage)
}
it must "serialize and deserialize a version message example from the bitcoin wiki" in {
val hex = {
//taken from here with slight modifications
@ -24,6 +23,6 @@ class NetworkMessageTest extends BitcoinSUnitTest {
"00"
}.toLowerCase
val networkMsg = NetworkMessage.fromHex(hex)
networkMsg.hex must be (hex)
networkMsg.hex must be(hex)
}
}

View File

@ -1,9 +1,16 @@
package org.bitcoins.core.script.interpreter
import org.bitcoins.core.crypto.{BaseTxSigComponent, WitnessTxSigComponentP2SH, WitnessTxSigComponentRaw}
import org.bitcoins.core.crypto.{
BaseTxSigComponent,
WitnessTxSigComponentP2SH,
WitnessTxSigComponentRaw
}
import org.bitcoins.core.currency.CurrencyUnits
import org.bitcoins.core.protocol.script._
import org.bitcoins.core.protocol.transaction.{TransactionOutput, WitnessTransaction}
import org.bitcoins.core.protocol.transaction.{
TransactionOutput,
WitnessTransaction
}
import org.bitcoins.core.script.PreExecutionScriptProgram
import org.bitcoins.core.script.flag.ScriptFlagFactory
import org.bitcoins.core.script.interpreter.testprotocol.CoreTestCase
@ -27,7 +34,7 @@ class ScriptInterpreterTest extends BitcoinSUnitTest {
val source = Source.fromURL(getClass.getResource("/script_tests.json"))
//use this to represent a single test case from script_valid.json
/* val lines =
/* val lines =
"""
| [["0x01 0x80", "DUP BOOLOR", "P2SH,STRICTENC", "EVAL_FALSE", "negative-0 negative-0 BOOLOR"]]
""".stripMargin*/