lightning icon indicating copy to clipboard operation
lightning copied to clipboard

bitcoind: bad-txns-inputs-missingorspent on sendrawtransaction

Open vincenzopalazzo opened this issue 1 year ago • 3 comments

I did not debug how this is possible but it is better to store this error somewhere


 error: {\\\"code\\\":-25,\\\"message\\\":\\\"bad-txns-inputs-missingorspent\\\"}\") })
2024-03-25T14:05:44.178Z DEBUG   lightningd: Expected error broadcasting tx 020000000001018c9e9f69341019c959b5526231e2bd52bd1e7227a3b72fa40e095ed283b7ddbb0000000000cae9f0800199c20000000000002200203251c1d74d76a6a487afca13913bc09fb3cc766e12efe938c049a1c432316bcf040047304402201a96b84a9e234172ade0f055be867097ac480c2d21f8163f449bde67266dda15022060fe38faed61d573db32ab5d48a3a9eff1f9e27f7adc51e86cb7b22878aad66a014730440220764c985c44e8ae0e303c46588090dea100c997b42ba9bdec7fa66bc68f5cc1fe02205200f62950b4ac4d8a297a97bb30fdc92edd43f5fccaf35b31a46e6963f42f4d0147522102b7c0c24f0a4ed6880289c17132f63c7a9ace2db1dfbc0baaf03a19916cfc867e210382323ae01328ab397c250a3120567531e76970a8c88795cac03e488dafe81b4252ae8ea0b720: [400] Unknown error (sendrawtransaction RPC error: {\"code\":-25,\"message\":\"bad-txns-inputs-missingorspent\"})

vincenzopalazzo avatar Mar 25 '24 14:03 vincenzopalazzo

It literally says that this failure is expected because we are sending a conflicting commitment tx to the peers close.

cdecker avatar Jun 13 '24 08:06 cdecker

Well not quite, this problem was because the wallet of cln is tracking spent tx and it is putting inside the funding transaction.

So this is a bug of our dev- commands that need to be fixed somehow, I think I provided some idea in here https://github.com/vincenzopalazzo/lightning/commit/6e2ab0217eb2e6ffd37297cffedf59e2d8b3a083

vincenzopalazzo avatar Jun 14 '24 10:06 vincenzopalazzo

Sorry if I reopen this again @cdecker but my node fall in this state again, so I think we need to look at https://github.com/ElementsProject/lightning/pull/7296

vincenzopalazzo avatar Jun 18 '24 09:06 vincenzopalazzo

I believe I have the same issue. I see log messages like

lightningd: Expected error broadcasting tx 02000000000102e2fed46a...b268c6fd0c00: error code: -25\nerror message:\nbad-txns-inputs-missingorspent

and I have some channels with active HTLCs that are being force closed.

northben avatar Jul 09 '24 13:07 northben

I have experience in debugging this issue, could you shoot me an email with your description of the problem?

Because if also you fall in this case we should do something about it

vincenzopalazzo avatar Jul 09 '24 15:07 vincenzopalazzo

alright I believe I've figured this out. I was using clboss on my node, and has set these channels to be unmanaged by clboss.

lightning-cli clboss-unmanage <the_node_id> lnfee

I just happened to run lightning-cli listpeerchannels and found a HTLC with state: Waiting for the htlc_accepted hook of plugin clboss

I disabled the clboss plugin completely and the HTLC state is now SENT_REMOVE_HTLC.

I'm not sure if I had misconfigured clboss somehow but I'm going to be extremely careful before I enable it again, and also learned to watch the htlc status in listpeerchannels.

Thank you everyone for building on Bitcoin!

northben avatar Jul 10 '24 17:07 northben