|
@ -471,13 +471,11 @@ class DB(util.LoggedClass): |
|
|
|
|
|
|
|
|
return nremoves |
|
|
return nremoves |
|
|
|
|
|
|
|
|
def get_history(self, hashX, limit=1000): |
|
|
def get_history_txnums(self, hashX, limit=1000): |
|
|
'''Generator that returns an unpruned, sorted list of (tx_hash, |
|
|
'''Generator that returns an unpruned, sorted list of tx_nums in the |
|
|
height) tuples of confirmed transactions that touched the address, |
|
|
history of a hashX. Includes both spending and receiving |
|
|
earliest in the blockchain first. Includes both spending and |
|
|
transactions. By default yields at most 1000 entries. Set |
|
|
receiving transactions. By default yields at most 1000 entries. |
|
|
limit to None to get them all. ''' |
|
|
Set limit to None to get them all. |
|
|
|
|
|
''' |
|
|
|
|
|
limit = self._resolve_limit(limit) |
|
|
limit = self._resolve_limit(limit) |
|
|
for key, hist in self.hist_db.iterator(prefix=hashX): |
|
|
for key, hist in self.hist_db.iterator(prefix=hashX): |
|
|
a = array.array('I') |
|
|
a = array.array('I') |
|
@ -485,5 +483,15 @@ class DB(util.LoggedClass): |
|
|
for tx_num in a: |
|
|
for tx_num in a: |
|
|
if limit == 0: |
|
|
if limit == 0: |
|
|
return |
|
|
return |
|
|
yield self.fs_tx_hash(tx_num) |
|
|
yield tx_num |
|
|
limit -= 1 |
|
|
limit -= 1 |
|
|
|
|
|
|
|
|
|
|
|
def get_history(self, hashX, limit=1000): |
|
|
|
|
|
'''Generator that returns an unpruned, sorted list of (tx_hash, |
|
|
|
|
|
height) tuples of confirmed transactions that touched the address, |
|
|
|
|
|
earliest in the blockchain first. Includes both spending and |
|
|
|
|
|
receiving transactions. By default yields at most 1000 entries. |
|
|
|
|
|
Set limit to None to get them all. |
|
|
|
|
|
''' |
|
|
|
|
|
for tx_num in self.get_history_txnums(hashX, limit): |
|
|
|
|
|
yield self.fs_tx_hash(tx_num) |
|
|