Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open/close channel txid show instead of success #1867

Merged
merged 1 commit into from
Sep 11, 2020

Conversation

rsercano
Copy link
Collaborator

@rsercano rsercano commented Sep 4, 2020

attempts to resolve #1860

image
image

@rsercano rsercano self-assigned this Sep 4, 2020
@rsercano rsercano added lightning Lightning network & lnd integration command line (CLI) Relating to the command line interface tools labels Sep 4, 2020
@raladev
Copy link
Contributor

raladev commented Sep 4, 2020

  • it would be good to have one naming for all commands (transactionId/transactionIdsList)

  • @erkarl can we return txid for closechannel eth?

  • txid from openchannel definitely does not look like valid txid, something wrong with convertion

openchannel
- LTC

{
  "transactionId": "ZcGmT7YkNLs/DkwjI9nl3KOtGNNnEjdi4WWzX55Lebg="
}

- BTC

{
  "transactionId": "4opi3rWGsgQXQBDvdKSymI0NCIdUasC099B6CMViRk0="
}


- ETH

{
  "transactionId": "0x985e0889d3abc577b312198d611894cd7986c8a5e1aa3abbbfcc0bd86b801408"
}

- USDT

simnet > openchannel USDT 5

{
  "transactionId": "0x62854e0db94ab99d9b2fb9710bc93156f479f7b70c25a618abf4966371ae9e7c"
}


withdraw
- LTC

{
  "transactionId": "821f3baa82572e6e1cd891f4c3f4430c64d111ca0d0f37345bc106af9d657b06"
}


- BTC

{
  "transactionId": "8c88bdf19b6e7cf9cb1b83e04f27eb5f8f8e8de20a9e99a49e79adfcfd1cec24"
}

- ETH

{
  "transactionId": "0x7cd0ebef1d5b2b93d1e75c62d4cb6fe5ec7be66d777174b8f8a0cd0fb386a986"
}


- USDT

{
  "transactionId": "0x11886ceef823e4a591f5c9214d19beb3ce3660c504286359608f40585743651e"
}



closechannel
- LTC 

{
  "transactionIdsList": [
    "0be2952abb5594fe65507f17015b91a66e702f3711e456cd94746dcde84a2b8d"
  ]
}


- BTC

{
  "transactionIdsList": [
    "912c16d107a51f2923fbc1ba21c282bb9a69e7df9dbde284aa4cb74dd7551003"
  ]
}


- ETH 

simnet > closechannel ETH

{
  "transactionIdsList": []
}


- USDT

{
  "transactionIdsList": []
}

Copy link
Contributor

@raladev raladev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above

@rsercano
Copy link
Collaborator Author

rsercano commented Sep 5, 2020

it would be good to have one naming for all commands (transactionId/transactionIdsList)

Sure but, closechannel returns a list of transactions since it closes multiple channels.

txid from openchannel definitely does not look like valid txid, something wrong with convertion

Correct but I'm lost here, a little help would be awesome as I mentioned in the third element in my PR description. @raladev @sangaman

@kilrau
Copy link
Contributor

kilrau commented Sep 7, 2020

it would be good to have one naming for all commands (transactionId/transactionIdsList)

Imo fine as is.

@ghost
Copy link

ghost commented Sep 7, 2020

@erkarl can we return txid for closechannel eth?

Yes, we can and should.

@rsercano
Copy link
Collaborator Author

rsercano commented Sep 7, 2020

Let me know when I can implement it please @erkarl, also @sangaman could you please help me with showing txid for lnd grpc openchannel call, I'm really confused there.

proto/xudrpc.proto Outdated Show resolved Hide resolved
lib/swaps/SwapClientManager.ts Outdated Show resolved Hide resolved
lib/service/Service.ts Show resolved Hide resolved
test/jest/LndClient.spec.ts Outdated Show resolved Hide resolved
proto/xudrpc.proto Outdated Show resolved Hide resolved
lib/lndclient/LndClient.ts Outdated Show resolved Hide resolved
lib/lndclient/LndClient.ts Outdated Show resolved Hide resolved
@sangaman sangaman added the grpc gRPC API label Sep 7, 2020
@rsercano
Copy link
Collaborator Author

rsercano commented Sep 8, 2020

