diff options
-rw-r--r-- | accounts/keystore/key.go | 8 | ||||
-rw-r--r-- | accounts/keystore/keystore_passphrase.go | 4 | ||||
-rw-r--r-- | accounts/usbwallet/ledger_hub.go | 9 | ||||
-rw-r--r-- | common/bitutil/compress_test.go | 8 | ||||
-rw-r--r-- | common/hexutil/json.go | 9 | ||||
-rw-r--r-- | console/console_test.go | 2 | ||||
-rw-r--r-- | core/tx_pool_test.go | 4 | ||||
-rw-r--r-- | log/format.go | 2 |
8 files changed, 17 insertions, 29 deletions
diff --git a/accounts/keystore/key.go b/accounts/keystore/key.go index ecc955d74..211fa863d 100644 --- a/accounts/keystore/key.go +++ b/accounts/keystore/key.go @@ -91,14 +91,6 @@ type cipherparamsJSON struct { IV string `json:"iv"` } -type scryptParamsJSON struct { - N int `json:"n"` - R int `json:"r"` - P int `json:"p"` - DkLen int `json:"dklen"` - Salt string `json:"salt"` -} - func (k *Key) MarshalJSON() (j []byte, err error) { jStruct := plainKeyJSON{ hex.EncodeToString(k.Address[:]), diff --git a/accounts/keystore/keystore_passphrase.go b/accounts/keystore/keystore_passphrase.go index 679fc15d6..535608a60 100644 --- a/accounts/keystore/keystore_passphrase.go +++ b/accounts/keystore/keystore_passphrase.go @@ -140,7 +140,7 @@ func EncryptKey(key *Key, auth string, scryptN, scryptP int) ([]byte, error) { Cipher: "aes-128-ctr", CipherText: hex.EncodeToString(cipherText), CipherParams: cipherParamsJSON, - KDF: "scrypt", + KDF: keyHeaderKDF, KDFParams: scryptParamsJSON, MAC: hex.EncodeToString(mac), } @@ -275,7 +275,7 @@ func getKDFKey(cryptoJSON cryptoJSON, auth string) ([]byte, error) { } dkLen := ensureInt(cryptoJSON.KDFParams["dklen"]) - if cryptoJSON.KDF == "scrypt" { + if cryptoJSON.KDF == keyHeaderKDF { n := ensureInt(cryptoJSON.KDFParams["n"]) r := ensureInt(cryptoJSON.KDFParams["r"]) p := ensureInt(cryptoJSON.KDFParams["p"]) diff --git a/accounts/usbwallet/ledger_hub.go b/accounts/usbwallet/ledger_hub.go index fcbc24c0f..2b0d56097 100644 --- a/accounts/usbwallet/ledger_hub.go +++ b/accounts/usbwallet/ledger_hub.go @@ -197,11 +197,10 @@ func (hub *LedgerHub) Subscribe(sink chan<- accounts.WalletEvent) event.Subscrip // is not running). func (hub *LedgerHub) updater() { for { - // Wait for a USB hotplug event (not supported yet) or a refresh timeout - select { - //case <-hub.changes: // reenable on hutplug implementation - case <-time.After(ledgerRefreshCycle): - } + // TODO: Wait for a USB hotplug event (not supported yet) or a refresh timeout + // <-hub.changes + time.Sleep(ledgerRefreshCycle) + // Run the wallet refresher hub.refreshWallets() diff --git a/common/bitutil/compress_test.go b/common/bitutil/compress_test.go index 805ab0369..9bd1de103 100644 --- a/common/bitutil/compress_test.go +++ b/common/bitutil/compress_test.go @@ -121,20 +121,20 @@ func TestCompression(t *testing.T) { in := hexutil.MustDecode("0x4912385c0e7b64000000") out := hexutil.MustDecode("0x80fe4912385c0e7b64") - if data := CompressBytes(in); bytes.Compare(data, out) != 0 { + if data := CompressBytes(in); !bytes.Equal(data, out) { t.Errorf("encoding mismatch for sparse data: have %x, want %x", data, out) } - if data, err := DecompressBytes(out, len(in)); err != nil || bytes.Compare(data, in) != 0 { + if data, err := DecompressBytes(out, len(in)); err != nil || !bytes.Equal(data, in) { t.Errorf("decoding mismatch for sparse data: have %x, want %x, error %v", data, in, err) } // Check the the compression returns the input if the bitset encoding is longer in = hexutil.MustDecode("0xdf7070533534333636313639343638373532313536346c1bc33339343837313070706336343035336336346c65fefb3930393233383838ac2f65fefb") out = hexutil.MustDecode("0xdf7070533534333636313639343638373532313536346c1bc33339343837313070706336343035336336346c65fefb3930393233383838ac2f65fefb") - if data := CompressBytes(in); bytes.Compare(data, out) != 0 { + if data := CompressBytes(in); !bytes.Equal(data, out) { t.Errorf("encoding mismatch for dense data: have %x, want %x", data, out) } - if data, err := DecompressBytes(out, len(in)); err != nil || bytes.Compare(data, in) != 0 { + if data, err := DecompressBytes(out, len(in)); err != nil || !bytes.Equal(data, in) { t.Errorf("decoding mismatch for dense data: have %x, want %x, error %v", data, in, err) } // Check that decompressing a longer input than the target fails diff --git a/common/hexutil/json.go b/common/hexutil/json.go index 943288fad..11e14cae7 100644 --- a/common/hexutil/json.go +++ b/common/hexutil/json.go @@ -26,11 +26,10 @@ import ( ) var ( - textZero = []byte(`0x0`) - bytesT = reflect.TypeOf(Bytes(nil)) - bigT = reflect.TypeOf((*Big)(nil)) - uintT = reflect.TypeOf(Uint(0)) - uint64T = reflect.TypeOf(Uint64(0)) + bytesT = reflect.TypeOf(Bytes(nil)) + bigT = reflect.TypeOf((*Big)(nil)) + uintT = reflect.TypeOf(Uint(0)) + uint64T = reflect.TypeOf(Uint64(0)) ) // Bytes marshals/unmarshals as a JSON string with 0x prefix. diff --git a/console/console_test.go b/console/console_test.go index 0fc0e7051..8ac499bd1 100644 --- a/console/console_test.go +++ b/console/console_test.go @@ -77,8 +77,6 @@ type tester struct { console *Console input *hookedPrompter output *bytes.Buffer - - lastConfirm string } // newTester creates a test environment based on which the console can operate. diff --git a/core/tx_pool_test.go b/core/tx_pool_test.go index 80bc0b384..9a03caf61 100644 --- a/core/tx_pool_test.go +++ b/core/tx_pool_test.go @@ -750,14 +750,14 @@ func TestTransactionQueueTimeLimitingNoLocals(t *testing.T) { testTransactionQue func testTransactionQueueTimeLimiting(t *testing.T, nolocals bool) { // Reduce the eviction interval to a testable amount defer func(old time.Duration) { evictionInterval = old }(evictionInterval) - evictionInterval = 250 * time.Millisecond + evictionInterval = time.Second // Create the pool to test the non-expiration enforcement db, _ := ethdb.NewMemDatabase() statedb, _ := state.New(common.Hash{}, state.NewDatabase(db)) config := testTxPoolConfig - config.Lifetime = 250 * time.Millisecond + config.Lifetime = time.Second config.NoLocals = nolocals pool := NewTxPool(config, params.TestChainConfig, new(event.TypeMux), func() (*state.StateDB, error) { return statedb, nil }, func() *big.Int { return big.NewInt(1000000) }) diff --git a/log/format.go b/log/format.go index 6c19c7a55..0b07abb2a 100644 --- a/log/format.go +++ b/log/format.go @@ -330,7 +330,7 @@ func escapeString(s string) string { needsEscape = true } } - if needsEscape == false && needsQuotes == false { + if !needsEscape && !needsQuotes { return s } e := stringBufPool.Get().(*bytes.Buffer) |