From 78d4bfecd411d0681abef28a4e348e96ca4c070d Mon Sep 17 00:00:00 2001 From: Dale Rahn Date: Wed, 2 Oct 2013 18:29:37 -0400 Subject: [PATCH] Remove obsolete API functions --- sqlite3/sqliteblock.go | 9 --------- sqlite3/sqlitedbcache.go | 21 ++++----------------- sqlite3/sqlitetx.go | 8 -------- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/sqlite3/sqliteblock.go b/sqlite3/sqliteblock.go index 48b9f177f..0be4bcd95 100644 --- a/sqlite3/sqliteblock.go +++ b/sqlite3/sqliteblock.go @@ -11,15 +11,6 @@ import ( _ "github.com/mattn/go-sqlite3" ) -// InsertBlockData stores a block hash and its associated data block with a -// previous sha of `prevSha' and a version of `pver'. -func (db *SqliteDb) InsertBlockData(sha *btcwire.ShaHash, prevSha *btcwire.ShaHash, pver uint32, buf []byte) (blockid int64, err error) { - db.dbLock.Lock() - defer db.dbLock.Unlock() - - return db.insertBlockData(sha, prevSha, pver, buf) -} - // insertSha stores a block hash and its associated data block with a // previous sha of `prevSha' and a version of `pver'. // insertSha shall be called with db lock held diff --git a/sqlite3/sqlitedbcache.go b/sqlite3/sqlitedbcache.go index 0553c54b2..97079cf67 100644 --- a/sqlite3/sqlitedbcache.go +++ b/sqlite3/sqlitedbcache.go @@ -228,8 +228,8 @@ func (db *SqliteDb) fetchTxDataBySha(txsha *btcwire.ShaHash) (rtx *btcwire.MsgTx return &tx, txbuf, pver, blksha, height, txspent, nil } -// FetchTxAllBySha returns several pieces of data regarding the given sha. -func (db *SqliteDb) FetchTxAllBySha(txsha *btcwire.ShaHash) (rtx *btcwire.MsgTx, rtxbuf []byte, rpver uint32, rblksha *btcwire.ShaHash, err error) { +// FetchTxBySha returns several pieces of data regarding the given sha. +func (db *SqliteDb) FetchTxBySha(txsha *btcwire.ShaHash) (rtx *btcwire.MsgTx, rpver uint32, rblksha *btcwire.ShaHash, err error) { var pver uint32 var blksha *btcwire.ShaHash var height int64 @@ -240,7 +240,7 @@ func (db *SqliteDb) FetchTxAllBySha(txsha *btcwire.ShaHash) (rtx *btcwire.MsgTx, // Check Tx cache if txc, ok := db.fetchTxCache(txsha); ok { - return txc.tx, txc.txbuf, txc.pver, &txc.blksha, nil + return txc.tx, txc.pver, &txc.blksha, nil } // If not cached load it @@ -293,20 +293,7 @@ func (db *SqliteDb) FetchTxAllBySha(txsha *btcwire.ShaHash) (rtx *btcwire.MsgTx, txc.blksha = *blksha db.insertTxCache(&txc) - return &tx, txbuf, pver, blksha, nil -} - -// FetchTxBySha returns some data for the given Tx Sha. -func (db *SqliteDb) FetchTxBySha(txsha *btcwire.ShaHash) (rtx *btcwire.MsgTx, rpver uint32, blksha *btcwire.ShaHash, err error) { - rtx, _, rpver, blksha, err = db.FetchTxAllBySha(txsha) - return -} - -// FetchTxBufBySha return the bytestream data and associated protocol version. -// for the given Tx Sha -func (db *SqliteDb) FetchTxBufBySha(txsha *btcwire.ShaHash) (txbuf []byte, rpver uint32, err error) { - _, txbuf, rpver, _, err = db.FetchTxAllBySha(txsha) - return + return &tx, pver, blksha, nil } // fetchTxCache look up the given transaction in the Tx cache. diff --git a/sqlite3/sqlitetx.go b/sqlite3/sqlitetx.go index c735f0f9c..2e4ccaa38 100644 --- a/sqlite3/sqlitetx.go +++ b/sqlite3/sqlitetx.go @@ -11,14 +11,6 @@ import ( _ "github.com/mattn/go-sqlite3" ) -// InsertTx inserts a tx hash and its associated data into the database. -func (db *SqliteDb) InsertTx(txsha *btcwire.ShaHash, height int64, txoff int, txlen int, usedbuf []byte) (err error) { - db.dbLock.Lock() - defer db.dbLock.Unlock() - - return db.insertTx(txsha, height, txoff, txlen, usedbuf) -} - // insertTx inserts a tx hash and its associated data into the database. // Must be called with db lock held. func (db *SqliteDb) insertTx(txsha *btcwire.ShaHash, height int64, txoff int, txlen int, usedbuf []byte) (err error) {