C-Lightning

c-lightning:已連接:無法創建 2 個套接字:地址已在使用中

  • January 10, 2022

我正在嘗試從原始碼建構 c-lightning 並連接到 testnet。

  • bitcoind 已經在測試網中啟動並執行。
  • 除了以下日誌外,執行 Lightningd 似乎執行良好:

已連接:無法創建 2 個套接字:地址已在使用中

完整日誌在文章底部。

現在,當我嘗試執行“cli/lightning-cli”時,出現以下錯誤:

Lightning-cli:連接到“lightning-rpc”:連接被拒絕

關於我做錯了什麼的任何提示?

比特幣.conf

mintxfee=0.00002
testnet=1
prune=0
txconfirmtarget=6
txindex=1

.lightning/testnet/config [空]

~/projects/btc/lightning master ?1 ❯ lightningd/lightningd --network=testnet --log-level=debug
2022-01-09T15:15:13.424Z DEBUG   plugin-manager: started(1128) /Users/saiy2k/projects/btc/lightning/lightningd/../plugins/autoclean    
2022-01-09T15:15:13.427Z DEBUG   plugin-manager: started(1129) /Users/saiy2k/projects/btc/lightning/lightningd/../plugins/bcli    
2022-01-09T15:15:13.428Z DEBUG   plugin-manager: started(1130) /Users/saiy2k/projects/btc/lightning/lightningd/../plugins/fetchinvoice    
2022-01-09T15:15:13.429Z DEBUG   plugin-manager: started(1131) /Users/saiy2k/projects/btc/lightning/lightningd/../plugins/funder
2022-01-09T15:15:13.430Z DEBUG   plugin-manager: started(1132) /Users/saiy2k/projects/btc/lightning/lightningd/../plugins/topology
2022-01-09T15:15:13.431Z DEBUG   plugin-manager: started(1133) /Users/saiy2k/projects/btc/lightning/lightningd/../plugins/keysend
2022-01-09T15:15:13.434Z DEBUG   plugin-manager: started(1134) /Users/saiy2k/projects/btc/lightning/lightningd/../plugins/offers
2022-01-09T15:15:13.436Z DEBUG   plugin-manager: started(1135) /Users/saiy2k/projects/btc/lightning/lightningd/../plugins/pay
2022-01-09T15:15:13.440Z DEBUG   plugin-manager: started(1136) /Users/saiy2k/projects/btc/lightning/lightningd/../plugins/txprepare
2022-01-09T15:15:13.450Z DEBUG   plugin-manager: started(1137) /Users/saiy2k/projects/btc/lightning/lightningd/../plugins/spenderp
2022-01-09T15:15:13.476Z DEBUG   lightningd: testing /Users/saiy2k/projects/btc/lightning/lightningd/lightning_channeld
2022-01-09T15:15:13.489Z DEBUG   lightningd: testing /Users/saiy2k/projects/btc/lightning/lightningd/lightning_closingd
2022-01-09T15:15:13.501Z DEBUG   lightningd: testing /Users/saiy2k/projects/btc/lightning/lightningd/lightning_connectd    
2022-01-09T15:15:13.514Z DEBUG   lightningd: testing /Users/saiy2k/projects/btc/lightning/lightningd/lightning_gossipd    
2022-01-09T15:15:13.527Z DEBUG   lightningd: testing /Users/saiy2k/projects/btc/lightning/lightningd/lightning_hsmd
2022-01-09T15:15:13.539Z DEBUG   lightningd: testing /Users/saiy2k/projects/btc/lightning/lightningd/lightning_onchaind
2022-01-09T15:15:13.555Z DEBUG   lightningd: testing /Users/saiy2k/projects/btc/lightning/lightningd/lightning_openingd
2022-01-09T15:15:13.569Z DEBUG   hsmd: pid 1145, msgfd 36
2022-01-09T15:15:13.613Z DEBUG   connectd: pid 1146, msgfd 40
2022-01-09T15:15:13.613Z DEBUG   hsmd: new_client: 0
2022-01-09T15:15:14.708Z DEBUG   connectd: Created IPv6 listener on port 19735
2022-01-09T15:15:14.708Z DEBUG   **connectd: Failed to create 2 socket: Address already in use**
2022-01-09T15:15:14.708Z DEBUG   connectd: REPLY WIRE_CONNECTD_INIT_REPLY with 0 fds
2022-01-09T15:15:14.711Z DEBUG   gossipd: pid 1147, msgfd 39
2022-01-09T15:15:14.712Z DEBUG   hsmd: new_client: 0
2022-01-09T15:15:14.739Z DEBUG   gossipd: gossip_store_compact_offline: 0 deleted, 0 copied
2022-01-09T15:15:14.739Z DEBUG   gossipd: total store load time: 0 msec    
2022-01-09T15:15:14.739Z DEBUG   gossipd: gossip_store: Read 0/0/0/0 cannounce/cupdate/nannounce/cdelete from store (0 deleted) in 1 bytes
2022-01-09T15:15:14.739Z DEBUG   gossipd: seeker: state = STARTING_UP New seeker
2022-01-09T15:15:14.739Z DEBUG   gossipd: REPLY WIRE_GOSSIPD_INIT_REPLY with 0 fds
2022-01-09T15:15:14.766Z INFO    plugin-bcli: bitcoin-cli initialized and connected to bitcoind.
2022-01-09T15:15:14.766Z DEBUG   lightningd: All Bitcoin plugin commands registered
2022-01-09T15:15:14.774Z DEBUG   lightningd: Unable to estimate opening fees
2022-01-09T15:15:14.774Z DEBUG   lightningd: Unable to estimate mutual_close fees
2022-01-09T15:15:14.774Z DEBUG   lightningd: Unable to estimate unilateral_close fees
2022-01-09T15:15:14.774Z DEBUG   lightningd: Unable to estimate delayed_to_us fees
2022-01-09T15:15:14.774Z DEBUG   lightningd: Unable to estimate htlc_resolution fees
2022-01-09T15:15:14.774Z DEBUG   lightningd: Unable to estimate penalty fees
2022-01-09T15:15:14.774Z DEBUG   lightningd: Unable to estimate min_acceptable fees
2022-01-09T15:15:14.774Z DEBUG   lightningd: Unable to estimate max_acceptable fees
2022-01-09T15:15:14.774Z DEBUG   lightningd: Smoothed feerate estimate for opening initialized to polled estimate 253
2022-01-09T15:15:14.774Z DEBUG   lightningd: Feerate estimate for opening set to 253 (was 0)
2022-01-09T15:15:14.774Z DEBUG   lightningd: Smoothed feerate estimate for mutual_close initialized to polled estimate 253
2022-01-09T15:15:14.774Z DEBUG   lightningd: Feerate estimate for mutual_close set to 253 (was 0)
2022-01-09T15:15:14.774Z DEBUG   lightningd: Smoothed feerate estimate for unilateral_close initialized to polled estimate 253
2022-01-09T15:15:14.774Z DEBUG   lightningd: Feerate estimate for unilateral_close set to 253 (was 0)
2022-01-09T15:15:14.774Z DEBUG   lightningd: Smoothed feerate estimate for delayed_to_us initialized to polled estimate 253
2022-01-09T15:15:14.774Z DEBUG   lightningd: Feerate estimate for delayed_to_us set to 253 (was 0)
2022-01-09T15:15:14.774Z DEBUG   lightningd: Smoothed feerate estimate for htlc_resolution initialized to polled estimate 253
2022-01-09T15:15:14.774Z DEBUG   lightningd: Feerate estimate for htlc_resolution set to 253 (was 0)
2022-01-09T15:15:14.774Z DEBUG   lightningd: Smoothed feerate estimate for penalty initialized to polled estimate 253
2022-01-09T15:15:14.774Z DEBUG   lightningd: Feerate estimate for penalty set to 253 (was 0)
2022-01-09T15:15:14.774Z DEBUG   lightningd: Smoothed feerate estimate for min_acceptable initialized to polled estimate 253
2022-01-09T15:15:14.774Z DEBUG   lightningd: Feerate estimate for min_acceptable set to 253 (was 0)
2022-01-09T15:15:14.774Z DEBUG   lightningd: Smoothed feerate estimate for max_acceptable initialized to polled estimate 253
2022-01-09T15:15:14.774Z DEBUG   lightningd: Feerate estimate for max_acceptable set to 253 (was 0)
2022-01-09T15:15:14.797Z DEBUG   lightningd: Adding block 2135126: 000000008bb23bbb0c06793bf1f7d47539284284f4019fd6b2058d9cf639d21b
2022-01-09T15:15:14.799Z DEBUG   wallet: Loaded 0 channels from DB
2022-01-09T15:15:14.799Z DEBUG   plugin-autoclean: autocleaning not active
2022-01-09T15:15:14.800Z DEBUG   connectd: REPLY WIRE_CONNECTD_ACTIVATE_REPLY with 0 fds
2022-01-09T15:15:14.800Z INFO    lightningd: --------------------------------------------------
2022-01-09T15:15:14.800Z INFO    lightningd: Server started with public key 027d0b5558e6e36a396b4335c51e28d1ec1dbf72a16e98fd87195900626bafdfa9, alias LOUDMONKEY (color #027d0b) and lightningd v0.10.2-193-g73bf4b2
2022-01-09T15:15:14.801Z DEBUG   plugin-fetchinvoice: Killing plugin: disabled itself at init: offers not enabled in config
2022-01-09T15:15:14.816Z DEBUG   lightningd: Adding block 2135127: 0000000000000062ec0632a5d644af1f8afaf0a48a6fecb085df2ef3b565e16c
2022-01-09T15:15:14.833Z DEBUG   lightningd: Adding block 2135128: 000000000000003e17b3b33db5c6e4b84e37494113a8e05b3276faa0f0cd1a30
2022-01-09T15:15:14.850Z DEBUG   lightningd: Adding block 2135129: 00000000000000a56ee0d7633edb05e7dff4b0ffdb1704c894aeb02af733c6f7
2022-01-09T15:15:14.864Z DEBUG   lightningd: Adding block 2135130: 0000000000000085f0749193775b45aad712b0fa5f7e0dfa4d8afd8f5e8fde45
2022-01-09T15:15:14.888Z DEBUG   lightningd: Adding block 2135131: 0000000000000024caf34c595d117e4b6729a38b936ab010bf5547c67de6c48c
2022-01-09T15:15:14.906Z DEBUG   lightningd: Adding block 2135132: 00000000000000399294cc5da617128504730e94a12763213baa961796d15fe3
2022-01-09T15:15:14.926Z DEBUG   lightningd: Adding block 2135133: 000000000000002ee9fe70ac60f798ae0e1d66321d0e626488247f23bdda8c09
2022-01-09T15:15:14.945Z DEBUG   lightningd: Adding block 2135134: 00000000000000a19c79d61e03cb3e338aaf7921899d62d7ee5be705256a45fe
2022-01-09T15:15:14.966Z DEBUG   lightningd: Adding block 2135135: 000000000000006f09a3cff85a2a306b2763209f0be21906aca283255448f208
2022-01-09T15:15:14.986Z DEBUG   lightningd: Adding block 2135136: 00000000000000b18f16cb1a7f6f760f7383a19827773cccf997b02a3318ec46
2022-01-09T15:15:15.008Z DEBUG   lightningd: Adding block 2135137: 00000000ee0aa9141988d131ff588cb09d19d241bd63b5c8b0a1d00939fb54df
2022-01-09T15:15:15.029Z DEBUG   lightningd: Adding block 2135138: 000000009c14602deffbd3296922ba55b832098c9cf80677443adad83b77ca49
2022-01-09T15:15:15.047Z DEBUG   lightningd: Adding block 2135139: 000000000000009729cd3655bc2595677a9ece071118e3c7cb3fa98ab5268d18
2022-01-09T15:15:15.068Z DEBUG   lightningd: Adding block 2135140: 000000000000009286ae27a488a8550b2f0e05dbb9cc6abfa8b0afff346f0b34
2022-01-09T15:15:15.087Z DEBUG   lightningd: Adding block 2135141: 00000000000000523e1e32edc3a04564a2150d2601b75944e32707d604808c8f
2022-01-09T15:15:15.105Z DEBUG   lightningd: Adding block 2135142: 000000000000008df2e08bbe7c9ff7cc35c6e3c9ecb87232f298b8de4850bafc
2022-01-09T15:15:15.125Z DEBUG   lightningd: Adding block 2135143: 00000000000000b5c83bce8a8c009c7ada0c0bc5426716152f9c341c4739a5c7    
2022-01-09T15:15:15.143Z DEBUG   lightningd: Adding block 2135144: 00000000000000b118033b20ea53c451b35716120b7d69b56cb0f9d9dfc6b831    
2022-01-09T15:15:15.160Z DEBUG   lightningd: Adding block 2135145: 000000000000006b802f3cfc151f86cb733eaf8e6aa388fd9b3d0a68fa4bbd3f    
2022-01-09T15:15:15.177Z DEBUG   lightningd: Adding block 2135146: 000000000000005ed7dc430678d687384696e74a28299331a67588905bf6f062    
2022-01-09T15:15:15.194Z DEBUG   lightningd: Adding block 2135147: 000000000000009142e2da8958b8533781f807beea4df488f6e74eaa4087d671    
2022-01-09T15:15:15.212Z DEBUG   lightningd: Adding block 2135148: 000000000000005a3484239a08c9fb094778b1dbfae0b9ee1dfc1d9069295b69    
2022-01-09T15:15:15.230Z DEBUG   lightningd: Adding block 2135149: 00000000000000953fac4e6bfd7bbf289f4f9d6b2f8092c37947eaabc41b9051    
2022-01-09T15:15:15.247Z DEBUG   lightningd: Adding block 2135150: 00000000000000214f530ce76011c286ce4fe7260c84b66123d9953aa603149c    
2022-01-09T15:15:15.266Z DEBUG   lightningd: Adding block 2135151: 0000000054b144f5377980ce5ec91a93119572f7f58bfd373c0610356616deb7    
2022-01-09T15:15:15.293Z DEBUG   lightningd: Adding block 2135152: 00000000000000255efddc5b3be3d3f7e140f66d0832b58d054c9e3fd667a742    
2022-01-09T15:15:15.313Z DEBUG   lightningd: Adding block 2135153: 000000000000002eaf2064f55304904e87bbb0e39f4faf2b3ecd177fd5d0ecb8    
2022-01-09T15:15:15.333Z DEBUG   lightningd: Adding block 2135154: 000000001f8ecb22687773b4a314faf1add87c8d0ce81d1cc4fb9d27100937a3    
2022-01-09T15:15:15.356Z DEBUG   lightningd: Adding block 2135155: 0000000009280cf53408e61dc935ed553b88c45b70a5d2dc77954ef4ec65757a    
2022-01-09T15:15:15.374Z DEBUG  

看起來您已經lightningd在執行並正在嘗試第二次啟動它,因此出現無法打開套接字的錯誤。

當你lightningd在 testnet 上執行時,你還必須告訴你在 testnetlightning-cli上執行。所以我假設lightning-cli嘗試連接到lightning-rpc不存在或已關閉的主網。

因此,您可以做的一件事是嘗試執行lightning-cli --network=testnet getinfo另一件事是您可以將 Lightningd 的數據目錄指定為命令行參數,以便它找到正確的 Lightning-rpc。兩者都可以在您的配置中完成,而不是命令行參數。

引用自:https://bitcoin.stackexchange.com/questions/111696