src/main/Block.java
public void buildMerkleTree(){
        List<String> tree = new ArrayList<String>();

        //Create tree of hashes
        for (Transaction t : transactions){
            tree.add(t.transactionId);
        }

        List<String> newTxList = getNewTxList(tree);
        while (newTxList.size() != 1) {
            newTxList = getNewTxList(newTxList);
        }
    
        this.merkleRoot = newTxList.get(0);
    }
// Builds the merkle tree structure for storing the transactions in the blocks
Builds the merkle tree structure for storing the transactions in the blocks
Builds the merkle tree structure for storing the transactions in the blocks
public void buildMerkleTree(){
        List<String> tree = new ArrayList<String>();
        for (Transaction t : transactions){
            tree.add(t.transactionId);
        }
        List<String> newTxList = getNewTxList(tree);
        while (newTxList.size() != 1) {
            newTxList = getNewTxList(newTxList);
        }
        this.merkleRoot = newTxList.get(0);
    }
public void buildMerkleTree ( ) { List < String > tree = new ArrayList < String > ( ) ; for ( Transaction t : transactions ) { tree . add ( t . transactionId ) ; } List < String > newTxList = getNewTxList ( tree ) ; while ( newTxList . size ( ) != 1 ) { newTxList = getNewTxList ( newTxList ) ; } this . merkleRoot = newTxList . get ( 0 ) ; }
Builds the merkle tree structure for storing the transactions in the blocks
Builds the merkle tree structure for storing the transactions in the blocks
//Create tree of hashes