nervosnetwork / fiber

21 stars 11 forks source link

[shut_down] return ChannelReady after force shutdown #333

Open gpBlockchain opened 1 day ago

gpBlockchain commented 1 day ago
curl --location 'http://127.0.0.1:8228' --header 'Content-Type: application/json' --data '{
    "id": 42,
    "jsonrpc": "2.0",
    "method": "shutdown_channel",
    "params": [
        {
            "channel_id": "0xc90e31771e375db770c309b5484de94c22da943119b5e20838818673d8fcb257",
            "close_script": {
                "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
                "hash_type": "type",
                "args": "0xc8328aabcd9b9e8e64fbc566c4385c3bdeb219d7"
            },
            "fee_rate": "0x3FC",
            "force": true
        }
    ]
}'
response:
{"jsonrpc": "2.0", "result": null, "id": 42}

After 1 minute, both nodes query results are in the "channel ready" state.

curl --location 'http://127.0.0.1:8228' --header 'Content-Type: application/json' --data '{
    "id": 42,
    "jsonrpc": "2.0",
    "method": "list_channels",
    "params": [
        {
            "peer_id": "QmPuMWhXdaTmRx5srDXJfXR4RkyHiCAXJnXCVjZEBvLyxU"
        }
    ]
}'
{"jsonrpc":"2.0","result":{"channels":[{"channel_id":"0xc90e31771e375db770c309b5484de94c22da943119b5e20838818673d8fcb257","is_public":false,"channel_outpoint":"0x3400a0d409c4eda2708d3349f4c9834ada8ae3d2472bace3a38f87cb9f378f0c00000000","peer_id":"QmPuMWhXdaTmRx5srDXJfXR4RkyHiCAXJnXCVjZEBvLyxU","funding_udt_type_script":null,"state":{"state_name":"CHANNEL_READY","state_flags":[]},"local_balance":"0x3368b4a00","offered_tlc_balance":"0x0","remote_balance":"0x0","received_tlc_balance":"0x0","created_at":"0x1934eea4887"}]},"id":42}

log

  2024-11-21T13:30:18.614963Z ERROR fnn::fiber::channel: Error while processing channel event: InvalidState("Expecting commitment transaction confirmed event in state ShuttingDown, but got state ChannelReady")

node.log

gpBlockchain commented 9 hours ago

node can send_payment after force shutdown

curl --location 'http://127.0.0.1:8228' --header 'Content-Type: application/json' --data '{
    "id": 42,
    "jsonrpc": "2.0",
    "method": "send_payment",
    "params": [
        {
            "invoice": "fibd11peseucdphcxgfw0pnm6vkatv3t84mwezn7dkj0q6j6kua7stjluavutthwkakfxr4na5pfw30hwy5vpplmlq68phz046fjruqtyqt5387ayngucmaklqnf46jrs8878xuyz43ry3jfx5302ncx4754twknlp2ha35w8vnrafln4gvnzzrwz7zazsxc9cs6ffwwhtemmmfl4r9u9jrwljkh38fshyfrhme37pxjy7q7epku6kehkm8j7jnv5gkt8rw86uq77e3rpfdqw3hgwzztqd2u0e9t50wm9c8kjkagkxeju6z8x2f69pqp6ar3ln4eu5cc4unh73a4d8myq68z73jef926a654pqz5sm5xgcq9ulktp"
        }
    ]
}'
response:
{"jsonrpc": "2.0", "result": {"payment_hash": "0x56250670b1dadd36fa16bd319bce973c69da866ffe92925e961d94c7cd319571", "status": "Inflight", "created_at": "0x193528e39c4", "last_updated_at": "0x193528e39e9", "failed_error": null}, "id": 42}
curl --location 'http://127.0.0.1:8228' --header 'Content-Type: application/json' --data '{
    "id": 42,
    "jsonrpc": "2.0",
    "method": "get_payment",
    "params": [
        {
            "payment_hash": "0x56250670b1dadd36fa16bd319bce973c69da866ffe92925e961d94c7cd319571"
        }
    ]
}'
response:
{"jsonrpc": "2.0", "result": {"payment_hash": "0x56250670b1dadd36fa16bd319bce973c69da866ffe92925e961d94c7cd319571", "status": "Inflight", "created_at": "0x193528e39c4", "last_updated_at": "0x193528e39e9", "failed_error": null}, "id": 42}
curl --location 'http://127.0.0.1:8228' --header 'Content-Type: application/json' --data '{
    "id": 42,
    "jsonrpc": "2.0",
    "method": "get_payment",
    "params": [
        {
            "payment_hash": "0x56250670b1dadd36fa16bd319bce973c69da866ffe92925e961d94c7cd319571"
        }
    ]
}'
response:
{"jsonrpc": "2.0", "result": {"payment_hash": "0x56250670b1dadd36fa16bd319bce973c69da866ffe92925e961d94c7cd319571", "status": "Success", "created_at": "0x193528e39c4", "last_updated_at": "0x193528e3a40", "failed_error": null}, "id": 42}

