From b8fe518e1a6637a8e287846ab2f7a8b5ae8fcc9b Mon Sep 17 00:00:00 2001 From: ldcc Date: Mon, 21 May 2018 22:03:37 +0800 Subject: [PATCH 1/9] debug --- core/tx_pool.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/tx_pool.go b/core/tx_pool.go index 265305f9983b..f5af80de3533 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -527,6 +527,7 @@ func (pool *TxPool) Pending() (map[common.Address]types.Transactions, error) { for addr, list := range pool.pending { pending[addr] = list.Flatten() } + fmt.Println(pool.pending) return pending, nil } From 84a9f2ccf536579d77d2f37256c640bedad1475f Mon Sep 17 00:00:00 2001 From: ldcc Date: Mon, 21 May 2018 22:13:05 +0800 Subject: [PATCH 2/9] debug --- core/tx_pool.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/tx_pool.go b/core/tx_pool.go index f5af80de3533..3c95e24d25b2 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -523,11 +523,12 @@ func (pool *TxPool) Pending() (map[common.Address]types.Transactions, error) { pool.mu.Lock() defer pool.mu.Unlock() + fmt.Println(" ------------------------", pool.pending) pending := make(map[common.Address]types.Transactions) for addr, list := range pool.pending { pending[addr] = list.Flatten() } - fmt.Println(pool.pending) + fmt.Println(" ------------------------", pool.pending) return pending, nil } From d19b7f3564965e7d86c47ca986ffbdce8391a027 Mon Sep 17 00:00:00 2001 From: ldcc Date: Tue, 22 May 2018 10:58:00 +0800 Subject: [PATCH 3/9] debug --- core/tx_pool.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/tx_pool.go b/core/tx_pool.go index 3c95e24d25b2..4a764493420c 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -622,6 +622,7 @@ func (pool *TxPool) journalTx(from common.Address, tx *types.Transaction) { // whitelisted, preventing any associated transaction from being dropped out of // the pool due to pricing constraints. func (pool *TxPool) add(tx *types.Transaction, local bool) (bool, error) { + fmt.Println("add tx:", tx) // If the transaction is already known, discard it hash := tx.Hash() if pool.all[hash] != nil { From 2e13b24473f6a07053b38e8d5ff1edd0294e6eba Mon Sep 17 00:00:00 2001 From: ldcc Date: Tue, 22 May 2018 14:43:07 +0800 Subject: [PATCH 4/9] debug --- consensus/huchash/consensus.go | 8 ++++---- core/tx_pool.go | 3 --- miner/worker.go | 1 + 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/consensus/huchash/consensus.go b/consensus/huchash/consensus.go index c6e68080d636..c9ef3967182d 100644 --- a/consensus/huchash/consensus.go +++ b/consensus/huchash/consensus.go @@ -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) @@ -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) diff --git a/core/tx_pool.go b/core/tx_pool.go index 4a764493420c..86a24782fc1e 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -522,13 +522,10 @@ func (pool *TxPool) Content() (map[common.Address]types.Transactions, map[common func (pool *TxPool) Pending() (map[common.Address]types.Transactions, error) { pool.mu.Lock() defer pool.mu.Unlock() - - fmt.Println(" ------------------------", pool.pending) pending := make(map[common.Address]types.Transactions) for addr, list := range pool.pending { pending[addr] = list.Flatten() } - fmt.Println(" ------------------------", pool.pending) return pending, nil } diff --git a/miner/worker.go b/miner/worker.go index 978e803174e6..47313e748dce 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -581,6 +581,7 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB env.tcount++ txs.Shift() default: + fmt.Println(tx) // Strange error, discard the transaction and get the next in line (note, the // nonce-too-high clause will prevent us from executing in vain). log.Warn("Transaction failed, account skipped", "hash", tx.Hash(), "err", err) From bdf5659f59e0c20f9bffc46f339e008b9eeaded3 Mon Sep 17 00:00:00 2001 From: ldcc Date: Tue, 22 May 2018 16:20:13 +0800 Subject: [PATCH 5/9] debug --- miner/worker.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/miner/worker.go b/miner/worker.go index 47313e748dce..7418e53910e0 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -553,7 +553,7 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB // Check whether the tx is replay protected. If we're not in the EIP155 hf // phase, start ignoring the sender until we do. if tx.Protected() && !env.config.IsEIP155(env.header.Number) { - log.Crit("Ignoring reply protected transaction", "hash", tx.Hash(), "eip155", env.config.EIP155Block) + log.Trace("Ignoring reply protected transaction", "hash", tx.Hash(), "eip155", env.config.EIP155Block) txs.Pop() continue @@ -581,11 +581,10 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB env.tcount++ txs.Shift() default: - fmt.Println(tx) // Strange error, discard the transaction and get the next in line (note, the // nonce-too-high clause will prevent us from executing in vain). - log.Warn("Transaction failed, account skipped", "hash", tx.Hash(), "err", err) - txs.Pop() + log.Debug("Transaction failed, account skipped", "hash", tx.Hash(), "err", err) + txs.Shift() } } From 71790b787757e0d04a691adb6c156ed3e9f124c7 Mon Sep 17 00:00:00 2001 From: ldcc Date: Tue, 22 May 2018 19:10:21 +0800 Subject: [PATCH 6/9] debug --- core/genesis.go | 2 +- miner/worker.go | 1 - params/config.go | 10 +++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/core/genesis.go b/core/genesis.go index 3ee77b1d7c13..75ce317a4e00 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -313,7 +313,7 @@ func DefaultGenesisBlock() *Genesis { return &Genesis{ Config: params.MainnetChainConfig, Nonce: 66, - ExtraData: hexutil.MustDecode("0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"), + ExtraData: hexutil.MustDecode("0x6861707079536f667477617265"), GasLimit: 4700000, Difficulty: big.NewInt(1048576), Alloc: decodePrealloc(mainnetAllocData), diff --git a/miner/worker.go b/miner/worker.go index 7418e53910e0..b976a0e927be 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -371,7 +371,6 @@ func (self *worker) makeCurrent(parent *types.Block, header *types.Header) error // push sends a new work task to currently live miner agents. func (self *worker) push(work *Work) { - for agent := range self.agents { atomic.AddInt32(&self.atWork, 1) if ch := agent.Work(); ch != nil { diff --git a/params/config.go b/params/config.go index de2a913a45bf..146d39f7dcff 100644 --- a/params/config.go +++ b/params/config.go @@ -24,17 +24,17 @@ import ( ) var ( - MainnetGenesisHash = common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3") // Mainnet genesis hash to enforce below configs on - TestnetGenesisHash = common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d") // Testnet genesis hash to enforce below configs on + MainnetGenesisHash = common.HexToHash("0x5edb680bd141442fff52006a8db1526a32e0f72f57ef5f285f3e032af5bdacb5") // Mainnet genesis hash to enforce below configs on + TestnetGenesisHash = common.HexToHash("0x389d168191585e7a14b01a654c02058053abf3ca3d167efb69a51dec86d9cfbc") // Testnet genesis hash to enforce below configs on ) var ( // MainnetChainConfig is the chain parameters to run a node on the main network. MainnetChainConfig = &ChainConfig{ ChainId: big.NewInt(1), - HomesteadBlock: big.NewInt(1150000), - DAOForkBlock: big.NewInt(1920000), - DAOForkSupport: true, + HomesteadBlock: nil, + DAOForkBlock: nil, + DAOForkSupport: false, EIP150Block: nil, EIP150Hash: common.Hash{}, EIP155Block: nil, From e069770bf06de4a76cdf8b86292c7bf99ddeff91 Mon Sep 17 00:00:00 2001 From: ldcc Date: Wed, 23 May 2018 20:35:52 +0800 Subject: [PATCH 7/9] debug --- accounts/abi/bind/backends/simulated.go | 2 +- accounts/keystore/account_cache.go | 4 +- .../usbwallet/internal/trezor/messages.pb.go | 262 +++++++++--------- accounts/usbwallet/trezor.go | 2 +- accounts/usbwallet/wallet.go | 8 +- build/env.sh | 2 +- cmd/ghuc/chaincmd.go | 2 +- cmd/ghuc/consolecmd_test.go | 2 +- cmd/ghuc/main.go | 2 +- cmd/ghuc/monitorcmd.go | 2 +- cmd/ghuc/run_test.go | 4 +- cmd/pupphuc/genesis.go | 4 +- cmd/pupphuc/module_node.go | 4 +- consensus/huchash/huchash.go | 2 +- console/console_test.go | 6 +- contracts/chequebook/contract/chequebook.go | 6 +- contracts/ens/contract/ens.go | 24 +- contracts/ens/contract/publicresolver.go | 36 +-- core/blockchain.go | 4 +- core/chain_indexer.go | 2 +- core/database_util.go | 2 +- core/genesis.go | 2 +- core/helper_test.go | 2 +- core/tx_pool.go | 2 +- core/tx_pool_test.go | 2 +- core/types/gen_tx_json.go | 16 +- core/types/transaction.go | 9 +- core/vm/evm.go | 2 +- huc/api_backend.go | 2 +- huc/backend.go | 6 +- huc/config.go | 2 +- huc/downloader/api.go | 2 +- huc/downloader/downloader.go | 2 +- huc/downloader/downloader_test.go | 2 +- huc/filters/api.go | 2 +- huc/filters/bench_test.go | 2 +- huc/filters/filter.go | 2 +- huc/filters/filter_system_test.go | 2 +- huc/filters/filter_test.go | 2 +- huc/handler.go | 2 +- huc/handler_test.go | 2 +- huc/helper_test.go | 2 +- huc/tracers/tracers_test.go | 1 - hucstats/hucstats.go | 2 +- internal/hucapi/backend.go | 2 +- internal/jsre/jsre.go | 4 +- internal/jsre/jsre_test.go | 2 +- les/api_backend.go | 2 +- les/backend.go | 2 +- les/handler.go | 2 +- les/handler_test.go | 2 +- les/helper_test.go | 2 +- light/lightchain.go | 2 +- light/postprocess.go | 2 +- light/txpool.go | 2 +- log/logger.go | 2 +- miner/agent.go | 2 +- miner/miner.go | 2 +- miner/worker.go | 2 +- mobile/ghuc.go | 4 +- node/node.go | 2 +- node/service.go | 2 +- p2p/rlpx.go | 2 +- p2p/server.go | 6 +- params/config.go | 2 +- rlp/decode.go | 2 +- vendor/gopkg.in/check.v1/benchmark.go | 6 +- whisper/whisperv6/peer_test.go | 2 - 68 files changed, 254 insertions(+), 258 deletions(-) diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index 9339ec594646..dda278559f0f 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -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" ) diff --git a/accounts/keystore/account_cache.go b/accounts/keystore/account_cache.go index 5e9a1b0e7dbf..d9434fc661e2 100644 --- a/accounts/keystore/account_cache.go +++ b/accounts/keystore/account_cache.go @@ -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) diff --git a/accounts/usbwallet/internal/trezor/messages.pb.go b/accounts/usbwallet/internal/trezor/messages.pb.go index 9302c918091f..ca01d1cd1179 100644 --- a/accounts/usbwallet/internal/trezor/messages.pb.go +++ b/accounts/usbwallet/internal/trezor/messages.pb.go @@ -17,79 +17,79 @@ var _ = math.Inf type MessageType int32 const ( - MessageType_MessageType_Initialize MessageType = 0 - MessageType_MessageType_Ping MessageType = 1 - MessageType_MessageType_Success MessageType = 2 - MessageType_MessageType_Failure MessageType = 3 - MessageType_MessageType_ChangePin MessageType = 4 - MessageType_MessageType_WipeDevice MessageType = 5 - MessageType_MessageType_FirmwareErase MessageType = 6 - MessageType_MessageType_FirmwareUpload MessageType = 7 - MessageType_MessageType_FirmwareRequest MessageType = 8 - MessageType_MessageType_GetEntropy MessageType = 9 - MessageType_MessageType_Entropy MessageType = 10 - MessageType_MessageType_GetPublicKey MessageType = 11 - MessageType_MessageType_PublicKey MessageType = 12 - MessageType_MessageType_LoadDevice MessageType = 13 - MessageType_MessageType_ResetDevice MessageType = 14 - MessageType_MessageType_SignTx MessageType = 15 - MessageType_MessageType_SimpleSignTx MessageType = 16 - MessageType_MessageType_Features MessageType = 17 - MessageType_MessageType_PinMatrixRequest MessageType = 18 - MessageType_MessageType_PinMatrixAck MessageType = 19 - MessageType_MessageType_Cancel MessageType = 20 - MessageType_MessageType_TxRequest MessageType = 21 - MessageType_MessageType_TxAck MessageType = 22 - MessageType_MessageType_CipherKeyValue MessageType = 23 - MessageType_MessageType_ClearSession MessageType = 24 - MessageType_MessageType_ApplySettings MessageType = 25 - MessageType_MessageType_ButtonRequest MessageType = 26 - MessageType_MessageType_ButtonAck MessageType = 27 - MessageType_MessageType_ApplyFlags MessageType = 28 - MessageType_MessageType_GetAddress MessageType = 29 - MessageType_MessageType_Address MessageType = 30 - MessageType_MessageType_SelfTest MessageType = 32 - MessageType_MessageType_BackupDevice MessageType = 34 - MessageType_MessageType_EntropyRequest MessageType = 35 - MessageType_MessageType_EntropyAck MessageType = 36 - MessageType_MessageType_SignMessage MessageType = 38 - MessageType_MessageType_VerifyMessage MessageType = 39 - MessageType_MessageType_MessageSignature MessageType = 40 - MessageType_MessageType_PassphraseRequest MessageType = 41 - MessageType_MessageType_PassphraseAck MessageType = 42 - MessageType_MessageType_EstimateTxSize MessageType = 43 - MessageType_MessageType_TxSize MessageType = 44 - MessageType_MessageType_RecoveryDevice MessageType = 45 - MessageType_MessageType_WordRequest MessageType = 46 - MessageType_MessageType_WordAck MessageType = 47 - MessageType_MessageType_CipheredKeyValue MessageType = 48 - MessageType_MessageType_EncryptMessage MessageType = 49 - MessageType_MessageType_EncryptedMessage MessageType = 50 - MessageType_MessageType_DecryptMessage MessageType = 51 - MessageType_MessageType_DecryptedMessage MessageType = 52 - MessageType_MessageType_SignIdentity MessageType = 53 - MessageType_MessageType_SignedIdentity MessageType = 54 - MessageType_MessageType_GetFeatures MessageType = 55 + MessageType_MessageType_Initialize MessageType = 0 + MessageType_MessageType_Ping MessageType = 1 + MessageType_MessageType_Success MessageType = 2 + MessageType_MessageType_Failure MessageType = 3 + MessageType_MessageType_ChangePin MessageType = 4 + MessageType_MessageType_WipeDevice MessageType = 5 + MessageType_MessageType_FirmwareErase MessageType = 6 + MessageType_MessageType_FirmwareUpload MessageType = 7 + MessageType_MessageType_FirmwareRequest MessageType = 8 + MessageType_MessageType_GetEntropy MessageType = 9 + MessageType_MessageType_Entropy MessageType = 10 + MessageType_MessageType_GetPublicKey MessageType = 11 + MessageType_MessageType_PublicKey MessageType = 12 + MessageType_MessageType_LoadDevice MessageType = 13 + MessageType_MessageType_ResetDevice MessageType = 14 + MessageType_MessageType_SignTx MessageType = 15 + MessageType_MessageType_SimpleSignTx MessageType = 16 + MessageType_MessageType_Features MessageType = 17 + MessageType_MessageType_PinMatrixRequest MessageType = 18 + MessageType_MessageType_PinMatrixAck MessageType = 19 + MessageType_MessageType_Cancel MessageType = 20 + MessageType_MessageType_TxRequest MessageType = 21 + MessageType_MessageType_TxAck MessageType = 22 + MessageType_MessageType_CipherKeyValue MessageType = 23 + MessageType_MessageType_ClearSession MessageType = 24 + MessageType_MessageType_ApplySettings MessageType = 25 + MessageType_MessageType_ButtonRequest MessageType = 26 + MessageType_MessageType_ButtonAck MessageType = 27 + MessageType_MessageType_ApplyFlags MessageType = 28 + MessageType_MessageType_GetAddress MessageType = 29 + MessageType_MessageType_Address MessageType = 30 + MessageType_MessageType_SelfTest MessageType = 32 + MessageType_MessageType_BackupDevice MessageType = 34 + MessageType_MessageType_EntropyRequest MessageType = 35 + MessageType_MessageType_EntropyAck MessageType = 36 + MessageType_MessageType_SignMessage MessageType = 38 + MessageType_MessageType_VerifyMessage MessageType = 39 + MessageType_MessageType_MessageSignature MessageType = 40 + MessageType_MessageType_PassphraseRequest MessageType = 41 + MessageType_MessageType_PassphraseAck MessageType = 42 + MessageType_MessageType_EstimateTxSize MessageType = 43 + MessageType_MessageType_TxSize MessageType = 44 + MessageType_MessageType_RecoveryDevice MessageType = 45 + MessageType_MessageType_WordRequest MessageType = 46 + MessageType_MessageType_WordAck MessageType = 47 + MessageType_MessageType_CipheredKeyValue MessageType = 48 + MessageType_MessageType_EncryptMessage MessageType = 49 + MessageType_MessageType_EncryptedMessage MessageType = 50 + MessageType_MessageType_DecryptMessage MessageType = 51 + MessageType_MessageType_DecryptedMessage MessageType = 52 + MessageType_MessageType_SignIdentity MessageType = 53 + MessageType_MessageType_SignedIdentity MessageType = 54 + MessageType_MessageType_GetFeatures MessageType = 55 MessageType_MessageType_GetAddressHappyUC MessageType = 56 MessageType_MessageType_AddressHappyUC MessageType = 57 MessageType_MessageType_SignTxHappyUC MessageType = 58 MessageType_MessageType_TxRequestHappyUC MessageType = 59 MessageType_MessageType_TxAckHappyUC MessageType = 60 - MessageType_MessageType_GetECDHSessionKey MessageType = 61 - MessageType_MessageType_ECDHSessionKey MessageType = 62 - MessageType_MessageType_SetU2FCounter MessageType = 63 + MessageType_MessageType_GetECDHSessionKey MessageType = 61 + MessageType_MessageType_ECDHSessionKey MessageType = 62 + MessageType_MessageType_SetU2FCounter MessageType = 63 MessageType_MessageType_SignMessageHappyUC MessageType = 64 MessageType_MessageType_VerifyMessageHappyUC MessageType = 65 MessageType_MessageType_MessageSignatureHappyUC MessageType = 66 - MessageType_MessageType_DebugLinkDecision MessageType = 100 - MessageType_MessageType_DebugLinkGetState MessageType = 101 - MessageType_MessageType_DebugLinkState MessageType = 102 - MessageType_MessageType_DebugLinkStop MessageType = 103 - MessageType_MessageType_DebugLinkLog MessageType = 104 - MessageType_MessageType_DebugLinkMemoryRead MessageType = 110 - MessageType_MessageType_DebugLinkMemory MessageType = 111 - MessageType_MessageType_DebugLinkMemoryWrite MessageType = 112 - MessageType_MessageType_DebugLinkFlashErase MessageType = 113 + MessageType_MessageType_DebugLinkDecision MessageType = 100 + MessageType_MessageType_DebugLinkGetState MessageType = 101 + MessageType_MessageType_DebugLinkState MessageType = 102 + MessageType_MessageType_DebugLinkStop MessageType = 103 + MessageType_MessageType_DebugLinkLog MessageType = 104 + MessageType_MessageType_DebugLinkMemoryRead MessageType = 110 + MessageType_MessageType_DebugLinkMemory MessageType = 111 + MessageType_MessageType_DebugLinkMemoryWrite MessageType = 112 + MessageType_MessageType_DebugLinkFlashErase MessageType = 113 ) var MessageType_name = map[int32]string{ @@ -168,79 +168,79 @@ var MessageType_name = map[int32]string{ 113: "MessageType_DebugLinkFlashErase", } var MessageType_value = map[string]int32{ - "MessageType_Initialize": 0, - "MessageType_Ping": 1, - "MessageType_Success": 2, - "MessageType_Failure": 3, - "MessageType_ChangePin": 4, - "MessageType_WipeDevice": 5, - "MessageType_FirmwareErase": 6, - "MessageType_FirmwareUpload": 7, - "MessageType_FirmwareRequest": 8, - "MessageType_GetEntropy": 9, - "MessageType_Entropy": 10, - "MessageType_GetPublicKey": 11, - "MessageType_PublicKey": 12, - "MessageType_LoadDevice": 13, - "MessageType_ResetDevice": 14, - "MessageType_SignTx": 15, - "MessageType_SimpleSignTx": 16, - "MessageType_Features": 17, - "MessageType_PinMatrixRequest": 18, - "MessageType_PinMatrixAck": 19, - "MessageType_Cancel": 20, - "MessageType_TxRequest": 21, - "MessageType_TxAck": 22, - "MessageType_CipherKeyValue": 23, - "MessageType_ClearSession": 24, - "MessageType_ApplySettings": 25, - "MessageType_ButtonRequest": 26, - "MessageType_ButtonAck": 27, - "MessageType_ApplyFlags": 28, - "MessageType_GetAddress": 29, - "MessageType_Address": 30, - "MessageType_SelfTest": 32, - "MessageType_BackupDevice": 34, - "MessageType_EntropyRequest": 35, - "MessageType_EntropyAck": 36, - "MessageType_SignMessage": 38, - "MessageType_VerifyMessage": 39, - "MessageType_MessageSignature": 40, - "MessageType_PassphraseRequest": 41, - "MessageType_PassphraseAck": 42, - "MessageType_EstimateTxSize": 43, - "MessageType_TxSize": 44, - "MessageType_RecoveryDevice": 45, - "MessageType_WordRequest": 46, - "MessageType_WordAck": 47, - "MessageType_CipheredKeyValue": 48, - "MessageType_EncryptMessage": 49, - "MessageType_EncryptedMessage": 50, - "MessageType_DecryptMessage": 51, - "MessageType_DecryptedMessage": 52, - "MessageType_SignIdentity": 53, - "MessageType_SignedIdentity": 54, - "MessageType_GetFeatures": 55, + "MessageType_Initialize": 0, + "MessageType_Ping": 1, + "MessageType_Success": 2, + "MessageType_Failure": 3, + "MessageType_ChangePin": 4, + "MessageType_WipeDevice": 5, + "MessageType_FirmwareErase": 6, + "MessageType_FirmwareUpload": 7, + "MessageType_FirmwareRequest": 8, + "MessageType_GetEntropy": 9, + "MessageType_Entropy": 10, + "MessageType_GetPublicKey": 11, + "MessageType_PublicKey": 12, + "MessageType_LoadDevice": 13, + "MessageType_ResetDevice": 14, + "MessageType_SignTx": 15, + "MessageType_SimpleSignTx": 16, + "MessageType_Features": 17, + "MessageType_PinMatrixRequest": 18, + "MessageType_PinMatrixAck": 19, + "MessageType_Cancel": 20, + "MessageType_TxRequest": 21, + "MessageType_TxAck": 22, + "MessageType_CipherKeyValue": 23, + "MessageType_ClearSession": 24, + "MessageType_ApplySettings": 25, + "MessageType_ButtonRequest": 26, + "MessageType_ButtonAck": 27, + "MessageType_ApplyFlags": 28, + "MessageType_GetAddress": 29, + "MessageType_Address": 30, + "MessageType_SelfTest": 32, + "MessageType_BackupDevice": 34, + "MessageType_EntropyRequest": 35, + "MessageType_EntropyAck": 36, + "MessageType_SignMessage": 38, + "MessageType_VerifyMessage": 39, + "MessageType_MessageSignature": 40, + "MessageType_PassphraseRequest": 41, + "MessageType_PassphraseAck": 42, + "MessageType_EstimateTxSize": 43, + "MessageType_TxSize": 44, + "MessageType_RecoveryDevice": 45, + "MessageType_WordRequest": 46, + "MessageType_WordAck": 47, + "MessageType_CipheredKeyValue": 48, + "MessageType_EncryptMessage": 49, + "MessageType_EncryptedMessage": 50, + "MessageType_DecryptMessage": 51, + "MessageType_DecryptedMessage": 52, + "MessageType_SignIdentity": 53, + "MessageType_SignedIdentity": 54, + "MessageType_GetFeatures": 55, "MessageType_GetAddressHappyUC": 56, "MessageType_AddressHappyUC": 57, "MessageType_SignTxHappyUC": 58, "MessageType_TxRequestHappyUC": 59, "MessageType_TxAckHappyUC": 60, - "MessageType_GetECDHSessionKey": 61, - "MessageType_ECDHSessionKey": 62, - "MessageType_SetU2FCounter": 63, + "MessageType_GetECDHSessionKey": 61, + "MessageType_ECDHSessionKey": 62, + "MessageType_SetU2FCounter": 63, "MessageType_SignMessageHappyUC": 64, "MessageType_VerifyMessageHappyUC": 65, "MessageType_MessageSignatureHappyUC": 66, - "MessageType_DebugLinkDecision": 100, - "MessageType_DebugLinkGetState": 101, - "MessageType_DebugLinkState": 102, - "MessageType_DebugLinkStop": 103, - "MessageType_DebugLinkLog": 104, - "MessageType_DebugLinkMemoryRead": 110, - "MessageType_DebugLinkMemory": 111, - "MessageType_DebugLinkMemoryWrite": 112, - "MessageType_DebugLinkFlashErase": 113, + "MessageType_DebugLinkDecision": 100, + "MessageType_DebugLinkGetState": 101, + "MessageType_DebugLinkState": 102, + "MessageType_DebugLinkStop": 103, + "MessageType_DebugLinkLog": 104, + "MessageType_DebugLinkMemoryRead": 110, + "MessageType_DebugLinkMemory": 111, + "MessageType_DebugLinkMemoryWrite": 112, + "MessageType_DebugLinkFlashErase": 113, } func (x MessageType) Enum() *MessageType { @@ -976,7 +976,7 @@ func (m *GetAddressHappyUC) GetAddressN() []uint32 { return nil } -func (m * GetAddressHappyUC) GetShowDisplay() bool { +func (m *GetAddressHappyUC) GetShowDisplay() bool { if m != nil && m.ShowDisplay != nil { return *m.ShowDisplay } diff --git a/accounts/usbwallet/trezor.go b/accounts/usbwallet/trezor.go index 3ea665177836..09b030368db6 100644 --- a/accounts/usbwallet/trezor.go +++ b/accounts/usbwallet/trezor.go @@ -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 diff --git a/accounts/usbwallet/wallet.go b/accounts/usbwallet/wallet.go index 8c102a8cb57f..64ffa8bdd4da 100644 --- a/accounts/usbwallet/wallet.go +++ b/accounts/usbwallet/wallet.go @@ -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 diff --git a/build/env.sh b/build/env.sh index 85a3308e1e4b..adc73fbe26c7 100755 --- a/build/env.sh +++ b/build/env.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh\ set -e diff --git a/cmd/ghuc/chaincmd.go b/cmd/ghuc/chaincmd.go index c74adb678ba0..bd3dcc9cce29 100644 --- a/cmd/ghuc/chaincmd.go +++ b/cmd/ghuc/chaincmd.go @@ -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" diff --git a/cmd/ghuc/consolecmd_test.go b/cmd/ghuc/consolecmd_test.go index 5f60bd961886..7ac205bb112f 100644 --- a/cmd/ghuc/consolecmd_test.go +++ b/cmd/ghuc/consolecmd_test.go @@ -18,6 +18,7 @@ package main import ( "crypto/rand" + "github.com/happyuc-project/happyuc-go/params" "math/big" "os" "path/filepath" @@ -26,7 +27,6 @@ import ( "strings" "testing" "time" - "github.com/happyuc-project/happyuc-go/params" ) const ( diff --git a/cmd/ghuc/main.go b/cmd/ghuc/main.go index 99460e8b923d..55f633af0ae1 100644 --- a/cmd/ghuc/main.go +++ b/cmd/ghuc/main.go @@ -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" @@ -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 ( diff --git a/cmd/ghuc/monitorcmd.go b/cmd/ghuc/monitorcmd.go index e9aba40d114d..717b1f770a75 100644 --- a/cmd/ghuc/monitorcmd.go +++ b/cmd/ghuc/monitorcmd.go @@ -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" ) diff --git a/cmd/ghuc/run_test.go b/cmd/ghuc/run_test.go index 0e159c2109c5..5a05c910cede 100644 --- a/cmd/ghuc/run_test.go +++ b/cmd/ghuc/run_test.go @@ -38,8 +38,8 @@ type testghuc struct { *cmdtest.TestCmd // template variables for expect - Datadir string - Coinbase string + Datadir string + Coinbase string } func init() { diff --git a/cmd/pupphuc/genesis.go b/cmd/pupphuc/genesis.go index 9108ea30c346..5bb48c458756 100644 --- a/cmd/pupphuc/genesis.go +++ b/cmd/pupphuc/genesis.go @@ -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"` @@ -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 { diff --git a/cmd/pupphuc/module_node.go b/cmd/pupphuc/module_node.go index cfe809f1d430..66663f55f891 100644 --- a/cmd/pupphuc/module_node.go +++ b/cmd/pupphuc/module_node.go @@ -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 != "", @@ -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, }) diff --git a/consensus/huchash/huchash.go b/consensus/huchash/huchash.go index fbb7984a8200..6eed944341e5 100644 --- a/consensus/huchash/huchash.go +++ b/consensus/huchash/huchash.go @@ -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 diff --git a/console/console_test.go b/console/console_test.go index 95529216a3f3..ec451b742620 100644 --- a/console/console_test.go +++ b/console/console_test.go @@ -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, }, } @@ -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(), diff --git a/contracts/chequebook/contract/chequebook.go b/contracts/chequebook/contract/chequebook.go index a1c3c877065f..736da90cfd6d 100644 --- a/contracts/chequebook/contract/chequebook.go +++ b/contracts/chequebook/contract/chequebook.go @@ -251,10 +251,10 @@ type ChequebookOverdraftIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events + logs chan types.Log // Log channel receiving the found contract events sub happyuc.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there diff --git a/contracts/ens/contract/ens.go b/contracts/ens/contract/ens.go index b5a401aab2b5..18ac6acd1c8c 100644 --- a/contracts/ens/contract/ens.go +++ b/contracts/ens/contract/ens.go @@ -344,10 +344,10 @@ type ENSNewOwnerIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events + logs chan types.Log // Log channel receiving the found contract events sub happyuc.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there @@ -486,10 +486,10 @@ type ENSNewResolverIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events + logs chan types.Log // Log channel receiving the found contract events sub happyuc.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there @@ -619,10 +619,10 @@ type ENSNewTTLIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events + logs chan types.Log // Log channel receiving the found contract events sub happyuc.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there @@ -752,10 +752,10 @@ type ENSTransferIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events + logs chan types.Log // Log channel receiving the found contract events sub happyuc.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there diff --git a/contracts/ens/contract/publicresolver.go b/contracts/ens/contract/publicresolver.go index c41852f4d267..f5b45be49a5d 100644 --- a/contracts/ens/contract/publicresolver.go +++ b/contracts/ens/contract/publicresolver.go @@ -511,10 +511,10 @@ type PublicResolverABIChangedIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events + logs chan types.Log // Log channel receiving the found contract events sub happyuc.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there @@ -652,10 +652,10 @@ type PublicResolverAddrChangedIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events + logs chan types.Log // Log channel receiving the found contract events sub happyuc.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there @@ -785,10 +785,10 @@ type PublicResolverContentChangedIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events + logs chan types.Log // Log channel receiving the found contract events sub happyuc.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there @@ -918,10 +918,10 @@ type PublicResolverNameChangedIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events + logs chan types.Log // Log channel receiving the found contract events sub happyuc.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there @@ -1051,10 +1051,10 @@ type PublicResolverPubkeyChangedIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events + logs chan types.Log // Log channel receiving the found contract events sub happyuc.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there @@ -1185,10 +1185,10 @@ type PublicResolverTextChangedIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events + logs chan types.Log // Log channel receiving the found contract events sub happyuc.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there diff --git a/core/blockchain.go b/core/blockchain.go index 6b8669cb541f..f64442e93c47 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -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" @@ -691,7 +691,7 @@ func (bc *BlockChain) procFutureBlocks() { type WriteStatus byte const ( - NonStatTy WriteStatus = iota + NonStatTy WriteStatus = iota CanonStatTy SideStatTy ) diff --git a/core/chain_indexer.go b/core/chain_indexer.go index 750cd53af6a8..e5d955143d92 100644 --- a/core/chain_indexer.go +++ b/core/chain_indexer.go @@ -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" ) diff --git a/core/database_util.go b/core/database_util.go index 7f85e502b7a1..da040f16aec7 100644 --- a/core/database_util.go +++ b/core/database_util.go @@ -59,7 +59,7 @@ var ( lookupPrefix = []byte("l") // lookupPrefix + hash -> transaction/receipt lookup metadata bloomBitsPrefix = []byte("B") // bloomBitsPrefix + bit (uint16 big endian) + section (uint64 big endian) + hash -> bloom bits - preimagePrefix = "secure-key-" // preimagePrefix + hash -> preimage + preimagePrefix = "secure-key-" // preimagePrefix + hash -> preimage configPrefix = []byte("happyuc-config-") // config prefix for the db // Chain index prefixes (use `i` + single byte to avoid mixing data types). diff --git a/core/genesis.go b/core/genesis.go index 75ce317a4e00..4fd761caf191 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -366,7 +366,7 @@ func DeveloperGenesisBlock(period uint64, faucet common.Address) *Genesis { common.BytesToAddress([]byte{6}): {Balance: big.NewInt(1)}, // ECAdd common.BytesToAddress([]byte{7}): {Balance: big.NewInt(1)}, // ECScalarMul common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, // ECPairing - faucet: {Balance: new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(9))}, + faucet: {Balance: new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(9))}, }, } } diff --git a/core/helper_test.go b/core/helper_test.go index 931a025a1bcc..4f62879afdf7 100644 --- a/core/helper_test.go +++ b/core/helper_test.go @@ -21,8 +21,8 @@ import ( "fmt" "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" ) // Implement our EthTest Manager diff --git a/core/tx_pool.go b/core/tx_pool.go index 86a24782fc1e..c09fa67b7558 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -107,7 +107,7 @@ var ( type TxStatus uint const ( - TxStatusUnknown TxStatus = iota + TxStatusUnknown TxStatus = iota TxStatusQueued TxStatusPending TxStatusIncluded diff --git a/core/tx_pool_test.go b/core/tx_pool_test.go index 9a6cb2c6fb4a..4dff01a524e3 100644 --- a/core/tx_pool_test.go +++ b/core/tx_pool_test.go @@ -30,8 +30,8 @@ import ( "github.com/happyuc-project/happyuc-go/core/state" "github.com/happyuc-project/happyuc-go/core/types" "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/params" ) diff --git a/core/types/gen_tx_json.go b/core/types/gen_tx_json.go index 7ad96353d572..07355f8b936c 100644 --- a/core/types/gen_tx_json.go +++ b/core/types/gen_tx_json.go @@ -22,10 +22,10 @@ func (t txdata) MarshalJSON() ([]byte, error) { Amount *hexutil.Big `json:"value" gencodec:"required"` Payload hexutil.Bytes `json:"input" gencodec:"required"` // Remark []byte `json:"remark" gencodec:"required"` // TODO support remark - V *hexutil.Big `json:"v" gencodec:"required"` - R *hexutil.Big `json:"r" gencodec:"required"` - S *hexutil.Big `json:"s" gencodec:"required"` - Hash *common.Hash `json:"hash" rlp:"-"` + V *hexutil.Big `json:"v" gencodec:"required"` + R *hexutil.Big `json:"r" gencodec:"required"` + S *hexutil.Big `json:"s" gencodec:"required"` + Hash *common.Hash `json:"hash" rlp:"-"` } var enc txdata enc.AccountNonce = hexutil.Uint64(t.AccountNonce) @@ -50,10 +50,10 @@ func (t *txdata) UnmarshalJSON(input []byte) error { Amount *hexutil.Big `json:"value" gencodec:"required"` Payload *hexutil.Bytes `json:"input" gencodec:"required"` // Remark []byte `json:"remark" gencodec:"required"` // TODO support remark - V *hexutil.Big `json:"v" gencodec:"required"` - R *hexutil.Big `json:"r" gencodec:"required"` - S *hexutil.Big `json:"s" gencodec:"required"` - Hash *common.Hash `json:"hash" rlp:"-"` + V *hexutil.Big `json:"v" gencodec:"required"` + R *hexutil.Big `json:"r" gencodec:"required"` + S *hexutil.Big `json:"s" gencodec:"required"` + Hash *common.Hash `json:"hash" rlp:"-"` } var dec txdata if err := json.Unmarshal(input, &dec); err != nil { diff --git a/core/types/transaction.go b/core/types/transaction.go index 90f39c74bf21..dd34a72313ba 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -292,9 +292,6 @@ func (tx *Transaction) String() string { GasPrice: %#x GasLimit %#x Value: %#x - V: %#x - R: %#x - S: %#x `, tx.Hash(), tx.data.Recipient == nil, @@ -305,9 +302,9 @@ func (tx *Transaction) String() string { tx.data.GasLimit, tx.data.Amount, // tx.data.Remark, - tx.data.V, - tx.data.R, - tx.data.S, + // tx.data.V, + // tx.data.R, + // tx.data.S, ) } diff --git a/core/vm/evm.go b/core/vm/evm.go index 5caafc2f8044..422aec5dc161 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -32,7 +32,7 @@ var emptyCodeHash = crypto.Keccak256Hash(nil) type ( CanTransferFunc func(StateDB, common.Address, *big.Int) bool - TransferFunc func(StateDB, common.Address, common.Address, *big.Int) + TransferFunc func(StateDB, common.Address, common.Address, *big.Int) // GetHashFunc returns the nth block hash in the blockchain // and is used by the BLOCKHASH EVM op code. GetHashFunc func(uint64) common.Hash diff --git a/huc/api_backend.go b/huc/api_backend.go index 8b556b26caf5..bcf49f88cbe2 100644 --- a/huc/api_backend.go +++ b/huc/api_backend.go @@ -28,10 +28,10 @@ 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/downloader" "github.com/happyuc-project/happyuc-go/huc/gasprice" "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" ) diff --git a/huc/backend.go b/huc/backend.go index 401eed22d52f..47cf5f83597c 100644 --- a/huc/backend.go +++ b/huc/backend.go @@ -35,11 +35,11 @@ import ( "github.com/happyuc-project/happyuc-go/core/bloombits" "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/downloader" "github.com/happyuc-project/happyuc-go/huc/filters" "github.com/happyuc-project/happyuc-go/huc/gasprice" "github.com/happyuc-project/happyuc-go/hucdb" - "github.com/happyuc-project/happyuc-go/event" "github.com/happyuc-project/happyuc-go/internal/hucapi" "github.com/happyuc-project/happyuc-go/log" "github.com/happyuc-project/happyuc-go/miner" @@ -84,8 +84,8 @@ type HappyUC struct { ApiBackend *HucApiBackend - miner *miner.Miner - gasPrice *big.Int + miner *miner.Miner + gasPrice *big.Int coinbase common.Address networkId uint64 diff --git a/huc/config.go b/huc/config.go index cf9a2c7a3900..b0006a4bf8a8 100644 --- a/huc/config.go +++ b/huc/config.go @@ -95,7 +95,7 @@ type Config struct { TrieTimeout time.Duration // Mining-related options - Coinbase common.Address `toml:",omitempty"` + Coinbase common.Address `toml:",omitempty"` MinerThreads int `toml:",omitempty"` ExtraData []byte `toml:",omitempty"` GasPrice *big.Int diff --git a/huc/downloader/api.go b/huc/downloader/api.go index d24995f95e98..19e584368730 100644 --- a/huc/downloader/api.go +++ b/huc/downloader/api.go @@ -121,7 +121,7 @@ func (api *PublicDownloaderAPI) Syncing(ctx context.Context) (*rpc.Subscription, // SyncingResult provides information about the current synchronisation status for this node. type SyncingResult struct { - Syncing bool `json:"syncing"` + Syncing bool `json:"syncing"` Status happyuc.SyncProgress `json:"status"` } diff --git a/huc/downloader/downloader.go b/huc/downloader/downloader.go index 6aa018dfb3f2..37cc5a805524 100644 --- a/huc/downloader/downloader.go +++ b/huc/downloader/downloader.go @@ -29,8 +29,8 @@ import ( "github.com/happyuc-project/happyuc-go/common" "github.com/happyuc-project/happyuc-go/core" "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" "github.com/happyuc-project/happyuc-go/metrics" "github.com/happyuc-project/happyuc-go/params" diff --git a/huc/downloader/downloader_test.go b/huc/downloader/downloader_test.go index b7e4fff2db41..576fbec31867 100644 --- a/huc/downloader/downloader_test.go +++ b/huc/downloader/downloader_test.go @@ -30,8 +30,8 @@ import ( "github.com/happyuc-project/happyuc-go/core" "github.com/happyuc-project/happyuc-go/core/types" "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/params" "github.com/happyuc-project/happyuc-go/trie" ) diff --git a/huc/filters/api.go b/huc/filters/api.go index 447ee1bdce94..4a6ad4d8fe7f 100644 --- a/huc/filters/api.go +++ b/huc/filters/api.go @@ -29,8 +29,8 @@ import ( "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/hucdb" "github.com/happyuc-project/happyuc-go/event" + "github.com/happyuc-project/happyuc-go/hucdb" "github.com/happyuc-project/happyuc-go/rpc" ) diff --git a/huc/filters/bench_test.go b/huc/filters/bench_test.go index e408d2de569e..533078441c7e 100644 --- a/huc/filters/bench_test.go +++ b/huc/filters/bench_test.go @@ -28,8 +28,8 @@ import ( "github.com/happyuc-project/happyuc-go/core" "github.com/happyuc-project/happyuc-go/core/bloombits" "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/node" ) diff --git a/huc/filters/filter.go b/huc/filters/filter.go index 6d4422a788cc..14e1a601ed25 100644 --- a/huc/filters/filter.go +++ b/huc/filters/filter.go @@ -24,8 +24,8 @@ import ( "github.com/happyuc-project/happyuc-go/core" "github.com/happyuc-project/happyuc-go/core/bloombits" "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/rpc" ) diff --git a/huc/filters/filter_system_test.go b/huc/filters/filter_system_test.go index 753ff65d2ad8..8c576b829a59 100644 --- a/huc/filters/filter_system_test.go +++ b/huc/filters/filter_system_test.go @@ -31,8 +31,8 @@ import ( "github.com/happyuc-project/happyuc-go/core" "github.com/happyuc-project/happyuc-go/core/bloombits" "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/params" "github.com/happyuc-project/happyuc-go/rpc" ) diff --git a/huc/filters/filter_test.go b/huc/filters/filter_test.go index 1b6f1ea1d40b..3ec708b7f8b8 100644 --- a/huc/filters/filter_test.go +++ b/huc/filters/filter_test.go @@ -28,8 +28,8 @@ import ( "github.com/happyuc-project/happyuc-go/core" "github.com/happyuc-project/happyuc-go/core/types" "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/params" ) diff --git a/huc/handler.go b/huc/handler.go index c616cd45db42..4e409b5f336c 100644 --- a/huc/handler.go +++ b/huc/handler.go @@ -31,10 +31,10 @@ import ( "github.com/happyuc-project/happyuc-go/consensus/misc" "github.com/happyuc-project/happyuc-go/core" "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/huc/fetcher" "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/p2p" "github.com/happyuc-project/happyuc-go/p2p/discover" diff --git a/huc/handler_test.go b/huc/handler_test.go index 0e625f4e00e6..934de4a19dc9 100644 --- a/huc/handler_test.go +++ b/huc/handler_test.go @@ -30,9 +30,9 @@ 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/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/p2p" "github.com/happyuc-project/happyuc-go/params" ) diff --git a/huc/helper_test.go b/huc/helper_test.go index a417e8d1df3c..cafa968d5c83 100644 --- a/huc/helper_test.go +++ b/huc/helper_test.go @@ -33,9 +33,9 @@ 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/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/p2p" "github.com/happyuc-project/happyuc-go/p2p/discover" "github.com/happyuc-project/happyuc-go/params" diff --git a/huc/tracers/tracers_test.go b/huc/tracers/tracers_test.go index 579d6d739529..eaeb32bdda07 100644 --- a/huc/tracers/tracers_test.go +++ b/huc/tracers/tracers_test.go @@ -36,7 +36,6 @@ import ( "github.com/happyuc-project/happyuc-go/tests" ) - // callTrace is the result of a callTracer run. type callTrace struct { Type string `json:"type"` diff --git a/hucstats/hucstats.go b/hucstats/hucstats.go index 88806fafce5f..efd52a889774 100644 --- a/hucstats/hucstats.go +++ b/hucstats/hucstats.go @@ -35,8 +35,8 @@ import ( "github.com/happyuc-project/happyuc-go/consensus" "github.com/happyuc-project/happyuc-go/core" "github.com/happyuc-project/happyuc-go/core/types" - "github.com/happyuc-project/happyuc-go/huc" "github.com/happyuc-project/happyuc-go/event" + "github.com/happyuc-project/happyuc-go/huc" "github.com/happyuc-project/happyuc-go/les" "github.com/happyuc-project/happyuc-go/log" "github.com/happyuc-project/happyuc-go/p2p" diff --git a/internal/hucapi/backend.go b/internal/hucapi/backend.go index 18f612033c7b..2ed7db5101bb 100644 --- a/internal/hucapi/backend.go +++ b/internal/hucapi/backend.go @@ -27,9 +27,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/downloader" "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" ) diff --git a/internal/jsre/jsre.go b/internal/jsre/jsre.go index 9ab45bcb2f9c..d67625e4f34b 100644 --- a/internal/jsre/jsre.go +++ b/internal/jsre/jsre.go @@ -77,7 +77,7 @@ func New(assetPath string, output io.Writer) *JSRE { } go re.runEventLoop() re.Set("loadScript", re.loadScript) - re.Set("inspect" , re.prettyPrintJS) + re.Set("inspect", re.prettyPrintJS) return re } @@ -225,7 +225,7 @@ loop: // Do executes the given function on the JS event loop. func (self *JSRE) Do(fn func(*otto.Otto)) { done := make(chan bool) - req := &evalReq{fn, done} + req := &evalReq{fn, done} self.evalQueue <- req <-done } diff --git a/internal/jsre/jsre_test.go b/internal/jsre/jsre_test.go index 6b7449debc54..fdb7a258faf5 100644 --- a/internal/jsre/jsre_test.go +++ b/internal/jsre/jsre_test.go @@ -137,5 +137,5 @@ func TestLoadScript(t *testing.T) { } func TestBin2String() { - + } diff --git a/les/api_backend.go b/les/api_backend.go index 7a16870be3a3..45ef3b15d95f 100644 --- a/les/api_backend.go +++ b/les/api_backend.go @@ -28,10 +28,10 @@ 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/downloader" "github.com/happyuc-project/happyuc-go/huc/gasprice" "github.com/happyuc-project/happyuc-go/hucdb" - "github.com/happyuc-project/happyuc-go/event" "github.com/happyuc-project/happyuc-go/light" "github.com/happyuc-project/happyuc-go/params" "github.com/happyuc-project/happyuc-go/rpc" diff --git a/les/backend.go b/les/backend.go index 15136f96907e..cb3fcdb33cfa 100644 --- a/les/backend.go +++ b/les/backend.go @@ -29,12 +29,12 @@ import ( "github.com/happyuc-project/happyuc-go/core" "github.com/happyuc-project/happyuc-go/core/bloombits" "github.com/happyuc-project/happyuc-go/core/types" + "github.com/happyuc-project/happyuc-go/event" "github.com/happyuc-project/happyuc-go/huc" "github.com/happyuc-project/happyuc-go/huc/downloader" "github.com/happyuc-project/happyuc-go/huc/filters" "github.com/happyuc-project/happyuc-go/huc/gasprice" "github.com/happyuc-project/happyuc-go/hucdb" - "github.com/happyuc-project/happyuc-go/event" "github.com/happyuc-project/happyuc-go/internal/hucapi" "github.com/happyuc-project/happyuc-go/light" "github.com/happyuc-project/happyuc-go/log" diff --git a/les/handler.go b/les/handler.go index dadc4167a140..c7a1558d7ebb 100644 --- a/les/handler.go +++ b/les/handler.go @@ -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/light" "github.com/happyuc-project/happyuc-go/log" "github.com/happyuc-project/happyuc-go/p2p" diff --git a/les/handler_test.go b/les/handler_test.go index eadefc5fb189..8df753fd84e6 100644 --- a/les/handler_test.go +++ b/les/handler_test.go @@ -383,7 +383,7 @@ func testGetCHTProofs(t *testing.T, protocol int) { frequency = uint64(light.CHTFrequencyServer) } // Assemble the test environment - db, _ :=hucdb.NewMemDatabase() + db, _ := hucdb.NewMemDatabase() pm := newTestProtocolManagerMust(t, false, int(frequency)+light.HelperTrieProcessConfirmations, testChainGen, nil, nil, db) bc := pm.blockchain.(*core.BlockChain) peer, _ := newTestPeer(t, "peer", protocol, pm, true) diff --git a/les/helper_test.go b/les/helper_test.go index 987d34cac133..1913142395a8 100644 --- a/les/helper_test.go +++ b/les/helper_test.go @@ -31,9 +31,9 @@ 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/event" "github.com/happyuc-project/happyuc-go/huc" "github.com/happyuc-project/happyuc-go/hucdb" - "github.com/happyuc-project/happyuc-go/event" "github.com/happyuc-project/happyuc-go/les/flowcontrol" "github.com/happyuc-project/happyuc-go/light" "github.com/happyuc-project/happyuc-go/p2p" diff --git a/light/lightchain.go b/light/lightchain.go index 453063511698..3f9dd2ad00e0 100644 --- a/light/lightchain.go +++ b/light/lightchain.go @@ -29,8 +29,8 @@ 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/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/params" "github.com/happyuc-project/happyuc-go/rlp" diff --git a/light/postprocess.go b/light/postprocess.go index 4a9bf7f0955a..67c0d6f00fa4 100644 --- a/light/postprocess.go +++ b/light/postprocess.go @@ -27,7 +27,7 @@ import ( "github.com/happyuc-project/happyuc-go/core" "github.com/happyuc-project/happyuc-go/core/types" "github.com/happyuc-project/happyuc-go/hucdb" - "github.com/happyuc-project/happyuc-go/log" + "github.com/happyuc-project/happyuc-go/log" "github.com/happyuc-project/happyuc-go/params" "github.com/happyuc-project/happyuc-go/rlp" "github.com/happyuc-project/happyuc-go/trie" diff --git a/light/txpool.go b/light/txpool.go index fc1b14873612..1a45df370cae 100644 --- a/light/txpool.go +++ b/light/txpool.go @@ -26,8 +26,8 @@ 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/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/params" "github.com/happyuc-project/happyuc-go/rlp" diff --git a/log/logger.go b/log/logger.go index 4152110e5045..1a04e4ee9bde 100644 --- a/log/logger.go +++ b/log/logger.go @@ -16,7 +16,7 @@ const errorKey = "LOG15_ERROR" type Lvl int const ( - LvlCrit Lvl = iota + LvlCrit Lvl = iota LvlError LvlWarn LvlInfo diff --git a/miner/agent.go b/miner/agent.go index 3ecd658a353d..89757b2d42a3 100644 --- a/miner/agent.go +++ b/miner/agent.go @@ -58,7 +58,7 @@ func (self *CpuAgent) Stop() { } self.stop <- struct{}{} done: -// Empty work channel + // Empty work channel for { select { case <-self.workCh: diff --git a/miner/miner.go b/miner/miner.go index 83961af840d7..ca1fd96af400 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -27,9 +27,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/params" ) diff --git a/miner/worker.go b/miner/worker.go index b976a0e927be..6a2133c0d878 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -31,8 +31,8 @@ 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/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/params" "gopkg.in/fatih/set.v0" diff --git a/mobile/ghuc.go b/mobile/ghuc.go index 50ec3d1154cd..e2354a89a15b 100644 --- a/mobile/ghuc.go +++ b/mobile/ghuc.go @@ -77,8 +77,8 @@ type NodeConfig struct { // defaultNodeConfig contains the default node configuration values to use if all // or some fields are missing from the user's specified list. var defaultNodeConfig = &NodeConfig{ - BootstrapNodes: FoundationBootnodes(), - MaxPeers: 25, + BootstrapNodes: FoundationBootnodes(), + MaxPeers: 25, HappyUCEnabled: true, HappyUCNetworkID: 1, HappyUCDatabaseCache: 16, diff --git a/node/node.go b/node/node.go index 4318cd6713d3..880ca3198b30 100644 --- a/node/node.go +++ b/node/node.go @@ -27,8 +27,8 @@ import ( "sync" "github.com/happyuc-project/happyuc-go/accounts" - "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/internal/debug" "github.com/happyuc-project/happyuc-go/log" "github.com/happyuc-project/happyuc-go/p2p" diff --git a/node/service.go b/node/service.go index c5e20d638627..17b384f88895 100644 --- a/node/service.go +++ b/node/service.go @@ -20,8 +20,8 @@ import ( "reflect" "github.com/happyuc-project/happyuc-go/accounts" - "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/p2p" "github.com/happyuc-project/happyuc-go/rpc" ) diff --git a/p2p/rlpx.go b/p2p/rlpx.go index 16add2ba491b..59c4440bbd7a 100644 --- a/p2p/rlpx.go +++ b/p2p/rlpx.go @@ -35,13 +35,13 @@ import ( "sync" "time" + "github.com/golang/snappy" "github.com/happyuc-project/happyuc-go/crypto" "github.com/happyuc-project/happyuc-go/crypto/ecies" "github.com/happyuc-project/happyuc-go/crypto/secp256k1" "github.com/happyuc-project/happyuc-go/crypto/sha3" "github.com/happyuc-project/happyuc-go/p2p/discover" "github.com/happyuc-project/happyuc-go/rlp" - "github.com/golang/snappy" ) const ( diff --git a/p2p/server.go b/p2p/server.go index 69727ee311cd..5d0a0cf5b377 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -188,7 +188,7 @@ type peerDrop struct { type connFlag int const ( - dynDialedConn connFlag = 1 << iota + dynDialedConn connFlag = 1 << iota staticDialedConn inboundConn trustedConn @@ -197,7 +197,7 @@ const ( // conn wraps a network connection with information gathered // during the two handshakes. type conn struct { - fd net.Conn + fd net.Conn transport flags connFlag cont chan error // The run loop uses cont to signal errors to SetupConn. @@ -705,7 +705,7 @@ func (srv *Server) protoHandshakeChecks(peers map[discover.NodeID]*Peer, inbound func (srv *Server) encHandshakeChecks(peers map[discover.NodeID]*Peer, inboundCount int, c *conn) error { switch { - case !c.is(trustedConn | staticDialedConn) && len(peers) >= srv.MaxPeers: + case !c.is(trustedConn|staticDialedConn) && len(peers) >= srv.MaxPeers: return DiscTooManyPeers case !c.is(trustedConn) && c.is(inboundConn) && inboundCount >= srv.maxInboundConns(): return DiscTooManyPeers diff --git a/params/config.go b/params/config.go index 146d39f7dcff..8b777d2f85a9 100644 --- a/params/config.go +++ b/params/config.go @@ -24,7 +24,7 @@ import ( ) var ( - MainnetGenesisHash = common.HexToHash("0x5edb680bd141442fff52006a8db1526a32e0f72f57ef5f285f3e032af5bdacb5") // Mainnet genesis hash to enforce below configs on + MainnetGenesisHash = common.HexToHash("0xf29c3da3e1710517cbb3a555ab20981ec2c9abacbbcb914ab91e8c23edfbf4d0") // Mainnet genesis hash to enforce below configs on TestnetGenesisHash = common.HexToHash("0x389d168191585e7a14b01a654c02058053abf3ca3d167efb69a51dec86d9cfbc") // Testnet genesis hash to enforce below configs on ) diff --git a/rlp/decode.go b/rlp/decode.go index 253011221839..0283ac8467ae 100644 --- a/rlp/decode.go +++ b/rlp/decode.go @@ -539,7 +539,7 @@ func decodeDecoder(s *Stream, val reflect.Value) error { type Kind int const ( - Byte Kind = iota + Byte Kind = iota String List ) diff --git a/vendor/gopkg.in/check.v1/benchmark.go b/vendor/gopkg.in/check.v1/benchmark.go index 46ea9dc6dad6..b2d351948d22 100644 --- a/vendor/gopkg.in/check.v1/benchmark.go +++ b/vendor/gopkg.in/check.v1/benchmark.go @@ -1,9 +1,9 @@ // Copyright (c) 2012 The Go Authors. All rights reserved. -// +// // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: -// +// // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above @@ -13,7 +13,7 @@ // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/whisper/whisperv6/peer_test.go b/whisper/whisperv6/peer_test.go index bf8f652131ee..88ee59ffd95e 100644 --- a/whisper/whisperv6/peer_test.go +++ b/whisper/whisperv6/peer_test.go @@ -1,5 +1,3 @@ - - // Copyright 2016 The happyuc-go Authors // This file is part of the happyuc-go library. // From 6dbad08625b16189783a511fc9c935e6f6662e32 Mon Sep 17 00:00:00 2001 From: ldcc Date: Wed, 23 May 2018 20:38:09 +0800 Subject: [PATCH 8/9] debug --- build/env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/env.sh b/build/env.sh index adc73fbe26c7..85a3308e1e4b 100755 --- a/build/env.sh +++ b/build/env.sh @@ -1,4 +1,4 @@ -#!/bin/sh\ +#!/bin/sh set -e From ff5bcbafa9c05fd8ddbce57baff8fa95112e3b89 Mon Sep 17 00:00:00 2001 From: ldcc Date: Fri, 25 May 2018 12:05:18 +0800 Subject: [PATCH 9/9] without print when tx adds --- core/tx_pool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tx_pool.go b/core/tx_pool.go index c09fa67b7558..c13d446d9c78 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -619,7 +619,7 @@ func (pool *TxPool) journalTx(from common.Address, tx *types.Transaction) { // whitelisted, preventing any associated transaction from being dropped out of // the pool due to pricing constraints. func (pool *TxPool) add(tx *types.Transaction, local bool) (bool, error) { - fmt.Println("add tx:", tx) + // fmt.Println("add tx:", tx) // If the transaction is already known, discard it hash := tx.Hash() if pool.all[hash] != nil {