Thank you @sangaman for your great help, but still I can't get the correct tx id I suppose, apart from that other reviews are closed, @raladev and @kilrau could you please check from your perspective?

@kilrau
Copy link
Contributor

kilrau commented Sep 8, 2020

  • return txid for closechannel eth
  • txid from openchannel definitely does not look like valid txid, something wrong with convertion

If these two are done, good from my side

@rsercano
Copy link
Collaborator Author

rsercano commented Sep 9, 2020

Still having issue with:

  • txid from openchannel definitely does not look like valid txid, something wrong with convertion

:(

@raladev
Copy link
Contributor

raladev commented Sep 9, 2020

Still having issue with:

  • txid from openchannel definitely does not look like valid txid, something wrong with convertion

:(

#1867 (comment)

@rsercano u need to convert this base64 string to hex format
https://api.lightning.community/?python#openchannelsync

funding_txid_str | string | Hex-encoded string representing the byte-reversed hash of the funding transaction.

base64 -> bytes -> hex in python:

    a = 'ZcGmT7YkNLs/DkwjI9nl3KOtGNNnEjdi4WWzX55Lebg='
    b = base64.b64decode(a)# b = unreadable bytes
    result = b.hex()  # result = 65c1a64fb62434bb3f0e4c2323d9e5dca3ad18d367123762e165b35f9e4b79b8

@rsercano
Copy link
Collaborator Author

rsercano commented Sep 10, 2020

Thank you both @raladev and @sangaman, fixed.

raladev
raladev previously approved these changes Sep 10, 2020
@raladev raladev self-requested a review September 10, 2020 13:59
@raladev
Copy link
Contributor

raladev commented Sep 10, 2020

it seems that connext client is returning txid for withdraw(closechannel) call @rsercano
https://github.com/connext/rest-api-client/blob/master/src/client.ts#L316

@kilrau
Copy link
Contributor

kilrau commented Sep 10, 2020

it seems that connext client is returning txid for withdraw(closechannel) call @rsercano
https://github.com/connext/rest-api-client/blob/master/src/client.ts#L316

Oh yes, that should work in this PR if not the case yet.

@@ -780,7 +780,8 @@ class LndClient extends SwapClient {
await this.connectPeerAddresses(uris);
}

await this.openChannelSync(remoteIdentifier, units, pushUnits);
const openResponse = await this.openChannelSync(remoteIdentifier, units, pushUnits);
return openResponse.hasFundingTxidStr() ? openResponse.getFundingTxidStr() : base64ToHex(openResponse.getFundingTxidBytes_asB64());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this ternary statement here? I think just return base64ToHex(openResponse.getFundingTxidBytes_asB64()) is enough to keep things simple. Might be worth tidying up but I don't think it's necessarily worth holding up the PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the documentation this's the field that actually should have transaction id, so I thought it would worth to check it with this statement.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which documentation?

@rsercano
Copy link
Collaborator Author

it seems that connext client is returning txid for withdraw(closechannel) call @rsercano
https://github.com/connext/rest-api-client/blob/master/src/client.ts#L316

Oh yes, that should work in this PR if not the case yet.

Yeap checking now @raladev @kilrau

@rsercano
Copy link
Collaborator Author

Implemented close channel txhash too for connext @kilrau @raladev

image

But would you please squash and merge my commits for this one @sangaman I literally suck at it, and your help would be really appreciated..

raladev
raladev previously approved these changes Sep 11, 2020
@sangaman
Copy link
Collaborator

But would you please squash and merge my commits for this one @sangaman

Done.

Btw in spots like this the trick I've learned is to do git merge origin/master and then git reset --soft origin/master so that you're left with the same commit history as master and just the uncommitted changes from the PR/branch. Then you can add that as a single commit.

Are you able to run one more quick check @raladev ? I can give it a quick manual test too later today.

@sangaman sangaman merged commit 2dcaf01 into master Sep 11, 2020
@sangaman sangaman deleted the openclosechannel-txid-show branch September 11, 2020 17:51
@rsercano
Copy link
Collaborator Author

rsercano commented Sep 11, 2020

Thank you @sangaman ☺️ Nice trick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command line (CLI) Relating to the command line interface tools grpc gRPC API lightning Lightning network & lnd integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show txid instead of success
4 participants