示例#1
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """

        return s.uint8 + GetVarSize(self.Key) + GetVarSize(self.Field) + GetVarSize(self.Value)
示例#2
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """
        return super(AccountState,
                     self).Size() + s.uint160 + s.uint8 + GetVarSize(
                         self.Votes) + GetVarSize(len(
                             self.Balances)) + (len(self.Balances) * (32 + 8))
示例#3
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """
        if self.Type == b'\x02':  # ClaimTransaction
            return super(RawTransaction, self).Size() + GetVarSize(self.Claims)
        elif self.Type == b'\xd1':  # InvocationTransaction
            sizeGas = Size.uint64 if self.Version >= 1 else 0
            return super(RawTransaction, self).Size() + GetVarSize(
                self.Script) + sizeGas
        else:
            return super(RawTransaction, self).Size()
示例#4
0
 def Size(self):
     return super(AssetState,
                  self).Size() + s.uint256 + s.uint8 + GetVarSize(
                      self.Name) + self.Amount.Size() + self.Available.Size(
                      ) + s.uint8 + s.uint8 + self.Fee.Size(
                      ) + s.uint160 + self.Owner.Size(
                      ) + s.uint160 + s.uint160 + s.uint32 + s.uint8
示例#5
0
    def Size(self):
        scriptsize = 0
        if self.Script is not None:
            scriptsize = self.Script.Size()

        return s.uint32 + s.uint256 + s.uint32 + s.uint16 + s.uint32 + GetVarSize(
            self.Data) + 1 + scriptsize
示例#6
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """
        return super(ClaimTransaction, self).Size() + GetVarSize(self.Claims)
示例#7
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """
        return super(StorageItem, self).Size() + GetVarSize(self.Value)
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """
        return GetVarSize(self.NetworkAddressesWithTime)
示例#9
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """
        return GetVarSize(self.Headers)
示例#10
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """
        return s.uint32 + s.uint64 + s.uint32 + s.uint16 + s.uint32 + GetVarSize(
            self.UserAgent) + s.uint32 + s.uint8
示例#11
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """
        s = super(Block, self).Size() + GetVarSize(self.Transactions)
        return s
示例#12
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """
        return super(InvocationTransaction, self).Size() + GetVarSize(
            self.Script)
示例#13
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """

        return super(StateTransaction, self).Size() + GetVarSize(self.Descriptors)
示例#14
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """
        corrected_hashes = list(map(lambda i: UInt256(data=binascii.unhexlify(i)), self.HashStart))
        return GetVarSize(corrected_hashes) + self.hash_stop.Size
示例#15
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """
        if len(self.Hashes) > 0:
            if not isinstance(self.Hashes[0], UInt256):
                corrected_hashes = list(map(lambda i: UInt256(data=binascii.unhexlify(i)), self.Hashes))
        return s.uint8 + GetVarSize(corrected_hashes)
示例#16
0
 def Size(self):
     if self.Usage == TransactionAttributeUsage.ContractHash or self.Usage == TransactionAttributeUsage.ECDH02 or self.Usage == TransactionAttributeUsage.ECDH03 or self.Usage == TransactionAttributeUsage.Vote or (
             self.Usage >= TransactionAttributeUsage.Hash1
             and self.Usage <= TransactionAttributeUsage.Hash15):
         return s.uint8 + 32
     elif self.Usage == TransactionAttributeUsage.Script:
         return s.uint8 + 20
     elif self.Usage == TransactionAttributeUsage.DescriptionUrl:
         return s.uint8 + s.uint8 + len(self.Data)
     else:
         return s.uint8 + GetVarSize(self.Data)
示例#17
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """
        # Items should be an array of type CoinState, not of ints!
        corrected_items = list(map(lambda i: CoinState(i), self.Items))
        return super(UnspentCoinState,
                     self).Size() + GetVarSize(corrected_items)
示例#18
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """

        return super(RegisterTransaction,
                     self).Size() + 2 * Size.uint8 + GetVarSize(
                         self.Name) + self.Amount.Size() + self.Owner.Size(
                         ) + self.Admin.Size
示例#19
0
    def test_check_invocation_tx_size(self):
        """ See original test here
            https://github.com/neo-project/neo/blob/master/neo.UnitTests/UT_InvocationTransaction.cs#L52-L69
        """
        i_tx = InvocationTransaction()
        val = GetByteArray(32, 0x42)
        i_tx.Script = val

        self.assertEqual(i_tx.Version, 0)
        self.assertEqual(len(i_tx.Script), 32)
        self.assertEqual(GetVarSize(i_tx.Script), 33)
        self.assertEqual(i_tx.Size(), 39)
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """

        sizeGas = Size.uint64 if self.Version >= 1 else 0

        return super(InvocationTransaction, self).Size() + GetVarSize(
            self.Script) + sizeGas
示例#21
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """
        return super(PublishTransaction, self).Size() + GetVarSize(
            self.Code.Script) + GetVarSize(
                self.Code.ParameterList) + s.uint8 + GetVarSize(
                    self.Name) + GetVarSize(self.CodeVersion) + GetVarSize(
                        self.Author) + GetVarSize(self.Email) + GetVarSize(
                            self.Description)
示例#22
0
    def Size(self):
        """
        Get the total size in bytes of the object.

        Returns:
            int: size.
        """
        script_size = GetVarSize(self.Code.Script)
        parameterlist_size = GetVarSize(self.Code.ParameterList)
        parameterreturntype_size = s.uint8

        return super(ContractState, self).Size(
        ) + script_size + parameterlist_size + parameterreturntype_size + s.uint8 + GetVarSize(
            self.Name) + GetVarSize(self.CodeVersion) + GetVarSize(
                self.Author) + GetVarSize(self.Email) + GetVarSize(
                    self.Description)