Currently in several areas, we're forced to perform string checking in order to ensure we act accordingly. Examples include removing a transaction if we accidentally double spent one of our inputs, or realizing that the remote node already has the transaction in their mempool. The current scheme isn't ideal though, as we're forced to ensure proper coverage across all distinct backends at the highest level. Instead, we should define a set of concrete errors, that each backend is responsible for. This way, we can have a set of uniform checks at the very top level, and not have to worry about string matching.
Currently in several areas, we're forced to perform string checking in order to ensure we act accordingly. Examples include removing a transaction if we accidentally double spent one of our inputs, or realizing that the remote node already has the transaction in their mempool. The current scheme isn't ideal though, as we're forced to ensure proper coverage across all distinct backends at the highest level. Instead, we should define a set of concrete errors, that each backend is responsible for. This way, we can have a set of uniform checks at the very top level, and not have to worry about string matching.
A starting set of errors (to map to concrete errors) are the ones we currently use within
lnd
: https://github.com/lightningnetwork/lnd/blob/master/lnwallet/btcwallet/btcwallet.go#L374