Examples of ByteArrayWrapper


Examples of org.ethereum.db.ByteArrayWrapper

    public void add(Block block){
        logger.info("adding block to alt chain block.hash: [{}] ", block.getShortHash());
        totalDifficulty = totalDifficulty.add(block.getCumulativeDifficulty());
        logger.info("total difficulty on alt chain is: [{}] ", totalDifficulty);
        chain.add(block);
        index.put(new ByteArrayWrapper(block.getHash()), block);
    }
View Full Code Here

Examples of org.ethereum.db.ByteArrayWrapper

    public void setTotalDifficulty(BigInteger totalDifficulty) {
        this.totalDifficulty = totalDifficulty;
    }

    public boolean isParentOnTheChain(Block block){
        return (index.get(new ByteArrayWrapper( block.getParentHash() )) != null);
    }
View Full Code Here

Examples of org.ethereum.db.ByteArrayWrapper

    public static byte[] sha256(byte[] input) {
      return sha256digest.digest(input);
    }

  public static byte[] sha3(byte[] input) {
        ByteArrayWrapper inputByteArray = new ByteArrayWrapper(input);
        byte[] result = sha3Cache.get(inputByteArray);
        if(result != null)
            return result;
        result = SHA3Helper.sha3(input);
        sha3Cache.put(inputByteArray, result);
View Full Code Here

Examples of org.ethereum.db.ByteArrayWrapper

  }

  @Override
  public void update(byte[] key, byte[] value) {
    if (trackingChanges)
      changes.put(new ByteArrayWrapper(key), value);
    else
      trie.update(key, value);
  }
View Full Code Here

Examples of org.ethereum.db.ByteArrayWrapper

  }

  @Override
  public byte[] get(byte[] key) {
    if (trackingChanges) {
      ByteArrayWrapper wKey = new ByteArrayWrapper(key);
      if (deletes.contains(wKey))
        return null;
      if (changes.get(wKey) != null)
        return changes.get(wKey);
      return trie.get(key);
View Full Code Here

Examples of org.ethereum.db.ByteArrayWrapper

  }

  @Override
  public void delete(byte[] key) {
    if (trackingChanges) {
      ByteArrayWrapper wKey = new ByteArrayWrapper(key);
      deletes.add(wKey);
    } else
      trie.delete(key);
  }
View Full Code Here

Examples of org.ethereum.db.ByteArrayWrapper

        walletTransactions.remove(hash);
    }

    public void applyTransaction(Transaction transaction) {

        transactionMap.put(new ByteArrayWrapper(transaction.getHash()), transaction);

        byte[] senderAddress = transaction.getSender();
        Account sender =  rows.get(Hex.toHexString(senderAddress));
        if (sender != null) {
            sender.addPendingTransaction(transaction);
View Full Code Here

Examples of org.springframework.data.keyvalue.redis.connection.util.ByteArrayWrapper

    boolean trace = logger.isTraceEnabled();

    for (Topic topic : topics) {

      ByteArrayWrapper holder = new ByteArrayWrapper(serializer.serialize(topic.getTopic()));

      if (topic instanceof ChannelTopic) {
        Collection<MessageListener> collection = channelMapping.get(holder);
        if (collection == null) {
          collection = new CopyOnWriteArraySet<MessageListener>();
          channelMapping.put(holder, collection);
        }
        collection.add(listener);
        channels.add(holder.getArray());

        if (trace)
          logger.trace("Adding listener '" + listener + "' on channel '" + topic.getTopic() + "'");
      }

      else if (topic instanceof PatternTopic) {
        Collection<MessageListener> collection = patternMapping.get(holder);
        if (collection == null) {
          collection = new CopyOnWriteArraySet<MessageListener>();
          patternMapping.put(holder, collection);
        }
        collection.add(listener);
        patterns.add(holder.getArray());

        if (trace)
          logger.trace("Adding listener '" + listener + "' for pattern '" + topic.getTopic() + "'");
      }
View Full Code Here

Examples of org.springframework.data.keyvalue.redis.connection.util.ByteArrayWrapper

    @Override
    public void onMessage(Message message, byte[] pattern) {
      // do channel matching first
      byte[] channel = message.getChannel();

      Collection<MessageListener> ch = channelMapping.get(new ByteArrayWrapper(channel));
      Collection<MessageListener> pt = null;

      // followed by pattern matching
      if (pattern != null && pattern.length > 0) {
        pt = patternMapping.get(new ByteArrayWrapper(pattern));
      }

      if (!CollectionUtils.isEmpty(ch)) {
        dispatchChannels(ch, message);
      }
View Full Code Here

Examples of org.springframework.data.redis.connection.util.ByteArrayWrapper

    }
    set.addAll(topics);

    for (Topic topic : topics) {

      ByteArrayWrapper holder = new ByteArrayWrapper(serializer.serialize(topic.getTopic()));

      if (topic instanceof ChannelTopic) {
        Collection<MessageListener> collection = channelMapping.get(holder);
        if (collection == null) {
          collection = new CopyOnWriteArraySet<MessageListener>();
          channelMapping.put(holder, collection);
        }
        collection.add(listener);
        channels.add(holder.getArray());

        if (trace)
          logger.trace("Adding listener '" + listener + "' on channel '" + topic.getTopic() + "'");
      }

      else if (topic instanceof PatternTopic) {
        Collection<MessageListener> collection = patternMapping.get(holder);
        if (collection == null) {
          collection = new CopyOnWriteArraySet<MessageListener>();
          patternMapping.put(holder, collection);
        }
        collection.add(listener);
        patterns.add(holder.getArray());

        if (trace)
          logger.trace("Adding listener '" + listener + "' for pattern '" + topic.getTopic() + "'");
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.