Add Api to fetch potentially fully spent tx (most recent only)
Using FetchUnSpentTxByShaList only API required unexpected contortions in btcchain.
This commit is contained in:
parent
2ec9511891
commit
75896b63ec
3 changed files with 24 additions and 2 deletions
10
db.go
10
db.go
|
@ -79,7 +79,15 @@ type Db interface {
|
||||||
|
|
||||||
// FetchTxByShaList returns a TxListReply given an array of transaction
|
// FetchTxByShaList returns a TxListReply given an array of transaction
|
||||||
// hashes. The implementation may cache the underlying data if desired.
|
// hashes. The implementation may cache the underlying data if desired.
|
||||||
FetchUnSpentTxByShaList(txShaList []*btcwire.ShaHash) ([]*TxListReply)
|
// This differs from FetchUnSpentTxByShaList in that it will return
|
||||||
|
// the most recent known Tx, if it is fully spent or not.
|
||||||
|
FetchTxByShaList(txShaList []*btcwire.ShaHash) []*TxListReply
|
||||||
|
|
||||||
|
// FetchUnSpentTxByShaList returns a TxListReply given an array of
|
||||||
|
// transaction hashes. The implementation may cache the underlying
|
||||||
|
// data if desired. Fully spent transactions will not normally not
|
||||||
|
// be returned in this operation.
|
||||||
|
FetchUnSpentTxByShaList(txShaList []*btcwire.ShaHash) []*TxListReply
|
||||||
|
|
||||||
// InsertBlock inserts raw block and transaction data from a block
|
// InsertBlock inserts raw block and transaction data from a block
|
||||||
// into the database. The first block inserted into the database
|
// into the database. The first block inserted into the database
|
||||||
|
|
|
@ -36,6 +36,13 @@ func (db *LevelDb) fetchBlockBySha(sha *btcwire.ShaHash) (blk *btcutil.Block, er
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FetchTxByShaList returns the most recent tx of the name fully spent or not
|
||||||
|
func (db *LevelDb) FetchTxByShaList(txShaList []*btcwire.ShaHash) []*btcdb.TxListReply {
|
||||||
|
// until the fully spent separation of tx is complete this is identical
|
||||||
|
// to FetchUnSpentTxByShaList
|
||||||
|
return db.FetchUnSpentTxByShaList(txShaList)
|
||||||
|
}
|
||||||
|
|
||||||
// FetchUnSpentTxByShaList given a array of ShaHash, look up the transactions
|
// FetchUnSpentTxByShaList given a array of ShaHash, look up the transactions
|
||||||
// and return them in a TxListReply array.
|
// and return them in a TxListReply array.
|
||||||
func (db *LevelDb) FetchUnSpentTxByShaList(txShaList []*btcwire.ShaHash) []*btcdb.TxListReply {
|
func (db *LevelDb) FetchUnSpentTxByShaList(txShaList []*btcwire.ShaHash) []*btcdb.TxListReply {
|
||||||
|
|
|
@ -131,6 +131,13 @@ func (db *SqliteDb) insertBlockCache(sha *btcwire.ShaHash, blk *btcutil.Block) {
|
||||||
bc.blockMap[blkObj.sha] = &blkObj
|
bc.blockMap[blkObj.sha] = &blkObj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FetchTxByShaList returns the most recent tx of the name fully spent or not
|
||||||
|
func (db *SqliteDb) FetchTxByShaList(txShaList []*btcwire.ShaHash) []*btcdb.TxListReply {
|
||||||
|
// until the fully spent separation of tx is complete this is identical
|
||||||
|
// to FetchUnSpentTxByShaList
|
||||||
|
return db.FetchUnSpentTxByShaList(txShaList)
|
||||||
|
}
|
||||||
|
|
||||||
// FetchUnSpentTxByShaList given a array of ShaHash, look up the transactions
|
// FetchUnSpentTxByShaList given a array of ShaHash, look up the transactions
|
||||||
// and return them in a TxListReply array.
|
// and return them in a TxListReply array.
|
||||||
func (db *SqliteDb) FetchUnSpentTxByShaList(txShaList []*btcwire.ShaHash) []*btcdb.TxListReply {
|
func (db *SqliteDb) FetchUnSpentTxByShaList(txShaList []*btcwire.ShaHash) []*btcdb.TxListReply {
|
||||||
|
|
Loading…
Reference in a new issue