2022 04 02 fix walletdlcsetup test (#4237)

* WIP

* Fix test case so it passes
This commit is contained in:
Chris Stewart 2022-04-02 11:40:33 -05:00 committed by GitHub
parent b5bfcbc009
commit ddabc91294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -167,6 +167,7 @@ object Bitcoins extends BaseNumbers[Bitcoins] with Bounded[Bitcoins] {
val max = Bitcoins(Consensus.maxMoney.satoshis)
val zero = Bitcoins(Satoshis.zero)
val one = Bitcoins(1)
val two = Bitcoins(2)
def apply(satoshis: Satoshis): Bitcoins = {
val b: BigDecimal = satoshis.toLong * CurrencyUnits.satoshisToBTCScalar

View File

@ -1085,7 +1085,12 @@ class WalletDLCSetupTest extends BitcoinSDualWalletTest {
DLCWalletUtil.sampleDLCOffer.copy(contractInfo =
DLCWalletUtil.sampleContractInfo2,
collateral = DLCWalletUtil.amt2)
val amt2: Satoshis = Bitcoins(3).satoshis
val offerCollateral2 = amt2
lazy val sampleContractInfo2: ContractInfo =
SingleContractInfo(amt2, sampleContractOraclePair)
val offerData2 = DLCWalletUtil.sampleDLCOffer
.copy(contractInfo = sampleContractInfo2, collateral = offerCollateral2)
for {
offer1 <- walletA.createDLCOffer(
@ -1101,10 +1106,10 @@ class WalletDLCSetupTest extends BitcoinSDualWalletTest {
_ <- walletB.acceptDLCOffer(offer1.toTLV, None, None)
//cancel the offer
_ <- walletA.cancelDLC(dlcId = offer1.dlcId)
amt = (DLCWalletUtil.half + Bitcoins.one).satoshis
offer2 <- walletA.createDLCOffer(
offerData2.contractInfo,
amt,
offerCollateral2,
Some(offerData2.feeRate),
offerData2.timeouts.contractMaturity.toUInt32,
offerData2.timeouts.contractTimeout.toUInt32,