Skip to content

Commit

Permalink
Merge pull request expanse-org#25 from happyuc-project/master
Browse files Browse the repository at this point in the history
Merge master debug
  • Loading branch information
ldcc authored May 31, 2018
2 parents 148f559 + d860511 commit 14cca8f
Show file tree
Hide file tree
Showing 68 changed files with 266 additions and 271 deletions.
2 changes: 1 addition & 1 deletion accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ import (
"github.com/happyuc-project/happyuc-go/core/state"
"github.com/happyuc-project/happyuc-go/core/types"
"github.com/happyuc-project/happyuc-go/core/vm"
"github.com/happyuc-project/happyuc-go/event"
"github.com/happyuc-project/happyuc-go/huc/filters"
"github.com/happyuc-project/happyuc-go/hucdb"
"github.com/happyuc-project/happyuc-go/event"
"github.com/happyuc-project/happyuc-go/params"
"github.com/happyuc-project/happyuc-go/rpc"
)
Expand Down
4 changes: 3 additions & 1 deletion accounts/keystore/account_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ func (ac *accountCache) scanAccounts() error {
// Create a helper method to scan the contents of the key files
var (
buf = new(bufio.Reader)
key struct{ Address string `json:"address"` }
key struct {
Address string `json:"address"`
}
)
readAccount := func(path string) *accounts.Account {
fd, err := os.Open(path)
Expand Down
262 changes: 131 additions & 131 deletions accounts/usbwallet/internal/trezor/messages.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion accounts/usbwallet/trezor.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import (
"io"
"math/big"

"github.com/golang/protobuf/proto"
"github.com/happyuc-project/happyuc-go/accounts"
"github.com/happyuc-project/happyuc-go/accounts/usbwallet/internal/trezor"
"github.com/happyuc-project/happyuc-go/common"
"github.com/happyuc-project/happyuc-go/common/hexutil"
"github.com/happyuc-project/happyuc-go/core/types"
"github.com/happyuc-project/happyuc-go/log"
"github.com/golang/protobuf/proto"
)

// ErrTrezorPINNeeded is returned if opening the trezor requires a PIN code. In
Expand Down
8 changes: 4 additions & 4 deletions accounts/usbwallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ type wallet struct {
accounts []accounts.Account // List of derive accounts pinned on the hardware wallet
paths map[common.Address]accounts.DerivationPath // Known derivation paths for signing operations

deriveNextPath accounts.DerivationPath // Next derivation path for account auto-discovery
deriveNextAddr common.Address // Next derived account address for auto-discovery
deriveNextPath accounts.DerivationPath // Next derivation path for account auto-discovery
deriveNextAddr common.Address // Next derived account address for auto-discovery
deriveChain happyuc.ChainStateReader // Blockchain state reader to discover used account with
deriveReq chan chan struct{} // Channel to request a self-derivation on
deriveQuit chan chan error // Channel to terminate the self-deriver with
deriveReq chan chan struct{} // Channel to request a self-derivation on
deriveQuit chan chan error // Channel to terminate the self-deriver with

healthQuit chan chan error

Expand Down
2 changes: 1 addition & 1 deletion cmd/ghuc/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import (
"github.com/happyuc-project/happyuc-go/core"
"github.com/happyuc-project/happyuc-go/core/state"
"github.com/happyuc-project/happyuc-go/core/types"
"github.com/happyuc-project/happyuc-go/event"
"github.com/happyuc-project/happyuc-go/huc/downloader"
"github.com/happyuc-project/happyuc-go/hucdb"
"github.com/happyuc-project/happyuc-go/event"
"github.com/happyuc-project/happyuc-go/log"
"github.com/happyuc-project/happyuc-go/trie"
"github.com/syndtr/goleveldb/leveldb/util"
Expand Down
2 changes: 1 addition & 1 deletion cmd/ghuc/consolecmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main

import (
"crypto/rand"
"github.com/happyuc-project/happyuc-go/params"
"math/big"
"os"
"path/filepath"
Expand All @@ -26,7 +27,6 @@ import (
"strings"
"testing"
"time"
"github.com/happyuc-project/happyuc-go/params"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion cmd/ghuc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/happyuc-project/happyuc-go/accounts"
"github.com/happyuc-project/happyuc-go/accounts/keystore"
"github.com/happyuc-project/happyuc-go/cmd/utils"
"github.com/happyuc-project/happyuc-go/common"
"github.com/happyuc-project/happyuc-go/console"
"github.com/happyuc-project/happyuc-go/huc"
"github.com/happyuc-project/happyuc-go/hucclient"
Expand All @@ -36,7 +37,6 @@ import (
"github.com/happyuc-project/happyuc-go/metrics"
"github.com/happyuc-project/happyuc-go/node"
"gopkg.in/urfave/cli.v1"
"github.com/happyuc-project/happyuc-go/common"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion cmd/ghuc/monitorcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import (
"strings"
"time"

"github.com/gizak/termui"
"github.com/happyuc-project/happyuc-go/cmd/utils"
"github.com/happyuc-project/happyuc-go/node"
"github.com/happyuc-project/happyuc-go/rpc"
"github.com/gizak/termui"
"gopkg.in/urfave/cli.v1"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/ghuc/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ type testghuc struct {
*cmdtest.TestCmd

// template variables for expect
Datadir string
Coinbase string
Datadir string
Coinbase string
}

func init() {
Expand Down
4 changes: 2 additions & 2 deletions cmd/pupphuc/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
// C++ HappyUC implementation.
type cppHappyUCGenesisSpec struct {
SealEngine string `json:"sealEngine"`
Params struct {
Params struct {
AccountStartNonce hexutil.Uint64 `json:"accountStartNonce"`
HomesteadForkBlock hexutil.Uint64 `json:"homesteadForkBlock"`
EIP150ForkBlock hexutil.Uint64 `json:"EIP150ForkBlock"`
Expand Down Expand Up @@ -164,7 +164,7 @@ func newCppHappyUCGenesisSpec(network string, genesis *core.Genesis) (*cppHappyU

// parityChainSpec is the chain specification format used by Parity.
type parityChainSpec struct {
Name string `json:"name"`
Name string `json:"name"`
Engine struct {
Huchash struct {
Params struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/pupphuc/module_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func deployNode(client *sshClient, network string, bootnodes []string, config *n
"LightFlag": lightFlag,
"Bootnodes": strings.Join(bootnodes, ","),
"Hucstats": config.hucstats,
"Coinbase": config.coinbase,
"Coinbase": config.coinbase,
"GasTarget": uint64(1000000 * config.gasTarget),
"GasPrice": uint64(1000000000 * config.gasPrice),
"Unlock": config.keyJSON != "",
Expand All @@ -120,7 +120,7 @@ func deployNode(client *sshClient, network string, bootnodes []string, config *n
"Light": config.peersLight > 0,
"LightPeers": config.peersLight,
"Hucstats": config.hucstats[:strings.Index(config.hucstats, ":")],
"Coinbase": config.coinbase,
"Coinbase": config.coinbase,
"GasTarget": config.gasTarget,
"GasPrice": config.gasPrice,
})
Expand Down
8 changes: 4 additions & 4 deletions consensus/huchash/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ func calcDifficultyHomestead(time uint64, parent *types.Header) *big.Int {
// https://github.com/happyuc-project/HIPs/blob/master/EIPS/eip-2.md
// algorithm:
// diff = (parent_diff +
// (parent_diff / 2048 * max(1 - (block_timestamp - parent_timestamp) // 10, -99))
// (parent_diff / 2048 * max(1 - (block_timestamp - parent_timestamp) / 10, -99))
// ) + 2^(periodCount - 2)

bigTime := new(big.Int).SetUint64(time)
Expand All @@ -396,16 +396,16 @@ func calcDifficultyHomestead(time uint64, parent *types.Header) *big.Int {
x := new(big.Int)
y := new(big.Int)

// 1 - (block_timestamp - parent_timestamp) // 10
// 1 - (block_timestamp - parent_timestamp) / 10
x.Sub(bigTime, bigParentTime)
x.Div(x, big10)
x.Sub(big1, x)

// max(1 - (block_timestamp - parent_timestamp) // 10, -99)
// max(1 - (block_timestamp - parent_timestamp) / 10, -99)
if x.Cmp(bigMinus99) < 0 {
x.Set(bigMinus99)
}
// (parent_diff + parent_diff // 2048 * max(1 - (block_timestamp - parent_timestamp) // 10, -99))
// (parent_diff + parent_diff / 2048 * max(1 - (block_timestamp - parent_timestamp) / 10, -99))
y.Div(parent.Difficulty, params.DifficultyBoundDivisor)
x.Mul(y, x)
x.Add(parent.Difficulty, x)
Expand Down
2 changes: 1 addition & 1 deletion consensus/huchash/huchash.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ type Huchash struct {
hashrate metrics.Meter // Meter tracking the average hashrate

// The fields below are hooks for testing
shared *Huchash // Shared PoW verifier to avoid cache regeneration
shared *Huchash // Shared PoW verifier to avoid cache regeneration
fakeFail uint64 // Block number which fails PoW check even in fake mode
fakeDelay time.Duration // Time delay to sleep for before returning from verify

Expand Down
6 changes: 3 additions & 3 deletions console/console_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ func newTester(t *testing.T, confOverride func(*huc.Config)) *tester {
t.Fatalf("failed to create node: %v", err)
}
hucConf := &huc.Config{
Genesis : core.DeveloperGenesisBlock(15, common.Address{}),
Genesis: core.DeveloperGenesisBlock(15, common.Address{}),
Coinbase: common.HexToAddress(testAddress),
Huchash : huchash.Config{
Huchash: huchash.Config{
PowMode: huchash.ModeTest,
},
}
Expand All @@ -117,7 +117,7 @@ func newTester(t *testing.T, confOverride func(*huc.Config)) *tester {
t.Fatalf("failed to attach to node: %v", err)
}
prompter := &hookedPrompter{scheduler: make(chan string)}
printer := new(bytes.Buffer)
printer := new(bytes.Buffer)

console, err := New(Config{
DataDir: stack.InstanceDir(),
Expand Down
6 changes: 3 additions & 3 deletions contracts/chequebook/contract/chequebook.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions contracts/ens/contract/ens.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 18 additions & 18 deletions contracts/ens/contract/publicresolver.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import (
"github.com/happyuc-project/happyuc-go/core/types"
"github.com/happyuc-project/happyuc-go/core/vm"
"github.com/happyuc-project/happyuc-go/crypto"
"github.com/happyuc-project/happyuc-go/hucdb"
"github.com/happyuc-project/happyuc-go/event"
"github.com/happyuc-project/happyuc-go/hucdb"
"github.com/happyuc-project/happyuc-go/log"
"github.com/happyuc-project/happyuc-go/metrics"
"github.com/happyuc-project/happyuc-go/params"
Expand Down Expand Up @@ -691,7 +691,7 @@ func (bc *BlockChain) procFutureBlocks() {
type WriteStatus byte

const (
NonStatTy WriteStatus = iota
NonStatTy WriteStatus = iota
CanonStatTy
SideStatTy
)
Expand Down
2 changes: 1 addition & 1 deletion core/chain_indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (

"github.com/happyuc-project/happyuc-go/common"
"github.com/happyuc-project/happyuc-go/core/types"
"github.com/happyuc-project/happyuc-go/hucdb"
"github.com/happyuc-project/happyuc-go/event"
"github.com/happyuc-project/happyuc-go/hucdb"
"github.com/happyuc-project/happyuc-go/log"
)

Expand Down
Loading

0 comments on commit 14cca8f

Please sign in to comment.