From aa748c012fc03e6bde6435092505e3c17a70437a Mon Sep 17 00:00:00 2001 From: Chris Stewart Date: Wed, 3 Nov 2021 15:13:19 -0500 Subject: [PATCH] 2021 11 03 protocol version (#3793) * ProtocolVersion WIP * Start incorporating protocol version into DLC Offer * Fix doc --- .../commons/serializers/Picklers.scala | 1 + .../org/bitcoins/gui/WalletGUIModel.scala | 2 +- .../org/bitcoins/server/DLCRoutesSpec.scala | 2 +- .../org/bitcoins/server/RoutesSpec.scala | 1 + .../core/protocol/dlc/DLCMessageTest.scala | 4 +- .../protocol/dlc/build/DLCTxBuilder.scala | 1 + .../core/protocol/dlc/models/DLCMessage.scala | 5 +- .../org/bitcoins/core/protocol/tlv/TLV.scala | 46 ++++++++++++------- .../core}/serializers/PicklerKeys.scala | 5 +- .../dlc/testgen/DLCParsingTestVector.scala | 12 ++++- .../org/bitcoins/dlc/testgen/DLCTLVGen.scala | 6 +++ .../bitcoins/dlc/testgen/DLCTestVector.scala | 1 + .../dlc/wallet/WalletDLCSetupTest.scala | 1 + .../org/bitcoins/dlc/wallet/DLCWallet.scala | 1 + .../dlc/wallet/models/DLCOfferDb.scala | 2 + docs/core/dlc.md | 1 + .../testkitcore/dlc/TestDLCClient.scala | 2 + .../org/bitcoins/testkitcore/gen/TLVGen.scala | 1 + .../testkit/wallet/DLCWalletUtil.scala | 1 + 19 files changed, 72 insertions(+), 23 deletions(-) rename {app-commons/src/main/scala/org/bitcoins/commons => core/src/main/scala/org/bitcoins/core}/serializers/PicklerKeys.scala (85%) diff --git a/app-commons/src/main/scala/org/bitcoins/commons/serializers/Picklers.scala b/app-commons/src/main/scala/org/bitcoins/commons/serializers/Picklers.scala index 6573478b60..5b127e49fc 100644 --- a/app-commons/src/main/scala/org/bitcoins/commons/serializers/Picklers.scala +++ b/app-commons/src/main/scala/org/bitcoins/commons/serializers/Picklers.scala @@ -15,6 +15,7 @@ import org.bitcoins.core.protocol.transaction.{Transaction, TransactionOutPoint} import org.bitcoins.core.protocol.{BitcoinAddress, BlockStamp} import org.bitcoins.core.psbt.InputPSBTRecord.PartialSignature import org.bitcoins.core.psbt.PSBT +import org.bitcoins.core.serializers.PicklerKeys import org.bitcoins.core.util.TimeUtil import org.bitcoins.core.util.TimeUtil._ import org.bitcoins.core.wallet.fee.SatoshisPerVirtualByte diff --git a/app/gui/src/main/scala/org/bitcoins/gui/WalletGUIModel.scala b/app/gui/src/main/scala/org/bitcoins/gui/WalletGUIModel.scala index d6b5010ed4..81e75d85d0 100644 --- a/app/gui/src/main/scala/org/bitcoins/gui/WalletGUIModel.scala +++ b/app/gui/src/main/scala/org/bitcoins/gui/WalletGUIModel.scala @@ -4,8 +4,8 @@ import akka.actor.{ActorSystem, Cancellable} import grizzled.slf4j.Logging import org.bitcoins.cli.CliCommand._ import org.bitcoins.cli.ConsoleCli -import org.bitcoins.commons.serializers.PicklerKeys import org.bitcoins.core.dlc.accounting.RateOfReturnUtil +import org.bitcoins.core.serializers.PicklerKeys import org.bitcoins.core.wallet.fee.FeeUnit import org.bitcoins.gui.dialog._ import org.bitcoins.gui.dlc.DLCPaneModel diff --git a/app/server-test/src/test/scala/org/bitcoins/server/DLCRoutesSpec.scala b/app/server-test/src/test/scala/org/bitcoins/server/DLCRoutesSpec.scala index 965bdfb891..dfe6fb0efe 100644 --- a/app/server-test/src/test/scala/org/bitcoins/server/DLCRoutesSpec.scala +++ b/app/server-test/src/test/scala/org/bitcoins/server/DLCRoutesSpec.scala @@ -2,11 +2,11 @@ package org.bitcoins.server import akka.http.scaladsl.model.ContentTypes import akka.http.scaladsl.testkit.ScalatestRouteTest -import org.bitcoins.commons.serializers.PicklerKeys import org.bitcoins.core.api.dlc.node.DLCNodeApi import org.bitcoins.core.currency.{Bitcoins, Satoshis} import org.bitcoins.core.protocol.dlc.models.ContractInfo import org.bitcoins.core.protocol.tlv.OracleAnnouncementTLV +import org.bitcoins.core.serializers.PicklerKeys import org.bitcoins.server.routes.ServerCommand import org.scalamock.scalatest.MockFactory import org.scalatest.wordspec.AnyWordSpec diff --git a/app/server-test/src/test/scala/org/bitcoins/server/RoutesSpec.scala b/app/server-test/src/test/scala/org/bitcoins/server/RoutesSpec.scala index 0e1815db36..c408564649 100644 --- a/app/server-test/src/test/scala/org/bitcoins/server/RoutesSpec.scala +++ b/app/server-test/src/test/scala/org/bitcoins/server/RoutesSpec.scala @@ -928,6 +928,7 @@ class RoutesSpec extends AnyWordSpec with ScalatestRouteTest with MockFactory { val contractInfoTLV = contractInfo.toTLV val offer = DLCOffer( + protocolVersionOpt = DLCOfferTLV.currentVersionOpt, contractInfo = contractInfo, pubKeys = dummyDLCKeys, totalCollateral = Satoshis(2500), diff --git a/core-test/src/test/scala/org/bitcoins/core/protocol/dlc/DLCMessageTest.scala b/core-test/src/test/scala/org/bitcoins/core/protocol/dlc/DLCMessageTest.scala index 3c720f82f8..f8b9617c0b 100644 --- a/core-test/src/test/scala/org/bitcoins/core/protocol/dlc/DLCMessageTest.scala +++ b/core-test/src/test/scala/org/bitcoins/core/protocol/dlc/DLCMessageTest.scala @@ -10,7 +10,7 @@ import org.bitcoins.core.protocol.dlc.models.DLCMessage.{ DLCSign } import org.bitcoins.core.protocol.dlc.models._ -import org.bitcoins.core.protocol.tlv.EnumOutcome +import org.bitcoins.core.protocol.tlv.{DLCOfferTLV, EnumOutcome} import org.bitcoins.core.psbt.InputPSBTRecord.PartialSignature import org.bitcoins.core.wallet.fee.SatoshisPerVirtualByte import org.bitcoins.crypto._ @@ -47,6 +47,7 @@ class DLCMessageTest extends BitcoinSJvmTest { it must "not allow a negative collateral for a DLCOffer" in { assertThrows[IllegalArgumentException]( DLCOffer( + protocolVersionOpt = DLCOfferTLV.currentVersionOpt, contractInfo = ContractInfo.dummy, pubKeys = DLCPublicKeys(dummyPubKey, dummyAddress), totalCollateral = Satoshis(-1), @@ -63,6 +64,7 @@ class DLCMessageTest extends BitcoinSJvmTest { it must "not allow same change and fund output serial id for a DLCOffer" in { assertThrows[IllegalArgumentException]( DLCOffer( + protocolVersionOpt = DLCOfferTLV.currentVersionOpt, contractInfo = ContractInfo.dummy, pubKeys = DLCPublicKeys(dummyPubKey, dummyAddress), totalCollateral = Satoshis(-1), diff --git a/core/src/main/scala/org/bitcoins/core/protocol/dlc/build/DLCTxBuilder.scala b/core/src/main/scala/org/bitcoins/core/protocol/dlc/build/DLCTxBuilder.scala index 0b7ec8b5bd..3a374eb85a 100644 --- a/core/src/main/scala/org/bitcoins/core/protocol/dlc/build/DLCTxBuilder.scala +++ b/core/src/main/scala/org/bitcoins/core/protocol/dlc/build/DLCTxBuilder.scala @@ -28,6 +28,7 @@ import scodec.bits.ByteVector case class DLCTxBuilder(offer: DLCOffer, accept: DLCAcceptWithoutSigs) { val DLCOffer(_, + _, DLCPublicKeys(offerFundingKey: ECPublicKey, offerFinalAddress: BitcoinAddress), offerTotalCollateral: Satoshis, diff --git a/core/src/main/scala/org/bitcoins/core/protocol/dlc/models/DLCMessage.scala b/core/src/main/scala/org/bitcoins/core/protocol/dlc/models/DLCMessage.scala index b38e929b4e..a6f1e7e3c9 100644 --- a/core/src/main/scala/org/bitcoins/core/protocol/dlc/models/DLCMessage.scala +++ b/core/src/main/scala/org/bitcoins/core/protocol/dlc/models/DLCMessage.scala @@ -77,6 +77,7 @@ object DLCMessage { * @param timeouts The set of timeouts for the CETs */ case class DLCOffer( + protocolVersionOpt: Option[Int], contractInfo: ContractInfo, pubKeys: DLCPublicKeys, totalCollateral: Satoshis, @@ -110,9 +111,10 @@ object DLCMessage { changeAddress.networkParameters.chainParams.genesisBlock.blockHeader.hash DLCOfferTLV( + protocolVersionOpt = protocolVersionOpt, contractFlags = 0x00, chainHash = chainHash, - contractInfo.toTLV, + contractInfo = contractInfo.toTLV, fundingPubKey = pubKeys.fundingKey, payoutSPK = pubKeys.payoutAddress.scriptPubKey, payoutSerialId = payoutSerialId, @@ -140,6 +142,7 @@ object DLCMessage { val contractInfo = ContractInfo.fromTLV(offer.contractInfo) DLCOffer( + protocolVersionOpt = offer.protocolVersionOpt, contractInfo = contractInfo, pubKeys = DLCPublicKeys( offer.fundingPubKey, diff --git a/core/src/main/scala/org/bitcoins/core/protocol/tlv/TLV.scala b/core/src/main/scala/org/bitcoins/core/protocol/tlv/TLV.scala index 75ee909e78..845db427ac 100644 --- a/core/src/main/scala/org/bitcoins/core/protocol/tlv/TLV.scala +++ b/core/src/main/scala/org/bitcoins/core/protocol/tlv/TLV.scala @@ -1369,6 +1369,7 @@ object FundingSignaturesV0TLV extends TLVFactory[FundingSignaturesV0TLV] { sealed trait DLCSetupTLV extends TLV case class DLCOfferTLV( + protocolVersionOpt: Option[Int], contractFlags: Byte, chainHash: DoubleSha256Digest, contractInfo: ContractInfoV0TLV, @@ -1391,7 +1392,12 @@ case class DLCOfferTLV( override val tpe: BigSizeUInt = DLCOfferTLV.tpe override val value: ByteVector = { - ByteVector(contractFlags) ++ + val versionBytes = protocolVersionOpt match { + case Some(v) => UInt32(v).bytes + case None => ByteVector.empty + } + versionBytes ++ + ByteVector(contractFlags) ++ chainHash.bytes ++ contractInfo.bytes ++ fundingPubKey.bytes ++ @@ -1409,11 +1415,18 @@ case class DLCOfferTLV( } object DLCOfferTLV extends TLVFactory[DLCOfferTLV] { + + /** No version for now */ + val currentVersionOpt: Option[Int] = None + + val currentVersionU32: Option[UInt32] = { + currentVersionOpt.map(UInt32(_)) + } override val tpe: BigSizeUInt = BigSizeUInt(42778) override def fromTLVValue(value: ByteVector): DLCOfferTLV = { val iter = ValueIterator(value) - + val protocolVersionOpt = None val contractFlags = iter.take(1).head val chainHash = iter.take(DoubleSha256Digest, 32) val contractInfo = iter.take(ContractInfoV0TLV) @@ -1431,20 +1444,21 @@ object DLCOfferTLV extends TLVFactory[DLCOfferTLV] { val contractTimeout = BlockTimeStamp(iter.takeU32()) DLCOfferTLV( - contractFlags, - chainHash, - contractInfo, - fundingPubKey, - payoutSPK, - payoutSerialId, - totalCollateralSatoshis, - fundingInputs, - changeSPK, - changeSerialId, - fundingOutputSerialId, - feeRate, - contractMaturityBound, - contractTimeout + protocolVersionOpt = protocolVersionOpt, + contractFlags = contractFlags, + chainHash = chainHash, + contractInfo = contractInfo, + fundingPubKey = fundingPubKey, + payoutSPK = payoutSPK, + payoutSerialId = payoutSerialId, + totalCollateralSatoshis = totalCollateralSatoshis, + fundingInputs = fundingInputs, + changeSPK = changeSPK, + changeSerialId = changeSerialId, + fundOutputSerialId = fundingOutputSerialId, + feeRate = feeRate, + contractMaturityBound = contractMaturityBound, + contractTimeout = contractTimeout ) } diff --git a/app-commons/src/main/scala/org/bitcoins/commons/serializers/PicklerKeys.scala b/core/src/main/scala/org/bitcoins/core/serializers/PicklerKeys.scala similarity index 85% rename from app-commons/src/main/scala/org/bitcoins/commons/serializers/PicklerKeys.scala rename to core/src/main/scala/org/bitcoins/core/serializers/PicklerKeys.scala index 41a2eabed1..201b7e4db1 100644 --- a/app-commons/src/main/scala/org/bitcoins/commons/serializers/PicklerKeys.scala +++ b/core/src/main/scala/org/bitcoins/core/serializers/PicklerKeys.scala @@ -1,4 +1,4 @@ -package org.bitcoins.commons.serializers +package org.bitcoins.core.serializers object PicklerKeys { final val myCollateral: String = "myCollateral" @@ -17,4 +17,7 @@ object PicklerKeys { final val payoutKey: String = "payout" final val extraPrecisionKey: String = "extraPrecision" final val isEndpointKey: String = "isEndpoint" + + //offers + final val protocolVersionKey: String = "protocolVersion" } diff --git a/dlc-test/src/test/scala/org/bitcoins/dlc/testgen/DLCParsingTestVector.scala b/dlc-test/src/test/scala/org/bitcoins/dlc/testgen/DLCParsingTestVector.scala index f3e7944b45..b4c414d6aa 100644 --- a/dlc-test/src/test/scala/org/bitcoins/dlc/testgen/DLCParsingTestVector.scala +++ b/dlc-test/src/test/scala/org/bitcoins/dlc/testgen/DLCParsingTestVector.scala @@ -4,6 +4,7 @@ import org.bitcoins.core.number.{UInt16, UInt64} import org.bitcoins.core.protocol.BigSizeUInt import org.bitcoins.core.protocol.script.EmptyScriptPubKey import org.bitcoins.core.protocol.tlv._ +import org.bitcoins.core.serializers.PicklerKeys import org.bitcoins.crypto.{CryptoUtil, NetworkElement} import org.bitcoins.dlc.testgen.ByteVectorWrapper._ import play.api.libs.json._ @@ -285,7 +286,8 @@ object DLCParsingTestVector extends TestVectorParser[DLCParsingTestVector] { }) ) DLCTLVTestVector(tlv, "funding_signatures_v0", fields) - case DLCOfferTLV(contractFlags, + case DLCOfferTLV(versionOpt, + contractFlags, chainHash, contractInfo, fundingPubKey, @@ -299,7 +301,13 @@ object DLCParsingTestVector extends TestVectorParser[DLCParsingTestVector] { feeRate, contractMaturityBound, contractTimeout) => - val fields = Vector( + val version = versionOpt match { + case Some(version) => + Vector(PicklerKeys.protocolVersionKey -> Element(UInt16(version))) + case None => + Vector.empty + } + val fields = version ++ Vector( "tpe" -> Element(UInt16(DLCOfferTLV.tpe.toInt)), "contractFlags" -> Element(ByteVector(contractFlags)), "chainHash" -> Element(chainHash), diff --git a/dlc-test/src/test/scala/org/bitcoins/dlc/testgen/DLCTLVGen.scala b/dlc-test/src/test/scala/org/bitcoins/dlc/testgen/DLCTLVGen.scala index 411a63f418..05b04346a0 100644 --- a/dlc-test/src/test/scala/org/bitcoins/dlc/testgen/DLCTLVGen.scala +++ b/dlc-test/src/test/scala/org/bitcoins/dlc/testgen/DLCTLVGen.scala @@ -229,6 +229,7 @@ object DLCTLVGen { } def dlcOffer( + protocolVersionOpt: Option[Int] = DLCOfferTLV.currentVersionOpt, contractInfo: ContractInfo = genContractInfo(), fundingPubKey: ECPublicKey = ECPublicKey.freshPublicKey, payoutAddress: BitcoinAddress = address(), @@ -242,6 +243,7 @@ object DLCTLVGen { contractMaturityBound: BlockTimeStamp = BlockTimeStamp(100), contractTimeout: BlockTimeStamp = BlockTimeStamp(200)): DLCOffer = { DLCOffer( + protocolVersionOpt, contractInfo, DLCPublicKeys(fundingPubKey, payoutAddress), totalCollateral, @@ -256,6 +258,7 @@ object DLCTLVGen { } def dlcOfferTLV( + protocolVersionOpt: Option[Int] = DLCOfferTLV.currentVersionOpt, contractInfo: ContractInfo = genContractInfo(), fundingPubKey: ECPublicKey = ECPublicKey.freshPublicKey, payoutAddress: BitcoinAddress = address(), @@ -269,6 +272,7 @@ object DLCTLVGen { contractMaturityBound: BlockTimeStamp = BlockTimeStamp(100), contractTimeout: BlockTimeStamp = BlockTimeStamp(200)): DLCOfferTLV = { dlcOffer( + protocolVersionOpt, contractInfo, fundingPubKey, payoutAddress, @@ -285,6 +289,7 @@ object DLCTLVGen { } def dlcOfferParsingTestVector( + protocolVersionOpt: Option[Int] = DLCOfferTLV.currentVersionOpt, contractInfo: ContractInfo = genContractInfo(), fundingPubKey: ECPublicKey = ECPublicKey.freshPublicKey, payoutAddress: BitcoinAddress = address(), @@ -300,6 +305,7 @@ object DLCTLVGen { BlockTimeStamp(200)): DLCParsingTestVector = { DLCParsingTestVector( dlcOfferTLV( + protocolVersionOpt, contractInfo, fundingPubKey, payoutAddress, diff --git a/dlc-test/src/test/scala/org/bitcoins/dlc/testgen/DLCTestVector.scala b/dlc-test/src/test/scala/org/bitcoins/dlc/testgen/DLCTestVector.scala index 801a53552a..e73704daea 100644 --- a/dlc-test/src/test/scala/org/bitcoins/dlc/testgen/DLCTestVector.scala +++ b/dlc-test/src/test/scala/org/bitcoins/dlc/testgen/DLCTestVector.scala @@ -117,6 +117,7 @@ case class DLCPartyParams( def toOffer(params: DLCParams): DLCOffer = { DLCOffer( + DLCOfferTLV.currentVersionOpt, ContractInfo( EnumContractDescriptor(params.contractInfo.map(_.toMapEntry)), params.oracleInfo), diff --git a/dlc-wallet-test/src/test/scala/org/bitcoins/dlc/wallet/WalletDLCSetupTest.scala b/dlc-wallet-test/src/test/scala/org/bitcoins/dlc/wallet/WalletDLCSetupTest.scala index 9088d001c3..1fb6a8db25 100644 --- a/dlc-wallet-test/src/test/scala/org/bitcoins/dlc/wallet/WalletDLCSetupTest.scala +++ b/dlc-wallet-test/src/test/scala/org/bitcoins/dlc/wallet/WalletDLCSetupTest.scala @@ -709,6 +709,7 @@ class WalletDLCSetupTest extends BitcoinSDualWalletTest { "fdd824b4caaec7479cc9d37003f5add6504d035054ffeac8637a990305a45cfecc1062044c3f68b45318f57e41c4544a4a950c0744e2a80854349a3426b00ad86da5090b9e942dc6df2ae87f007b45b0ccd63e6c354d92c4545fc099ea3e137e54492d1efdd822500001a6a09c7c83c50b34f9db560a2e14fef2eab5224c15b18c7114331756364bfce65ffe3800fdd8062400030c44656d6f637261745f77696e0e52657075626c6963616e5f77696e056f746865720161")) val offerData = DLCOffer( + DLCOfferTLV.currentVersionOpt, ContractInfo(contractDescriptor, oracleInfo), dummyDLCKeys, Satoshis(5000), diff --git a/dlc-wallet/src/main/scala/org/bitcoins/dlc/wallet/DLCWallet.scala b/dlc-wallet/src/main/scala/org/bitcoins/dlc/wallet/DLCWallet.scala index 895f3db3ee..3a519e8c0a 100644 --- a/dlc-wallet/src/main/scala/org/bitcoins/dlc/wallet/DLCWallet.scala +++ b/dlc-wallet/src/main/scala/org/bitcoins/dlc/wallet/DLCWallet.scala @@ -372,6 +372,7 @@ abstract class DLCWallet BlockTimeStamp(refundLocktime)) offer = DLCOffer( + protocolVersionOpt = DLCOfferTLV.currentVersionOpt, contractInfo = contractInfo, pubKeys = dlcPubKeys, totalCollateral = collateral.satoshis, diff --git a/dlc-wallet/src/main/scala/org/bitcoins/dlc/wallet/models/DLCOfferDb.scala b/dlc-wallet/src/main/scala/org/bitcoins/dlc/wallet/models/DLCOfferDb.scala index 982d4c5d86..aebe0f5fa3 100644 --- a/dlc-wallet/src/main/scala/org/bitcoins/dlc/wallet/models/DLCOfferDb.scala +++ b/dlc-wallet/src/main/scala/org/bitcoins/dlc/wallet/models/DLCOfferDb.scala @@ -6,6 +6,7 @@ import org.bitcoins.core.number.UInt64 import org.bitcoins.core.protocol.BitcoinAddress import org.bitcoins.core.protocol.dlc.models.DLCMessage._ import org.bitcoins.core.protocol.dlc.models._ +import org.bitcoins.core.protocol.tlv.DLCOfferTLV import org.bitcoins.core.wallet.fee.SatoshisPerVirtualByte import org.bitcoins.crypto._ @@ -39,6 +40,7 @@ case class DLCOfferDb( feeRate: SatoshisPerVirtualByte, dlcTimeouts: DLCTimeouts): DLCOffer = { DLCOffer( + protocolVersionOpt = DLCOfferTLV.currentVersionOpt, contractInfo = contractInfo, pubKeys = dlcPubKeys, totalCollateral = collateral.satoshis, diff --git a/docs/core/dlc.md b/docs/core/dlc.md index 217a6582b2..ce4aed2517 100644 --- a/docs/core/dlc.md +++ b/docs/core/dlc.md @@ -174,6 +174,7 @@ Currently, only the most basic Lightning messages are defined (`Ping`, `Pong`, ` ```scala mdoc:to-string val offerTLV = DLCOfferTLV( + protocolVersionOpt = None, contractFlags = 0.toByte, chainHash = DoubleSha256Digest.empty, contractInfo = contractInfo.toTLV, diff --git a/testkit-core/src/main/scala/org/bitcoins/testkitcore/dlc/TestDLCClient.scala b/testkit-core/src/main/scala/org/bitcoins/testkitcore/dlc/TestDLCClient.scala index 4597bfef69..ec0f0824f2 100644 --- a/testkit-core/src/main/scala/org/bitcoins/testkitcore/dlc/TestDLCClient.scala +++ b/testkit-core/src/main/scala/org/bitcoins/testkitcore/dlc/TestDLCClient.scala @@ -15,6 +15,7 @@ import org.bitcoins.core.protocol.dlc.models.DLCMessage.DLCAccept import org.bitcoins.core.protocol.dlc.models._ import org.bitcoins.core.protocol.dlc.sign.DLCTxSigner import org.bitcoins.core.protocol.script.ScriptPubKey +import org.bitcoins.core.protocol.tlv.DLCOfferTLV import org.bitcoins.core.protocol.transaction.Transaction import org.bitcoins.core.wallet.fee.SatoshisPerVirtualByte import org.bitcoins.core.wallet.utxo.{InputInfo, ScriptSignatureParams} @@ -208,6 +209,7 @@ object TestDLCClient { } val offer = DLCMessage.DLCOffer( + protocolVersionOpt = DLCOfferTLV.currentVersionOpt, contractInfo = offerOutcomes, pubKeys = offerPubKeys, totalCollateral = offerInput.satoshis, diff --git a/testkit-core/src/main/scala/org/bitcoins/testkitcore/gen/TLVGen.scala b/testkit-core/src/main/scala/org/bitcoins/testkitcore/gen/TLVGen.scala index 725c0eaba6..ee47ea72d0 100644 --- a/testkit-core/src/main/scala/org/bitcoins/testkitcore/gen/TLVGen.scala +++ b/testkit-core/src/main/scala/org/bitcoins/testkitcore/gen/TLVGen.scala @@ -403,6 +403,7 @@ trait TLVGen { } DLCOfferTLV( + protocolVersionOpt = None, //TODO: Comeback and change this contractFlags = 0.toByte, chainHash = chainHash, contractInfo = contractInfo, diff --git a/testkit/src/main/scala/org/bitcoins/testkit/wallet/DLCWalletUtil.scala b/testkit/src/main/scala/org/bitcoins/testkit/wallet/DLCWalletUtil.scala index 1ec1529d25..e491728d80 100644 --- a/testkit/src/main/scala/org/bitcoins/testkit/wallet/DLCWalletUtil.scala +++ b/testkit/src/main/scala/org/bitcoins/testkit/wallet/DLCWalletUtil.scala @@ -147,6 +147,7 @@ object DLCWalletUtil extends Logging { DLCMessage.genSerialId(Vector(sampleOfferChangeSerialId)) lazy val sampleDLCOffer: DLCOffer = DLCOffer( + protocolVersionOpt = DLCOfferTLV.currentVersionOpt, contractInfo = sampleContractInfo, pubKeys = dummyDLCKeys, totalCollateral = half,