nervosnetwork / fiber

21 stars 11 forks source link

[send_payment] If the configurations are different,it may lead to the Failed to build route #284

Open gpBlockchain opened 1 month ago

gpBlockchain commented 1 month ago

Node 1 is configured with a UDT whitelist, while Node 2 is not. Node 1 and Node 2 successfully open a CKB channel, but sending payment fails with the error: Send payment error: Failed to build route."

curl --location 'http://127.0.0.1:8231' --header 'Content-Type: application/json' --data '{
    "id": 42,
    "jsonrpc": "2.0",
    "method": "new_invoice",
    "params": [
        {
            "amount": "0x2540be400",
            "currency": "Fibb",
            "description": "test invoice generated by node2",
            "expiry": "0xe10",
            "final_cltv": "0x28",
            "payment_preimage": "0x037b3a47e1372189238435cd9caf70baf32e4ec77a4682c555d60bf997e62b7f",
            "hash_algorithm": "sha256"
        }
    ]
}'
response:
{"jsonrpc": "2.0", "result": {"invoice_address": "fibb100000000001pms3acfz8kxgfw0pnm6vk4jfz80cszl8cc0gud52t8f662xm3pz838ewfn2sfuhjr3tkzt3dsldgt9ua4m0f34lt3hy6nzsn8mkc0du5yu47zuccl3hsrhsgkzf77mvnahd7832atxu759wy4cs8t0njsv6kt9apene6w88ly4s8lvhuw4jf6r2vujakfqda2w5p0tlhnt23ucx03g6znf3vyaahmux7f7luk9y6xx6szxw7khctfny78s7ue59u493teduf4hvsqz0yv4la9c7ymhzg0f5eqe0cfww73448lwn6eherkf8pvys5cpsd4a30ckd26sedycf0yatuwt635vlevt6wrtu37rp8de6teq37xc6cqguf0fx", "invoice": {"currency": "Fibb", "amount": "0x2540be400", "signature": "020f040c151f1d05181e041b1702080f09141900190f18090e0e1e111515071f0e131a19171903160907010c0410141801100d151d110f18160d0a1a10190d0418090f041d0b1c0e0b1a11140c1f190c0b1a0e030b1c111e0301070d191a0b1900111e06181a1800", "data": {"timestamp": "0x192bc5e9d82", "payment_hash": "0x146a5081bcc410bcd5e3af060d32a53d2b4d301eea9c01316f0a238e0d00fb67", "attrs": [{"Description": "test invoice generated by node2"}, {"ExpiryTime": {"secs": 3600, "nanos": 0}}, {"FinalHtlcMinimumCltvExpiry": 40}, {"HashAlgorithm": "sha256"}, {"PayeePublicKey": "02482e20ae81d7582554783601f14c0eccbf894760abe26d9c08596e3da4a970a3"}]}}}, "id": 42}

curl --location 'http://127.0.0.1:8229' --header 'Content-Type: application/json' --data '{
    "id": 42,
    "jsonrpc": "2.0",
    "method": "send_payment",
    "params": [
        {
            "invoice": "fibb100000000001pms3acfz8kxgfw0pnm6vk4jfz80cszl8cc0gud52t8f662xm3pz838ewfn2sfuhjr3tkzt3dsldgt9ua4m0f34lt3hy6nzsn8mkc0du5yu47zuccl3hsrhsgkzf77mvnahd7832atxu759wy4cs8t0njsv6kt9apene6w88ly4s8lvhuw4jf6r2vujakfqda2w5p0tlhnt23ucx03g6znf3vyaahmux7f7luk9y6xx6szxw7khctfny78s7ue59u493teduf4hvsqz0yv4la9c7ymhzg0f5eqe0cfww73448lwn6eherkf8pvys5cpsd4a30ckd26sedycf0yatuwt635vlevt6wrtu37rp8de6teq37xc6cqguf0fx"
        }
    ]
}'

{"jsonrpc":"2.0","error":{"code":-32000,"message":"Send payment error: Failed to build route: Hash256(0x146a5081bcc410bcd5e3af060d32a53d2b4d301eea9c01316f0a238e0d00fb67)","data":{"target_pubkey":null,"amount":null,"payment_hash":null,"final_cltv_delta":null,"invoice":"fibb100000000001pms3acfz8kxgfw0pnm6vk4jfz80cszl8cc0gud52t8f662xm3pz838ewfn2sfuhjr3tkzt3dsldgt9ua4m0f34lt3hy6nzsn8mkc0du5yu47zuccl3hsrhsgkzf77mvnahd7832atxu759wy4cs8t0njsv6kt9apene6w88ly4s8lvhuw4jf6r2vujakfqda2w5p0tlhnt23ucx03g6znf3vyaahmux7f7luk9y6xx6szxw7khctfny78s7ue59u493teduf4hvsqz0yv4la9c7ymhzg0f5eqe0cfww73448lwn6eherkf8pvys5cpsd4a30ckd26sedycf0yatuwt635vlevt6wrtu37rp8de6teq37xc6cqguf0fx","timeout":null,"max_fee_amount":null,"max_parts":null,"keysend":null,"udt_type_script":null}},"id":42}%                               guopenglin@192 ~ % 
curl --location 'http://127.0.0.1:8229' --header 'Content-Type: application/json' --data '{
    "id": 42,
    "jsonrpc": "2.0",
    "method": "get_payment",
    "params": [
        {
            "payment_hash": "0x146a5081bcc410bcd5e3af060d32a53d2b4d301eea9c01316f0a238e0d00fb67"
        }
    ]
}'

{"jsonrpc":"2.0","result":{"payment_hash":"0x146a5081bcc410bcd5e3af060d32a53d2b4d301eea9c01316f0a238e0d00fb67","status":"Failed","created_at":"0x192bc65294c","last_updated_at":"0x6252feb296196","failed_error":"Failed to build route: Hash256(0x146a5081bcc410bcd5e3af060d32a53d2b4d301eea9c01316f0a238e0d00fb67)"},"id":42}

node1 config:

fiber:
  listening_addr: /ip4/127.0.0.1/tcp/8230
  network: "Dev"
  announce_listening_addr: true

rpc:
  listening_addr: 127.0.0.1:8229

ckb:
  rpc_url: http://127.0.0.1:8114

  udt_whitelist:
    - name: XUDT
      script:
        code_hash: 0x73e5467341b55ffd7bdeb5b6f32aa0e9433baf6808f8c5f2472dbc36b1ab04f7
        hash_type: type
        args: 0x.*
      cell_deps:
        - tx_hash: 0x8924295bde0c8224f3e7324729e70121d91bac34ca763b8fd283905feb75b9fa
          index: 10
          dep_type: code
      auto_accept_amount: 1000000000

services:
  - fiber
  - rpc
  - ckb

node2 config

fiber:
  listening_addr: /ip4/127.0.0.1/tcp/8232
  network: "Dev"
  announce_listening_addr: true

rpc:
  listening_addr: 127.0.0.1:8231

ckb:
  rpc_url: http://127.0.0.1:8114

services:
  - fiber
  - rpc
  - ckb

node1 log: node.log

chenyukang commented 1 month ago

are you paying a UDT invoice?

gpBlockchain commented 1 month ago

are you paying a UDT invoice?

ckb invoice