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

Only the fee invoice amount is added to the ListPeers RPC paid fee #266

Open
YusukeShimizu opened this issue Jan 3, 2024 · 1 comment
Open

Comments

@YusukeShimizu
Copy link
Contributor

Only the fee invoice at the time of swapout is recorded in the paid fee displayed in ListPeers.

Related: https://discord.com/channels/905126649224388629/905127419466350613/1191356265549533284.

Example Situation

Swap in and swap out once each from initiator node.

  • initiator_node_id: 03926095277db2522ed467ab2e7a108cd771a994e39ef3945175fe1a24d4aba5a2
  • responder_node_id:031872bccffbff6203d68bcaac7d2a088bc13e35026b31fdabe32a6d272397fe1a
peerswap1 listswaps
{
  "swaps": [
    {
      "id": "b963683c9ea47dbf23b74e35c131f262d6673d62739946b367eda0c8fbf6bf1c",
      "created_at": "1704244509",
      "asset": "btc",
      "type": "swap-out",
      "role": "sender",
      "state": "State_ClaimedPreimage",
      "initiator_node_id": "03926095277db2522ed467ab2e7a108cd771a994e39ef3945175fe1a24d4aba5a2",
      "peer_node_id": "031872bccffbff6203d68bcaac7d2a088bc13e35026b31fdabe32a6d272397fe1a",
      "amount": "10000000",
      "channel_id": "110:1:1",
      "opening_tx_id": "10912f55649640f8f829ddf029a0ad9462eb2c65ef335c2945c64d5c16887af0",
      "claim_tx_id": "f4965e25d53f509464153f088594db67c23d080949ba38732a165a10b1b06dbf",
      "cancel_message": "",
      "lnd_chan_id": "120946279120897"
    },
    {
      "id": "25ec85b3e22af44c1eeb862ae664949a11bb0ee49919ef0058352cceb75898cf",
      "created_at": "1704244534",
      "asset": "btc",
      "type": "swap-in",
      "role": "sender",
      "state": "State_ClaimedPreimage",
      "initiator_node_id": "03926095277db2522ed467ab2e7a108cd771a994e39ef3945175fe1a24d4aba5a2",
      "peer_node_id": "031872bccffbff6203d68bcaac7d2a088bc13e35026b31fdabe32a6d272397fe1a",
      "amount": "1000000",
      "channel_id": "110:1:1",
      "opening_tx_id": "8a7bbaed84cf0250f5051df15161e34ef14fcf2732ea00982628cddbf46ac1bf",
      "claim_tx_id": "",
      "cancel_message": "",
      "lnd_chan_id": "120946279120897"
    }
  ]
}

Initiator

The paid fee is the amount of the fee invoice.

./bin/pscli peerswap1 listpeers
{
  "peers": [
    {
      "node_id": "031872bccffbff6203d68bcaac7d2a088bc13e35026b31fdabe32a6d272397fe1a",
      "swaps_allowed": true,
      "supported_assets": [
        "btc",
        "lbtc"
      ],
      "channels": [
        {
          "channel_id": "120946279120897",
          "local_balance": "90979030",
          "remote_balance": "9017500",
          "active": true
        }
      ],
      "as_sender": {
        "swaps_out": "1",
        "swaps_in": "1",
        "sats_out": "10000000",
        "sats_in": "1000000"
      },
      "as_receiver": {
        "swaps_out": "0",
        "swaps_in": "0",
        "sats_out": "0",
        "sats_in": "0"
      },
      "paid_fee": "17500"
    }
  ]
}

Responder

The paid fee is 0.

peerswap2 listpeers
{
  "peers": [
    {
      "node_id": "03926095277db2522ed467ab2e7a108cd771a994e39ef3945175fe1a24d4aba5a2",
      "swaps_allowed": true,
      "supported_assets": [
        "btc",
        "lbtc"
      ],
      "channels": [
        {
          "channel_id": "120946279120897",
          "local_balance": "9017500",
          "remote_balance": "90979030",
          "active": true
        }
      ],
      "as_sender": {
        "swaps_out": "0",
        "swaps_in": "0",
        "sats_out": "0",
        "sats_in": "0"
      },
      "as_receiver": {
        "swaps_out": "1",
        "swaps_in": "1",
        "sats_out": "10000000",
        "sats_in": "1000000"
      },
      "paid_fee": "0"
    }
  ]
}

Idea for improvement

It would be good if the cost of onchain(opening tx/claim tx) incurred is additionally accounted for.

@nepet
Copy link
Contributor

nepet commented Jan 3, 2024

This command is pretty ancient and the naming seems to be completely off. It uses roles called "sender" and "receiver" for the "initiator" and the "responder" as they are referred to by the protocol. IIRC the fee named here is only the fee that we needed to pay via the "fee invoice" and it was meant to also include the "premium" at some point to evaluate peers on how pricey they are.

I suggest a rework after we defined what we really want to show here since we don't have a premium.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants