Fix listsinceblock to consider target confirms.

Closes #80.
This commit is contained in:
Josh Rickmar 2014-04-12 12:26:40 -05:00
parent d9432fe8ad
commit 2bb41582c9

View file

@ -172,11 +172,18 @@ func (a *Account) CurrentAddress() (btcutil.Address, error) {
func (a *Account) ListSinceBlock(since, curBlockHeight int32, minconf int) ([]btcjson.ListTransactionsResult, error) { func (a *Account) ListSinceBlock(since, curBlockHeight int32, minconf int) ([]btcjson.ListTransactionsResult, error) {
var txList []btcjson.ListTransactionsResult var txList []btcjson.ListTransactionsResult
for _, txRecord := range a.TxStore.SortedRecords() { for _, txRecord := range a.TxStore.SortedRecords() {
// check block number. // Transaction records must only be considered if they occur
// after the block height since.
if since != -1 && txRecord.Height() <= since { if since != -1 && txRecord.Height() <= since {
continue continue
} }
// Transactions that have not met minconf confirmations are to
// be ignored.
if !confirmed(minconf, txRecord.Height(), curBlockHeight) {
continue
}
txList = append(txList, txList = append(txList,
txRecord.TxInfo(a.name, curBlockHeight, a.Net())...) txRecord.TxInfo(a.name, curBlockHeight, a.Net())...)
} }