From 2480cb3a87173a24fb1ea8d717b00a6a6a266eb4 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 16 Sep 2014 15:09:32 -0400 Subject: [PATCH] Match error names to btcdb updates. --- blockmanager.go | 2 +- mempool.go | 4 ++-- mining.go | 4 ++-- rpcwebsocket.go | 2 +- util/addblock/addblock.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/blockmanager.go b/blockmanager.go index 812b66f5..05df36b0 100644 --- a/blockmanager.go +++ b/blockmanager.go @@ -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 } diff --git a/mempool.go b/mempool.go index 335f217f..cbdafcbd 100644 --- a/mempool.go +++ b/mempool.go @@ -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 } diff --git a/mining.go b/mining.go index 87b82f27..1fb292fc 100644 --- a/mining.go +++ b/mining.go @@ -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 } diff --git a/rpcwebsocket.go b/rpcwebsocket.go index d47ea603..b69fb7e2 100644 --- a/rpcwebsocket.go +++ b/rpcwebsocket.go @@ -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 diff --git a/util/addblock/addblock.go b/util/addblock/addblock.go index 6dc8acf4..bc87d849 100644 --- a/util/addblock/addblock.go +++ b/util/addblock/addblock.go @@ -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 }