The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
woop/blockchain/block_test.go

21 lines
490 B

package blockchain
import (
"reflect"
"testing"
)
func TestBlockSerialize(t *testing.T) {
cbtx := NewCoinbaseTX(TestAddressOne, genesisCoinbaseData, 0)
if cbtx == nil {
t.Errorf("Failed to create a coinbase transaction.")
}
block := NewGenesisBlock(cbtx, 0)
serializedValue := block.Serialize()
deserializedBlock, _ := DeserializeBlock(serializedValue)
if !reflect.DeepEqual(block, deserializedBlock) {
t.Errorf("Original block and the deserialized block not equal.")
}
}