Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
merge from master
Browse files Browse the repository at this point in the history
  • Loading branch information
localhuman committed Sep 20, 2017
2 parents 1f02a9c + 606103a commit 58757ad
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion neo/Core/Helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def VerifyScripts(verifiable):

res = engine.Execute()
if not res:
print("engine did not execune")
print("engine did not execute")
return False


Expand Down
1 change: 0 additions & 1 deletion neo/Core/State/AssetState.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def Serialize(self, writer):
writer.WriteFixed8(self.Fee)
writer.WriteUInt160(self.FeeAddress)
self.Owner.Serialize(writer)
print("6")
writer.WriteUInt160(self.Admin)
writer.WriteUInt160(self.Issuer)
writer.WriteUInt32(self.Expiration)
Expand Down
2 changes: 1 addition & 1 deletion neo/IO/BinaryReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def ReadSerializableArray(self, class_name, max=sys.maxsize ):
klass = getattr(importlib.import_module(module), klassname)
length = self.ReadVarInt(max=max)
items = []
# print("WILL TRY TO READ SERIALIZABLE ARRAY.... %s %s " % (length, class_name))

try:
for i in range(0, length):
item = klass()
Expand Down
20 changes: 17 additions & 3 deletions neo/Implementations/Blockchains/LevelDB/LevelDBBlockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def __init__(self, path):
current_header_height = int.from_bytes(ba[-4:], 'little')
current_header_hash = bytes(ba[:64].decode('utf-8'), encoding='utf-8')

self.__log.debug("current header hash!! %s " % current_header_hash)
self.__log.debug("current header height, hashes %s %s %s" %(self._current_block_height, self._header_index, current_header_height) )
# self.__log.debug("current header hash!! %s " % current_header_hash)
# self.__log.debug("current header height, hashes %s %s %s" %(self._current_block_height, self._header_index, current_header_height) )


hashes = []
Expand Down Expand Up @@ -157,7 +157,21 @@ def __init__(self, path):
if h.Index > 0:
self._header_index.append(h.Hash.ToBytes())

elif current_header_height > self._stored_header_count:

try:
hash = current_header_hash
targethash = self._header_index[-1]

newhashes = []
while hash != targethash:
header = self.GetHeader(hash)
newhashes.insert(0, header)
hash = header.PrevHash.ToBytes()

self.AddHeaders(newhashes)
except Exception as e:
pass
else:
with self._db.write_batch() as wb:
for key,value in self._db.iterator():
Expand Down Expand Up @@ -347,7 +361,7 @@ def GetHeader(self, hash):
out = out[8:]
outhex = binascii.unhexlify(out)
return Header.FromTrimmedData(outhex, 0)
except TypeError:
except TypeError as e2:
pass
except Exception as e:
self.__log.debug("OTHER ERRROR %s " % e)
Expand Down

0 comments on commit 58757ad

Please sign in to comment.