Create block API (todo docs)

This commit is contained in:
Arinerron 2018-05-15 18:47:58 -07:00
parent e95feb06db
commit 9fdb6d8609
No known key found for this signature in database
GPG key ID: 99383627861C62F0
2 changed files with 177 additions and 14 deletions

View file

@ -592,6 +592,20 @@ class Core:
return rows
def getBlockDate(self, blockHash):
'''
Returns the date a block was received
'''
conn = sqlite3.connect(self.blockDB)
c = conn.cursor()
execute = 'SELECT dateReceived FROM hashes WHERE hash=?;'
args = (blockHash,)
for row in c.execute(execute, args):
for i in row:
return int(i)
return None
def getBlocksByType(self, blockType):
'''
Returns a list of blocks by the type