neb.py icon indicating copy to clipboard operation
neb.py copied to clipboard

Address.py 中校验地址”校验和“部分代码是否存在逻辑Bug?

Open logan059 opened this issue 5 years ago • 0 comments

(https://github.com/nebulasio/neb.py/blob/master/nebpysdk/src/core/Address.py#L125)

@classmethod
    def parse_from_bytes(cls, byte):
        if len(byte) != cls.__AddressLength or byte[0] != cls.__PaddingByte[0]:
            raise Exception("invalid address bytes")
        checksum = byte[cls.__AddressLength - cls.__AddressChecksumLength:] 
        checkdata = byte[:cls.__AddressLength - cls.__AddressChecksumLength]
        if not cls.byte_equal(cls.check_sum(checkdata), checksum):
            raise Exception("invalid address check sum")
        return Address(byte)

@ideaalloc

logan059 avatar Sep 06 '19 03:09 logan059