log


  2024-11-22T06:34:33.516470Z  WARN fnn::watchtower::actor: Found an old version commitment tx: Byte32(0x15f959cc09b95f502ac3d5cea1506f2a56d94d6b81f000014dcef55e03866847), revocation commitment number: 2, commitment number: 0
    at src/watchtower/actor.rs:211
    in ractor::actor::Actor with id: "0.3", name: "watchtower"

  2024-11-22T06:34:33.537047Z ERROR fnn::watchtower::actor: Failed to send revocation tx: TransactionView { data: Transaction(0xc30200000c000000e1010000d50100001c000000200000009300000097000000f3000000c10100000000000003000000bf9cddee9210615b33d4ab6d24a0828390f5ae6bc46a3619817fdc8d1f4c9b8a0700000000bf9cddee9210615b33d4ab6d24a0828390f5ae6bc46a3619817fdc8d1f4c9b8a0500000000fa083f5cf8f30302729583e5252f042de5c37f7fd2af287f0f7ddc996607717400000000010000000002000000000000000000000015f959cc09b95f502ac3d5cea1506f2a56d94d6b81f000014dcef55e038668470000000000000000000000009327d78a2010c32215d29d741668322cfc5d32d59976b1384e887c0e395833a801000000ce0000000c0000006d000000610000001000000018000000610000003944a41906000000490000001000000030000000310000009bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce80114000000c8328aabcd9b9e8e64fbc566c4385c3bdeb219d76100000010000000180000006100000000bb7402576dc11b490000001000000030000000310000009bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce80114000000c8328aabcd9b9e8e64fbc566c4385c3bdeb219d7140000000c000000100000000000000000000000e20000000c000000890000007900000010000000100000001000000010000000ff0000000000000002ab2b3c125c97ed75f90b3001fd8db31f9680065a0dfdb0b9fc1470f692062f2d318d459d092fd6f68598a76ca4dab579b54739aaac0d030dfbdb92dbdfcce105828a2b257869af2ea7117ed7a72e36504bf6a3be342f6ab74bbe85c9c00111a3550000005500000010000000550000005500000041000000238fbb2b1f563fb7f68080539e6d149f4e610035852e81aa0887f8d08c4ff02f70c059aea3b6296e3d638d22cb17b95facbd4dc5ccafa181eeb93eb2d6b2a5bc00), hash: Byte32(0x59a3ac9c64f11c3366096f2b703570bcec62c1e6531b064aaee9d4283dceaec2), witness_hash: Byte32(0xf79a2868f65d4c8b4a3945e2a22dcfffa7535343f3d1f9571796f074bb210165) }, error: Rpc(Error { code: ServerError(-302), message: "TransactionFailedToVerify: Verification failed Script(TransactionScriptError { source: Inputs[1].Lock, cause: ValidationFailure: see error code -31 on page https://nervosnetwork.github.io/ckb-script-error-codes/by-type-hash/9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8.html#-31 })", data: Some(String("Verification(Error { kind: Script, inner: TransactionScriptError { source: Inputs[1].Lock, cause: ValidationFailure: see error code -31 on page https://nervosnetwork.github.io/ckb-script-error-codes/by-type-hash/9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8.html#-31 }\n\nStack backtrace:\n   0: std::backtrace::Backtrace::capture\n   1: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from\n   2: ckb_tx_pool::util::verify_rtx::{{closure}}::{{closure}}\n   3: ckb_tx_pool::util::verify_rtx::{{closure}}\n   4: ckb_tx_pool::process::<impl ckb_tx_pool::service::TxPoolService>::_process_tx::{{closure}}\n   5: ckb_tx_pool::process::<impl ckb_tx_pool::service::TxPoolService>::process_tx::{{closure}}\n   6: ckb_tx_pool::service::process::{{closure}}\n   7: ckb_async_runtime::Handle::spawn::{{closure}}\n   8: tokio::runtime::task::raw::poll\n   9: tokio::runtime::scheduler::multi_thread::worker::Context::run_task\n  10: tokio::runtime::scheduler::multi_thread::worker::run\n  11: tokio::runtime::task::raw::poll\n  12: std::sys_common::backtrace::__rust_begin_short_backtrace\n  13: core::ops::function::FnOnce::call_once{{vtable.shim}}\n  14: std::sys::unix::thread::Thread::new::thread_start\n  15: __pthread_joiner_wake })")) })
    at src/watchtower/actor.rs:234
    in ractor::actor::Actor with id: "0.3", name: "watchtower"

  2024-11-22T06:35:33.513581Z  WARN fnn::watchtower::actor: Found an old version commitment tx: Byte32(0x15f959cc09b95f502ac3d5cea1506f2a56d94d6b81f000014dcef55e03866847), revocation commitment number: 2, commitment number: 0
    at src/watchtower/actor.rs:211
    in ractor::actor::Actor with id: "0.3", name: "watchtower"

  2024-11-22T06:35:33.533113Z ERROR fnn::watchtower::actor: Failed to send revocation tx: TransactionView { data: Transaction(0xc30200000c000000e1010000d50100001c000000200000009300000097000000f3000000c10100000000000003000000bf9cddee9210615b33d4ab6d24a0828390f5ae6bc46a3619817fdc8d1f4c9b8a0700000000bf9cddee9210615b33d4ab6d24a0828390f5ae6bc46a3619817fdc8d1f4c9b8a0500000000fa083f5cf8f30302729583e5252f042de5c37f7fd2af287f0f7ddc996607717400000000010000000002000000000000000000000015f959cc09b95f502ac3d5cea1506f2a56d94d6b81f000014dcef55e038668470000000000000000000000009327d78a2010c32215d29d741668322cfc5d32d59976b1384e887c0e395833a801000000ce0000000c0000006d000000610000001000000018000000610000003944a41906000000490000001000000030000000310000009bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce80114000000c8328aabcd9b9e8e64fbc566c4385c3bdeb219d76100000010000000180000006100000000bb7402576dc11b490000001000000030000000310000009bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce80114000000c8328aabcd9b9e8e64fbc566c4385c3bdeb219d7140000000c000000100000000000000000000000e20000000c000000890000007900000010000000100000001000000010000000ff0000000000000002ab2b3c125c97ed75f90b3001fd8db31f9680065a0dfdb0b9fc1470f692062f2d318d459d092fd6f68598a76ca4dab579b54739aaac0d030dfbdb92dbdfcce105828a2b257869af2ea7117ed7a72e36504bf6a3be342f6ab74bbe85c9c00111a3550000005500000010000000550000005500000041000000238fbb2b1f563fb7f68080539e6d149f4e610035852e81aa0887f8d08c4ff02f70c059aea3b6296e3d638d22cb17b95facbd4dc5ccafa181eeb93eb2d6b2a5bc00), hash: Byte32(0x59a3ac9c64f11c3366096f2b703570bcec62c1e6531b064aaee9d4283dceaec2), witness_hash: Byte32(0xf79a2868f65d4c8b4a3945e2a22dcfffa7535343f3d1f9571796f074bb210165) }, error: Rpc(Error { code: ServerError(-302), message: "TransactionFailedToVerify: Verification failed Script(TransactionScriptError { source: Inputs[1].Lock, cause: ValidationFailure: see error code -31 on page https://nervosnetwork.github.io/ckb-script-error-codes/by-type-hash/9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8.html#-31 })", data: Some(String("Verification(Error { kind: Script, inner: TransactionScriptError { source: Inputs[1].Lock, cause: ValidationFailure: see error code -31 on page https://nervosnetwork.github.io/ckb-script-error-codes/by-type-hash/9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8.html#-31 }\n\nStack backtrace:\n   0: std::backtrace::Backtrace::capture\n   1: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from\n   2: ckb_tx_pool::util::verify_rtx::{{closure}}::{{closure}}\n   3: ckb_tx_pool::util::verify_rtx::{{closure}}\n   4: ckb_tx_pool::process::<impl ckb_tx_pool::service::TxPoolService>::_process_tx::{{closure}}\n   5: ckb_tx_pool::process::<impl ckb_tx_pool::service::TxPoolService>::process_tx::{{closure}}\n   6: ckb_tx_pool::service::process::{{closure}}\n   7: ckb_async_runtime::Handle::spawn::{{closure}}\n   8: tokio::runtime::task::raw::poll\n   9: tokio::runtime::scheduler::multi_thread::worker::Context::run_task\n  10: tokio::runtime::scheduler::multi_thread::worker::run\n  11: tokio::runtime::task::raw::poll\n  12: std::sys_common::backtrace::__rust_begin_short_backtrace\n  13: core::ops::function::FnOnce::call_once{{vtable.shim}}\n  14: std::sys::unix::thread::Thread::new::thread_start\n  15: __pthread_joiner_wake })")) })
    at src/watchtower/actor.rs:234
    in ractor::actor::Actor with id: "0.3", name: "watchtower"