Skip to content

Commit

Permalink
Revert "Enable bitcoind client and funding tests TODO"
Browse files Browse the repository at this point in the history
This reverts commit 0d34550.
  • Loading branch information
jotapea committed Jul 15, 2021
1 parent 0d34550 commit a5d0433
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
11 changes: 4 additions & 7 deletions src/OnChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ abstract class PayOnChainClient {

static clientPayInstance(): PayOnChainClient {
// * ALSO change updatePending *
// return new LndOnChainClient()
return new BitcoindClient()
return new LndOnChainClient()
// return new BitcoindClient()
}

abstract getBalance(): Promise<number>
Expand Down Expand Up @@ -194,11 +194,8 @@ export const OnChainMixin = (superclass) =>
}

async updatePending(lock): Promise<void> {
// await Promise.all([this.updateOnchainReceipt(lock), super.updatePending(lock)])
await Promise.all([
this.updateOnchainReceiptBitcoind(lock),
super.updatePending(lock),
])
await Promise.all([this.updateOnchainReceipt(lock), super.updatePending(lock)])
// await Promise.all([this.updateOnchainReceiptBitcoind(lock), super.updatePending(lock)])
}

async getOnchainFee({
Expand Down
21 changes: 10 additions & 11 deletions test/integration/02b-onchain-receive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,33 +183,32 @@ it("createsBitcoindHotWallet", async () => {
})

it("user0IsCreditedForOnChainTransaction", async () => {
await bitcoind_onchain_funding({ walletDestination: walletUser0 })
// await lnd_onchain_funding({ walletDestination: walletUser0 })
// await bitcoind_onchain_funding({ walletDestination: walletUser0 })
await lnd_onchain_funding({ walletDestination: walletUser0 })
})

it("user11IsCreditedForOnChainSendAllTransaction", async () => {
/// TODO? add sendAll tests in which the user has more than the limit?
const level1WithdrawalLimit = yamlConfig.limits.withdrawal.level["1"] // sats
amount_BTC = sat2btc(level1WithdrawalLimit)
walletUser11 = await getUserWallet(11)
await bitcoind_onchain_funding({ walletDestination: walletUser11 })
// await lnd_onchain_funding({ walletDestination: walletUser11 })
// await bitcoind_onchain_funding({ walletDestination: walletUser11 })
await lnd_onchain_funding({ walletDestination: walletUser11 })
})

it("user12IsCreditedForOnChainOnUsSendAllTransaction", async () => {
const level1OnUsLimit = yamlConfig.limits.onUs.level["1"] // sats
amount_BTC = sat2btc(level1OnUsLimit)
walletUser12 = await getUserWallet(12)
await bitcoind_onchain_funding({ walletDestination: walletUser12 })
// await lnd_onchain_funding({ walletDestination: walletUser12 })
// await bitcoind_onchain_funding({ walletDestination: walletUser12 })
await lnd_onchain_funding({ walletDestination: walletUser12 })
})

it("fundingFunderWithOnchainTxFromBitcoind", async () => {
await bitcoind_onchain_funding({ walletDestination: funderWallet })
// await lnd_onchain_funding({ walletDestination: funderWallet })
// await bitcoind_onchain_funding({ walletDestination: funderWallet })
await lnd_onchain_funding({ walletDestination: funderWallet })
})

// Now tests start to fail here (same reason: checkIsBalanced)
it("creditingLnd1WithSomeFundToCreateAChannel", async () => {
const { address } = await createChainAddress({
lnd: lnd1,
Expand Down Expand Up @@ -336,8 +335,8 @@ it("allows fee exemption for specific users", async () => {
walletUser2.user.depositFeeRatio = 0
await walletUser2.user.save()
const { BTC: initBalanceUser2 } = await walletUser2.getBalances()
await bitcoind_onchain_funding({ walletDestination: walletUser2 })
// await lnd_onchain_funding({ walletDestination: walletUser2 })
// await bitcoind_onchain_funding({ walletDestination: walletUser2 })
await lnd_onchain_funding({ walletDestination: walletUser2 })
const { BTC: finalBalanceUser2 } = await walletUser2.getBalances()
expect(finalBalanceUser2).toBe(initBalanceUser2 + btc2sat(amount_BTC))
})

0 comments on commit a5d0433

Please sign in to comment.