Match error names to btcdb updates.

This commit is contained in:
John C. Vernaleo 2014-09-16 15:09:32 -04:00
parent 41fbb87c86
commit 2480cb3a87
5 changed files with 7 additions and 7 deletions

View file

@ -1476,7 +1476,7 @@ func setupBlockDB() (btcdb.Db, error) {
if err != nil {
// Return the error if it's not because the database
// doesn't exist.
if err != btcdb.DbDoesNotExist {
if err != btcdb.ErrDbDoesNotExist {
return nil, err
}

View file

@ -693,7 +693,7 @@ func (mp *txMemPool) fetchInputTransactions(tx *btcutil.Tx) (btcchain.TxStore, e
// Attempt to populate any missing inputs from the transaction pool.
for _, txD := range txStore {
if txD.Err == btcdb.TxShaMissing || txD.Tx == nil {
if txD.Err == btcdb.ErrTxShaMissing || txD.Tx == nil {
if poolTxDesc, exists := mp.pool[*txD.Hash]; exists {
poolTx := poolTxDesc.Tx
txD.Tx = poolTx
@ -839,7 +839,7 @@ func (mp *txMemPool) maybeAcceptTransaction(tx *btcutil.Tx, isOrphan *bool, isNe
// Transaction is an orphan if any of the inputs don't exist.
for _, txD := range txStore {
if txD.Err == btcdb.TxShaMissing {
if txD.Err == btcdb.ErrTxShaMissing {
if isOrphan != nil {
*isOrphan = true
}

View file

@ -188,8 +188,8 @@ func minInt(a, b int) int {
func mergeTxStore(txStoreA btcchain.TxStore, txStoreB btcchain.TxStore) {
for hash, txDataB := range txStoreB {
if txDataA, exists := txStoreA[hash]; !exists ||
(txDataA.Err == btcdb.TxShaMissing && txDataB.Err !=
btcdb.TxShaMissing) {
(txDataA.Err == btcdb.ErrTxShaMissing && txDataB.Err !=
btcdb.ErrTxShaMissing) {
txStoreA[hash] = txDataB
}

View file

@ -1790,7 +1790,7 @@ fetchRange:
if err != nil {
// Only handle reorgs if a block could not be
// found for the hash.
if err != btcdb.BlockShaMissing {
if err != btcdb.ErrBlockShaMissing {
rpcsLog.Errorf("Error looking up "+
"block: %v", err)
return nil, &btcjson.ErrDatabase

View file

@ -40,7 +40,7 @@ func loadBlockDB() (btcdb.Db, error) {
if err != nil {
// Return the error if it's not because the database doesn't
// exist.
if err != btcdb.DbDoesNotExist {
if err != btcdb.ErrDbDoesNotExist {
return nil, err
}