Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
boufni95 committed Apr 24, 2024
1 parent 1eb4d31 commit b5e299b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/services/lnd/lnd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,11 @@ export default class {
})
}

async NewAddress(addressType: Types.AddressType): Promise<NewAddressResponse> {
async NewAddress(addressType: Types.AddressType, skipHealthCheck = false): Promise<NewAddressResponse> {
this.log("generating new address")
await this.Health()
if (!skipHealthCheck) {
await this.Health()
}
let lndAddressType: AddressType
switch (addressType) {
case Types.AddressType.NESTED_PUBKEY_HASH:
Expand Down Expand Up @@ -356,7 +358,6 @@ export default class {
}

async OpenChannel(destination: string, closeAddress: string, fundingAmount: number, pushSats: number) {
await this.Health()
const abortController = new AbortController()
const req = OpenChannelReq(destination, closeAddress, fundingAmount, pushSats)
const stream = this.lightning.openChannel(req, { abort: abortController.signal })
Expand Down
8 changes: 6 additions & 2 deletions src/tests/networkSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const setupNetwork = async () => {
const core = new Core(settings)
await core.Init()
const { alice, bob, carol, dave } = await initLndInstances(settings)
/*const aliceAddr = await alice.NewAddress(AddressType.WITNESS_PUBKEY_HASH)
/*const aliceAddr = await alice.NewAddress(AddressType.WITNESS_PUBKEY_HASH, true)
const bobAddr = await bob.NewAddress(AddressType.WITNESS_PUBKEY_HASH)
const carolAddr = await carol.NewAddress(AddressType.WITNESS_PUBKEY_HASH)
const daveAddr = await dave.NewAddress(AddressType.WITNESS_PUBKEY_HASH)
Expand All @@ -19,7 +19,11 @@ export const setupNetwork = async () => {
await core.SendToAddress(daveAddr.address, 10)
await core.Mine(6)*/
const alicePub = await alice.GetInfo()
console.log({ alicePub })
const [pubkey, host] = alicePub.uris[0].split('@')
await alice.ConnectPeer(pubkey, host)
console.log(await alice.GetInfo())
const aliceAddr = await alice.NewAddress(AddressType.WITNESS_PUBKEY_HASH, true)
console.log({ aliceAddr })
}

const initLndInstances = async (settings: TestSettings) => {
Expand Down

0 comments on commit b5e299b

Please sign in to comment.