b69a849114
This commit contains the entire btcchain repository along with several changes needed to move all of the files into the blockchain directory in order to prepare it for merging. This does NOT update btcd or any of the other packages to use the new location as that will be done separately. - All import paths in the old btcchain test files have been changed to the new location - All references to btcchain as the package name have been changed to blockchain
24 lines
722 B
Go
24 lines
722 B
Go
// Copyright (c) 2013-2014 Conformal Systems LLC.
|
|
// Use of this source code is governed by an ISC
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package blockchain_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/btcsuite/btcd/blockchain"
|
|
"github.com/btcsuite/btcutil"
|
|
)
|
|
|
|
// TestMerkle tests the BuildMerkleTreeStore API.
|
|
func TestMerkle(t *testing.T) {
|
|
block := btcutil.NewBlock(&Block100000)
|
|
merkles := blockchain.BuildMerkleTreeStore(block.Transactions())
|
|
calculatedMerkleRoot := merkles[len(merkles)-1]
|
|
wantMerkle := &Block100000.Header.MerkleRoot
|
|
if !wantMerkle.IsEqual(calculatedMerkleRoot) {
|
|
t.Errorf("BuildMerkleTreeStore: merkle root mismatch - "+
|
|
"got %v, want %v", calculatedMerkleRoot, wantMerkle)
|
|
}
|
|
}
|