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

[BUG]: cln 23.08 multifundchannel + amount:"all" #6664

Closed
daywalker90 opened this issue Sep 11, 2023 · 3 comments
Closed

[BUG]: cln 23.08 multifundchannel + amount:"all" #6664

daywalker90 opened this issue Sep 11, 2023 · 3 comments
Assignees
Labels

Comments

@daywalker90
Copy link
Contributor

I tried a multifundchannel with several nodes and on one of them i specified amount:"all"
it returned with an error:

"code": -1,
   "message": "Error broadcasting transaction: error code: -26\\nerror message:\\nbad-txns-in-belowout, value in (1.67656622) < value out (3.26428735). Unsent tx discarded <*snip* tx>

after decoding the tx i noticed that the output with the "all" amount was using the amount 1.67616105 instead of the "rest" which was supposed to be around 0.08

@vincenzopalazzo vincenzopalazzo added the rust Issue related to rust label Sep 11, 2023
@vincenzopalazzo vincenzopalazzo added in diagnostic issue under diagnostic and removed rust Issue related to rust labels Sep 11, 2023
@daywalker90
Copy link
Contributor Author

i used fundchannel_cancel to get rid of the invalid channels, but it seems some peers still have them and i get Number of pending channels exceed maximum when i try to open another channel with them

@daywalker90
Copy link
Contributor Author

I can easily reproduce this on regtest:
I set up 5 nodes with large-channels enabled.

