Esempio n. 1
0
	"github.com/expanse-project/go-expanse/core/types"
	"github.com/expanse-project/go-expanse/core/vm"
	"github.com/expanse-project/go-expanse/crypto"
	"github.com/expanse-project/go-expanse/ethdb"
	"github.com/expanse-project/go-expanse/event"
	"github.com/expanse-project/go-expanse/logger"
	"github.com/expanse-project/go-expanse/logger/glog"
	"github.com/expanse-project/go-expanse/metrics"
	"github.com/expanse-project/go-expanse/pow"
	"github.com/expanse-project/go-expanse/rlp"
	"github.com/expanse-project/go-expanse/trie"
	"github.com/hashicorp/golang-lru"
)

var (
	chainlogger = logger.NewLogger("CHAIN")
	jsonlogger  = logger.NewJsonLogger()

	blockInsertTimer = metrics.NewTimer("chain/inserts")

	ErrNoGenesis = errors.New("Genesis not found in chain")
)

const (
	headerCacheLimit    = 512
	bodyCacheLimit      = 256
	tdCacheLimit        = 1024
	blockCacheLimit     = 256
	maxFutureBlocks     = 256
	maxTimeFutureBlocks = 30
	// must be bumped when consensus algorithm is changed, this forces the upgradedb
Esempio n. 2
0
package ezp

import (
	"encoding/binary"
	"math/big"
	"math/rand"
	"time"

	"github.com/expanse-project/go-expanse/common"
	"github.com/expanse-project/go-expanse/crypto/sha3"
	"github.com/expanse-project/go-expanse/logger"
	"github.com/expanse-project/go-expanse/pow"
)

var powlogger = logger.NewLogger("POW")

type EasyPow struct {
	hash     *big.Int
	HashRate int64
	turbo    bool
}

func New() *EasyPow {
	return &EasyPow{turbo: false}
}

func (pow *EasyPow) GetHashrate() int64 {
	return pow.HashRate
}
Esempio n. 3
0
// Contains the external API to the whisper sub-protocol.

package xeth

import (
	"fmt"
	"time"

	"github.com/expanse-project/go-expanse/common"
	"github.com/expanse-project/go-expanse/crypto"
	"github.com/expanse-project/go-expanse/logger"
	"github.com/expanse-project/go-expanse/whisper"
)

var qlogger = logger.NewLogger("XSHH")

// Whisper represents the API wrapper around the internal whisper implementation.
type Whisper struct {
	*whisper.Whisper
}

// NewWhisper wraps an internal whisper client into an external API version.
func NewWhisper(w *whisper.Whisper) *Whisper {
	return &Whisper{w}
}

// NewIdentity generates a new cryptographic identity for the client, and injects
// it into the known identities for message decryption.
func (self *Whisper) NewIdentity() string {
	identity := self.Whisper.NewIdentity()