Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #817 from Bytom/dev
Browse files Browse the repository at this point in the history
1.0.0
  • Loading branch information
wliyongfeng authored Apr 24, 2018
2 parents 0df7c91 + 7b9022e commit 23e4539
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ benchmark:
functional-tests:
@go test -v -timeout=5m -tags=functional ./test

ci: test functional-tests
ci: test

.PHONY: all target release-all clean test benchmark
10 changes: 5 additions & 5 deletions config/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import (
)

func genesisTx() *types.Tx {
contract, err := hex.DecodeString("00149514bf92cac8791dcc4cd7fd3ef4167ffc477f62")
contract, err := hex.DecodeString("00148c9d063ff74ee6d9ffa88d83aeb038068366c4c4")
if err != nil {
log.Panicf("fail on decode genesis tx output control program")
}

txData := types.TxData{
Version: 1,
Inputs: []*types.TxInput{
types.NewCoinbaseInput([]byte("May 4th Be With You")),
types.NewCoinbaseInput([]byte("Information is power. -- Jan/11/2013. Computing is power. -- Apr/24/2018.")),
},
Outputs: []*types.TxOutput{
types.NewTxOutput(*consensus.BTMAssetID, consensus.InitialBlockSubsidy, contract),
Expand Down Expand Up @@ -47,9 +47,9 @@ func GenesisBlock() *types.Block {
BlockHeader: types.BlockHeader{
Version: 1,
Height: 0,
Nonce: 2083236893,
Timestamp: 1524202000,
Bits: 2305843009214532812,
Nonce: 9253507043297,
Timestamp: 1524549600,
Bits: 2161727821137910632,
BlockCommitment: types.BlockCommitment{
TransactionsMerkleRoot: merkleRoot,
TransactionStatusHash: txStatusHash,
Expand Down
2 changes: 1 addition & 1 deletion config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ api_addr = "0.0.0.0:9888"
var mainNetConfigTmpl = `chain_id = "mainnet"
[p2p]
laddr = "tcp://0.0.0.0:46657"
seeds = ""
seeds = "45.79.213.28:46657,198.74.61.131:46657,212.111.41.245:46657,47.100.214.154:46657,47.100.109.199:46657,47.100.105.165:46657"
`

var testNetConfigTmpl = `chain_id = "testnet"
Expand Down
3 changes: 1 addition & 2 deletions consensus/general.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
CoinbasePendingBlockNumber = uint64(100)
subsidyReductionInterval = uint64(840000)
baseSubsidy = uint64(41250000000)
InitialBlockSubsidy = uint64(147000041250000000)
InitialBlockSubsidy = uint64(140700041250000000)

// config for pow mining
BlocksPerRetarget = uint64(2016)
Expand Down Expand Up @@ -92,7 +92,6 @@ var NetParams = map[string]Params{
"mainnet": MainNetParams,
"testnet": TestNetParams,
"solonet": SoloNetParams,

}

// MainNetParams is the config for production
Expand Down
4 changes: 2 additions & 2 deletions dashboard/dashboard.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions netsync/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func (ps *peerSet) BroadcastMinedBlock(block *types.Block) ([]*peer, error) {
peers := ps.PeersWithoutBlock(&hash)
abnormalPeers := make([]*peer, 0)
for _, peer := range peers {
if ok := peer.swPeer.Send(BlockchainChannel, struct{ BlockchainMessage }{msg}); !ok {
if ok := peer.swPeer.TrySend(BlockchainChannel, struct{ BlockchainMessage }{msg}); !ok {
abnormalPeers = append(abnormalPeers, peer)
continue
}
Expand All @@ -369,7 +369,7 @@ func (ps *peerSet) BroadcastTx(tx *types.Tx) ([]*peer, error) {
peers := ps.PeersWithoutTx(&tx.ID)
abnormalPeers := make([]*peer, 0)
for _, peer := range peers {
if ok := peer.swPeer.Send(BlockchainChannel, struct{ BlockchainMessage }{msg}); !ok {
if ok := peer.swPeer.TrySend(BlockchainChannel, struct{ BlockchainMessage }{msg}); !ok {
abnormalPeers = append(abnormalPeers, peer)
continue
}
Expand Down
4 changes: 2 additions & 2 deletions netsync/protocol_reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (pr *ProtocolReactor) AddPeer(peer *p2p.Peer) error {
if peer == nil {
return errPeerDropped
}
if ok := peer.Send(BlockchainChannel, struct{ BlockchainMessage }{&StatusRequestMessage{}}); !ok {
if ok := peer.TrySend(BlockchainChannel, struct{ BlockchainMessage }{&StatusRequestMessage{}}); !ok {
return ErrStatusRequest
}
retryTicker := time.Tick(handshakeRetryTicker)
Expand All @@ -156,7 +156,7 @@ func (pr *ProtocolReactor) AddPeer(peer *p2p.Peer) error {
if peer == nil {
return errPeerDropped
}
if ok := peer.Send(BlockchainChannel, struct{ BlockchainMessage }{&StatusRequestMessage{}}); !ok {
if ok := peer.TrySend(BlockchainChannel, struct{ BlockchainMessage }{&StatusRequestMessage{}}); !ok {
return ErrStatusRequest
}
case <-handshakeWait.C:
Expand Down
12 changes: 8 additions & 4 deletions p2p/pex_reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const (
PexChannel = byte(0x00)

// period to ensure peers connected
defaultEnsurePeersPeriod = 30 * time.Second
defaultEnsurePeersPeriod = 120 * time.Second
minNumOutboundPeers = 10
maxPexMessageSize = 1048576 // 1MB

Expand Down Expand Up @@ -164,12 +164,16 @@ func (r *PEXReactor) Receive(chID byte, src *Peer, msgBytes []byte) {

// RequestPEX asks peer for more addresses.
func (r *PEXReactor) RequestPEX(p *Peer) {
p.Send(PexChannel, struct{ PexMessage }{&pexRequestMessage{}})
if ok := p.TrySend(PexChannel, struct{ PexMessage }{&pexRequestMessage{}}); !ok {
r.sw.StopPeerGracefully(p)
}
}

// SendAddrs sends addrs to the peer.
func (r *PEXReactor) SendAddrs(p *Peer, addrs []*NetAddress) {
p.Send(PexChannel, struct{ PexMessage }{&pexAddrsMessage{Addrs: addrs}})
if ok := p.TrySend(PexChannel, struct{ PexMessage }{&pexAddrsMessage{Addrs: addrs}}); !ok {
r.sw.StopPeerGracefully(p)
}
}

// SetEnsurePeersPeriod sets period to ensure peers connected.
Expand Down Expand Up @@ -203,7 +207,7 @@ func (r *PEXReactor) IncrementMsgCountForPeer(addr string) {
// Ensures that sufficient peers are connected. (continuous)
func (r *PEXReactor) ensurePeersRoutine() {
// Randomize when routine starts
ensurePeersPeriodMs := r.ensurePeersPeriod.Nanoseconds() / 1e6
ensurePeersPeriodMs := int64(10000)
time.Sleep(time.Duration(rand.Int63n(ensurePeersPeriodMs)) * time.Millisecond)

// fire once immediately.
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package version

var (
// The full version string
Version = "0.5.1"
Version = "1.0.0"
// GitCommit is set with --ldflags "-X main.gitCommit=$(git rev-parse HEAD)"
GitCommit string
)
Expand Down

0 comments on commit 23e4539

Please sign in to comment.