Beispiel #1
0
func NewVisor(c VisorConfig) *Visor {
	var v *visor.Visor = nil
	if !c.Disabled {
		v = visor.NewVisor(c.Config)
	}
	return &Visor{
		Config:            c,
		Visor:             v,
		blockchainLengths: make(map[string]uint64),
	}
}
Beispiel #2
0
// Returns an appropriate VisorConfig and a master visor
func setupVisor() (VisorConfig, *visor.Visor) {
	coin.SetAddressVersion("test")

	// Make a new master visor + blockchain
	// Get the signed genesis block,
	mw := visor.NewWalletEntry()
	mvc := visor.NewVisorConfig()
	mvc.IsMaster = true
	mvc.MasterKeys = mw
	mvc.CoinHourBurnFactor = 0
	mv := visor.NewVisor(mvc)
	sb := mv.GetGenesisBlock()

	// Use the master values for a client configuration
	c := NewVisorConfig()
	c.Config.IsMaster = false
	c.Config.MasterKeys = mw
	c.Config.MasterKeys.Secret = coin.SecKey{}
	c.Config.GenesisTimestamp = sb.Block.Head.Time
	c.Config.GenesisSignature = sb.Sig
	return c, mv
}
Beispiel #3
0
// Returns an appropriate VisorConfig and a master visor
func setupVisor() (VisorConfig, *visor.Visor) {
	coin.SetAddressVersion("test")

	// Make a new master visor + blockchain
	// Get the signed genesis block,
	mw := wallet.NewWalletEntry()
	mvc := visor.NewVisorConfig()
	mvc.IsMaster = true
	mvc.MasterKeys = mw
	mvc.CoinHourBurnFactor = 0
	mvc.GenesisSignature = createGenesisSignature(mw)
	mv := visor.NewVisor(mvc)

	// Use the master values for a client configuration
	c := NewVisorConfig()
	c.Config.WalletDirectory = testWalletDir
	c.Config.IsMaster = false
	c.Config.MasterKeys = mw
	c.Config.MasterKeys.Secret = coin.SecKey{}
	c.Config.GenesisSignature = mvc.GenesisSignature
	c.Config.GenesisTimestamp = mvc.GenesisTimestamp
	return c, mv
}