git.gammaspectra.live/P2Pool/consensus@v0.0.0-20240403173234-a039820b20c9/p2pool/sidechain/consensus_test.go (about)

     1  package sidechain
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  )
     7  
     8  func TestDefaultConsensusId(t *testing.T) {
     9  	id := ConsensusMini.CalculateId()
    10  	if id != ConsensusMini.Id {
    11  		t.Fatalf("wrong mini sidechain id, expected %s, got %s", ConsensusMini.Id.String(), id.String())
    12  	}
    13  
    14  	id = ConsensusDefault.CalculateId()
    15  	if id != ConsensusDefault.Id {
    16  		t.Fatalf("wrong default sidechain id, expected %s, got %s", ConsensusDefault.Id.String(), id.String())
    17  	}
    18  }
    19  
    20  func TestOverlyLongConsensus(t *testing.T) {
    21  
    22  	c := NewConsensus(NetworkMainnet, strings.Repeat("A", 128), strings.Repeat("A", 128), 10, 100000, 2160, 20)
    23  
    24  	c2 := NewConsensus(NetworkMainnet, strings.Repeat("A", 128), strings.Repeat("A", 128), 100, 1000000, 1000, 30)
    25  
    26  	if c.Id == c2.Id {
    27  		t.Fatalf("consensus is different but ids are equal, %s, %s", c.Id.String(), c2.Id.String())
    28  	}
    29  }