btcsuite / btcwallet

A secure bitcoin wallet daemon written in Go (golang)
ISC License
1.15k stars 590 forks source link

NIT: Bitcoin 0.25 changed the error text so our matching fails now and spams the logs. #892

Closed ziggie1984 closed 1 year ago

ziggie1984 commented 1 year ago

Setup: Pruned Node so getrawtransaction is not available.

We need a different strategy imo when expecting specific errors.

Currently we check for this specific text:

-5: No such mempool or blockchain transaction

Bitcoin Core (25) will return a different error text if the txindex is not set:

-5: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions

Currently it spams the logs of lnd 17:

2023-10-26 19:33:22.082 [ERR] LNWL: unable to fetch transaction 1b23f4ce2fdeefbf625aa4ab99483f2466b15018828b28900ef0fe310cc2d621 from mempool: -5: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.
2023-10-26 19:33:22.083 [ERR] LNWL: unable to fetch transaction d42cd5be1fc6f0193a310684313c0fe1c516e79553e27b1c75d99e6fae561760 from mempool: -5: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.
2023-10-26 19:33:22.089 [ERR] LNWL: unable to fetch transaction cebb27067d46fa2ec86bfc9cd9a610e6afdc1ff53f5be57e4464dc378781d407 from mempool: -5: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.
2023-10-26 19:33:22.102 [ERR] LNWL: unable to fetch transaction 4780d0cb9817d944b1ec83355e1984198d118c584db115f40ec9e83624e8fce0 from mempool: -5: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.
2023-10-26 19:33:22.105 [ERR] LNWL: unable to fetch transaction 296ee47db5d41595316999e136a13357b9d1cf21f8772d1508a3507992e0b1ed from mempool: -5: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.
2023-10-26 19:33:22.107 [ERR] LNWL: unable to fetch transaction 7a467a991697b354ade3e5587774c0e740ebbc8a23e6ea4543bc60122c67c038 from mempool: -5: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.
2023-10-26 19:33:22.108 [ERR] LNWL: unable to fetch transaction c70565174838f61f0d994e310f08491d14fb54f2b3be51594031b26fd603a9e5 from mempool: -5: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.
2023-10-26 19:33:22.110 [ERR] LNWL: unable to fetch transaction a31c4315e60e28c80104e598a4f757e4db14b063754ea3729eb5c3b862de7610 from mempool: -5: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.
2023-10-26 19:33:22.111 [ERR] LNWL: unable to fetch transaction 199c36eeccd68d909df8b49b28ae810cd33ed08c349b0798442a8dd33c1579f2 from mempool: -5: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.
2023-10-26 19:33:22.112 [ERR] LNWL: unable to fetch transaction 09e1d32447bdaa522e4852039026e8a88ce1764001a7cf60b993b572aab71f4c from mempool: -5: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.
2023-10-26 19:33:22.116 [ERR] LNWL: unable to fetch transaction 90c48451404347ec6a2fdd296db8ea785faeb9116ea1e536fa61d30794566a17 from mempool: -5: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.

...

maybe just check for the return values like -5 ?

yyforyongyu commented 1 year ago

yeah i think we can just map the error codes like this, maybe a file that list all of them.