chainregistry: remove txindex requirement for btcd and bitcoind
Now that we have a fallback method for when the transaction index is not enabled, its requirement to be enabled for a full node is no longer needed, so we can safely remove this check.
This commit is contained in:
parent
13fb866574
commit
ead9555d40
@ -163,7 +163,6 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB,
|
||||
var (
|
||||
err error
|
||||
cleanUp func()
|
||||
btcdConn *chain.RPCClient
|
||||
bitcoindConn *chain.BitcoindClient
|
||||
)
|
||||
|
||||
@ -446,7 +445,6 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB,
|
||||
}
|
||||
|
||||
walletConfig.ChainSource = chainRPC
|
||||
btcdConn = chainRPC
|
||||
|
||||
// If we're not in simnet or regtest mode, then we'll attempt
|
||||
// to use a proper fee estimator for testnet.
|
||||
@ -522,41 +520,6 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB,
|
||||
|
||||
cc.wallet = wallet
|
||||
|
||||
// As a final check, if we're using the RPC backend, we'll ensure that
|
||||
// the btcd node has the txindex set. Atm, this is required in order to
|
||||
// properly perform historical confirmation+spend dispatches.
|
||||
if homeChainConfig.Node != "neutrino" {
|
||||
// In order to check to see if we have the txindex up to date
|
||||
// and active, we'll try to fetch the first transaction in the
|
||||
// latest block via the index. If this doesn't succeed, then we
|
||||
// know it isn't active (or just not yet up to date).
|
||||
bestHash, _, err := cc.chainIO.GetBestBlock()
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("unable to get current "+
|
||||
"best hash: %v", err)
|
||||
}
|
||||
bestBlock, err := cc.chainIO.GetBlock(bestHash)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("unable to get current "+
|
||||
"block hash: %v", err)
|
||||
}
|
||||
|
||||
firstTxHash := bestBlock.Transactions[0].TxHash()
|
||||
switch homeChainConfig.Node {
|
||||
case "btcd":
|
||||
_, err = btcdConn.GetRawTransaction(&firstTxHash)
|
||||
case "bitcoind":
|
||||
_, err = bitcoindConn.GetRawTransactionVerbose(&firstTxHash)
|
||||
}
|
||||
if err != nil {
|
||||
// If the node doesn't have the txindex set, then we'll
|
||||
// halt startup, as we can't proceed in this state.
|
||||
return nil, nil, fmt.Errorf("%s detected to not "+
|
||||
"have --txindex active, cannot proceed",
|
||||
homeChainConfig.Node)
|
||||
}
|
||||
}
|
||||
|
||||
return cc, cleanUp, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user