l1-cli multifundchannel -k destinations='[{"id":"02edfeae45a724770dc3c2b7ce346306095434ad29b8ddbe00abadfea42f8529de@127.0.0.1:7272","amount":20000000},{"id":"0258e4c74aa88896e4582f6a0f7a651a0e09bfa0fa89825903aba53a24112bb803@127.0.0.1:7373","amount":20000000},{"id":"0283ed1addf846f0d0076bfc85cf2b43d71608d2c5379739f60bc815b96fc6926d@127.0.0.1:7474","amount":20000000},{"id":"0368c81f9c49f7f30b6980676c03e66e30268ccc8c6e932cb7813c189ea0e1f686@127.0.0.1:7575","amount":"all"}]'
{
   "code": -1,
   "message": "Error broadcasting transaction: error code: -26\\nerror message:\\nbad-txns-in-belowout, value in (0.98999834) < value out (1.58999581). Unsent tx discarded 020000000001018fb848c7ed70d3d42eb9ac33a33839fadfb48fb7b07fd5ce4125fac8e84264bc0100000000fdffffff041d9de605000000002200201432f7278373811bfee352bf70973fb6faae95803d4369db92acd6fad6c95b67002d3101000000002200201ec945f6d6e05a476a32c1255e21ca9d1485c5bf4758a05f4f781af3e6b7f8c2002d3101000000002200206a4bd4a6c5aba8ef4a4b689e553255f283c562eca1fa3cedb202a404d61ec369002d310100000000220020f586dab37a70052bcc95456fe7ea485ecd4c7bb1425cf00475c2378d5f6b4a890140ebcfdf4d7a130f9e9ad2f1c14b63a3b8f80976f9196e3401c0ae0a6d429349aec47f3463ed91a6f09ae861dc690ff6dc0913db363f2b86f6f2f3451216c6dc1126090000"
}
bitcoin-cli -regtest decoderawtransaction 020000000001018fb848c7ed70d3d42eb9ac33a33839fadfb48fb7b07fd5ce4125fac8e84264bc0100000000fdffffff041d9de605000000002200201432f7278373811bfee352bf70973fb6faae95803d4369db92acd6fad6c95b67002d3101000000002200201ec945f6d6e05a476a32c1255e21ca9d1485c5bf4758a05f4f781af3e6b7f8c2002d3101000000002200206a4bd4a6c5aba8ef4a4b689e553255f283c562eca1fa3cedb202a404d61ec369002d310100000000220020f586dab37a70052bcc95456fe7ea485ecd4c7bb1425cf00475c2378d5f6b4a890140ebcfdf4d7a130f9e9ad2f1c14b63a3b8f80976f9196e3401c0ae0a6d429349aec47f3463ed91a6f09ae861dc690ff6dc0913db363f2b86f6f2f3451216c6dc1126090000
{
  "txid": "12b6ac78dd235e7d39d2a4db2c3121c9fa801fbf197f12d0a7cab0623d647aed",
  "hash": "0edd77d04b1a74a1a8d6457efa0a67e9858e63f4c613cbe27cfe6a597ff45d16",
  "version": 2,
  "size": 291,
  "vsize": 240,
  "weight": 960,
  "locktime": 2342,
  "vin": [
    {
      "txid": "bc6442e8c8fa2541ced57fb0b78fb4dffa3938a333acb92ed4d370edc748b88f",
      "vout": 1,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "txinwitness": [
        "ebcfdf4d7a130f9e9ad2f1c14b63a3b8f80976f9196e3401c0ae0a6d429349aec47f3463ed91a6f09ae861dc690ff6dc0913db363f2b86f6f2f3451216c6dc11"
      ],
      "sequence": 4294967293
    }
  ],
  "vout": [
    {
      "value": 0.98999581,
      "n": 0,
      "scriptPubKey": {
        "asm": "0 1432f7278373811bfee352bf70973fb6faae95803d4369db92acd6fad6c95b67",
        "desc": "addr(bcrt1qzse0wfurwwq3hlhr22lhp9elkma2a9vq84pknkuj4nt044kftdnsrk7apv)#3fdyz42c",
        "hex": "00201432f7278373811bfee352bf70973fb6faae95803d4369db92acd6fad6c95b67",
        "address": "bcrt1qzse0wfurwwq3hlhr22lhp9elkma2a9vq84pknkuj4nt044kftdnsrk7apv",
        "type": "witness_v0_scripthash"
      }
    },
    {
      "value": 0.20000000,
      "n": 1,
      "scriptPubKey": {
        "asm": "0 1ec945f6d6e05a476a32c1255e21ca9d1485c5bf4758a05f4f781af3e6b7f8c2",
        "desc": "addr(bcrt1qrmy5takkupdyw63jcyj4ugw2n52gt3dlgav2qh600qd08e4hlrpq4j3wn5)#l56ss0q3",
        "hex": "00201ec945f6d6e05a476a32c1255e21ca9d1485c5bf4758a05f4f781af3e6b7f8c2",
        "address": "bcrt1qrmy5takkupdyw63jcyj4ugw2n52gt3dlgav2qh600qd08e4hlrpq4j3wn5",
        "type": "witness_v0_scripthash"
      }
    },
    {
      "value": 0.20000000,
      "n": 2,
      "scriptPubKey": {
        "asm": "0 6a4bd4a6c5aba8ef4a4b689e553255f283c562eca1fa3cedb202a404d61ec369",
        "desc": "addr(bcrt1qdf9affk94w5w7jjtdz092vj472pu2chv58aremdjq2jqf4s7cd5stfkuyt)#mlks4vrk",
        "hex": "00206a4bd4a6c5aba8ef4a4b689e553255f283c562eca1fa3cedb202a404d61ec369",
        "address": "bcrt1qdf9affk94w5w7jjtdz092vj472pu2chv58aremdjq2jqf4s7cd5stfkuyt",
        "type": "witness_v0_scripthash"
      }
    },
    {
      "value": 0.20000000,
      "n": 3,
      "scriptPubKey": {
        "asm": "0 f586dab37a70052bcc95456fe7ea485ecd4c7bb1425cf00475c2378d5f6b4a89",
        "desc": "addr(bcrt1q7krd4vm6wqzjhny4g4h706jgtmx5c7a3gfw0qpr4cgmc6hmtf2yskpantz)#wfuwfpw0",
        "hex": "0020f586dab37a70052bcc95456fe7ea485ecd4c7bb1425cf00475c2378d5f6b4a89",
        "address": "bcrt1q7krd4vm6wqzjhny4g4h706jgtmx5c7a3gfw0qpr4cgmc6hmtf2yskpantz",
        "type": "witness_v0_scripthash"
      }
    }
  ]
}
l1-cli listfunds
{
   "outputs": [
      {
         "txid": "bc6442e8c8fa2541ced57fb0b78fb4dffa3938a333acb92ed4d370edc748b88f",
         "output": 1,
         "amount_msat": 98999834000,
         "scriptpubkey": "5120638da96a89d7e3cb9ec5d5568f6e89aa9dfed34b502463dc376481938aba3516",
         "address": "bcrt1pvwx6j65f6l3uh8k964tg7m5f42wla56t2qjx8hphvjqe8z46x5tq9lxycz",
         "status": "confirmed",
         "blockheight": 2379,
         "reserved": false
      }
   ],
   "channels": [
      {
         "peer_id": "0258e4c74aa88896e4582f6a0f7a651a0e09bfa0fa89825903aba53a24112bb803",
         "connected": true,
         "state": "CHANNELD_AWAITING_LOCKIN",
         "channel_id": "ed7a643d62b0caa7d0127f19bf1f80fac921312cdba4d2397d5e23dd78acb611",
         "our_amount_msat": 20000000000,
         "amount_msat": 20000000000,
         "funding_txid": "12b6ac78dd235e7d39d2a4db2c3121c9fa801fbf197f12d0a7cab0623d647aed",
         "funding_output": 3
      },
      {
         "peer_id": "02edfeae45a724770dc3c2b7ce346306095434ad29b8ddbe00abadfea42f8529de",
         "connected": true,
         "state": "CHANNELD_AWAITING_LOCKIN",
         "channel_id": "ed7a643d62b0caa7d0127f19bf1f80fac921312cdba4d2397d5e23dd78acb610",
         "our_amount_msat": 20000000000,
         "amount_msat": 20000000000,
         "funding_txid": "12b6ac78dd235e7d39d2a4db2c3121c9fa801fbf197f12d0a7cab0623d647aed",
         "funding_output": 2
      },
      {
         "peer_id": "0283ed1addf846f0d0076bfc85cf2b43d71608d2c5379739f60bc815b96fc6926d",
         "connected": true,
         "state": "CHANNELD_AWAITING_LOCKIN",
         "channel_id": "ed7a643d62b0caa7d0127f19bf1f80fac921312cdba4d2397d5e23dd78acb613",
         "our_amount_msat": 20000000000,
         "amount_msat": 20000000000,
         "funding_txid": "12b6ac78dd235e7d39d2a4db2c3121c9fa801fbf197f12d0a7cab0623d647aed",
         "funding_output": 1
      },
      {
         "peer_id": "0368c81f9c49f7f30b6980676c03e66e30268ccc8c6e932cb7813c189ea0e1f686",
         "connected": true,
         "state": "CHANNELD_AWAITING_LOCKIN",
         "channel_id": "ed7a643d62b0caa7d0127f19bf1f80fac921312cdba4d2397d5e23dd78acb612",
         "our_amount_msat": 98999581000,
         "amount_msat": 98999581000,
         "funding_txid": "12b6ac78dd235e7d39d2a4db2c3121c9fa801fbf197f12d0a7cab0623d647aed",
         "funding_output": 0
      }
   ]
}

@darosior
Copy link
Collaborator

Would be nice if we could set an amount for some peers, and "all" for others. The remainder of the funds would be split between all the "all" peers.

@nepet nepet removed this from the v23.11 milestone Dec 3, 2023
@vincenzopalazzo vincenzopalazzo added bug and removed in diagnostic issue under diagnostic labels Feb 5, 2024
@vincenzopalazzo vincenzopalazzo self-assigned this Feb 5, 2024
rustyrussell added a commit to daywalker90/lightning that referenced this issue Mar 20, 2024
We tried to put *everything* into the "all" output, which didn't work
if there were other outputs!

Fixes: ElementsProject#6664
Signed-off-by: Rusty Russell <[email protected]>
Changelog-Fixed: JSON-RPC: `multifundchannel` with `all` as an amount works as expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants