From c4e084b0d857f7f11e489a55e21ee3065b4bc18a Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 12 May 2021 22:51:41 +0300 Subject: [PATCH] *: fix whitespace errors leading/trailing newlines --- cli/wallet/legacy.go | 1 - cli/wallet/legacy_test.go | 1 - cli/wallet/nep11.go | 1 - internal/testchain/transaction.go | 1 - pkg/compiler/codegen.go | 1 - pkg/compiler/vm_test.go | 1 - pkg/consensus/consensus.go | 1 - pkg/core/block/block_test.go | 1 - pkg/core/blockchain.go | 1 - pkg/core/blockchain_test.go | 1 - pkg/core/mpt/batch.go | 1 - pkg/core/native/management.go | 1 - pkg/core/native/name_service.go | 1 - pkg/core/native/native_neo.go | 1 - pkg/core/native/util.go | 1 - pkg/core/native_designate_test.go | 1 - pkg/core/native_management_test.go | 1 - pkg/core/native_name_service_test.go | 1 - pkg/core/native_neo_test.go | 1 - pkg/core/state/notification_event_test.go | 1 - pkg/core/state/oracle_test.go | 1 - pkg/crypto/keys/nep2_test.go | 1 - pkg/crypto/keys/publickey.go | 1 - pkg/encoding/fixedn/fixed8_test.go | 1 - pkg/io/binaryWriter.go | 1 - pkg/network/payload/getblocks.go | 1 - pkg/network/server.go | 1 - pkg/network/server_test.go | 1 - pkg/rpc/client/wsclient.go | 1 - pkg/rpc/response/errors.go | 1 - pkg/rpc/server/server.go | 1 - pkg/rpc/server/server_test.go | 1 - pkg/rpc/server/subscription_test.go | 1 - pkg/services/oracle/neofs/neofs_test.go | 1 - pkg/services/oracle/transaction.go | 1 - pkg/vm/vm_test.go | 1 - 36 files changed, 36 deletions(-) diff --git a/cli/wallet/legacy.go b/cli/wallet/legacy.go index 3ddbd6e5f..bace1cef9 100644 --- a/cli/wallet/legacy.go +++ b/cli/wallet/legacy.go @@ -156,7 +156,6 @@ func parseMultisigContract(script []byte) (int, keys.PublicKeys, bool) { return 0, nil, false } ret[i] = pub - } return nsigs, ret, true } diff --git a/cli/wallet/legacy_test.go b/cli/wallet/legacy_test.go index af952fff5..7195bc81a 100644 --- a/cli/wallet/legacy_test.go +++ b/cli/wallet/legacy_test.go @@ -94,7 +94,6 @@ func TestParseMultisigContract(t *testing.T) { } }) }) - } func fromHex(t *testing.T, s string) []byte { diff --git a/cli/wallet/nep11.go b/cli/wallet/nep11.go index fe92ce857..7481fdb6f 100644 --- a/cli/wallet/nep11.go +++ b/cli/wallet/nep11.go @@ -226,7 +226,6 @@ func getNEP11Balance(ctx *cli.Context) error { } fmt.Fprintf(ctx.App.Writer, format, formatArgs...) fmt.Fprintf(ctx.App.Writer, "\tAmount : %s\n", amountStr) - } return nil } diff --git a/internal/testchain/transaction.go b/internal/testchain/transaction.go index 04363f7cd..bf8cfc685 100644 --- a/internal/testchain/transaction.go +++ b/internal/testchain/transaction.go @@ -79,7 +79,6 @@ func NewDeployTx(bc blockchainer.Blockchainer, name string, sender util.Uint160, o.ContractEvents = conf.Events o.ContractSupportedStandards = conf.SupportedStandards o.SafeMethods = conf.SafeMethods - } m, err := compiler.CreateManifest(di, o) if err != nil { diff --git a/pkg/compiler/codegen.go b/pkg/compiler/codegen.go index f80311da5..14a456165 100644 --- a/pkg/compiler/codegen.go +++ b/pkg/compiler/codegen.go @@ -473,7 +473,6 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor { return nil } switch n := node.(type) { - // General declarations. // var ( // x = 2 diff --git a/pkg/compiler/vm_test.go b/pkg/compiler/vm_test.go index 4752ef708..6545dcf73 100644 --- a/pkg/compiler/vm_test.go +++ b/pkg/compiler/vm_test.go @@ -109,7 +109,6 @@ func newStoragePlugin() *storagePlugin { s.interops[interopnames.ToID([]byte(interopnames.SystemRuntimeNotify))] = s.Notify s.interops[interopnames.ToID([]byte(interopnames.SystemRuntimeGetTime))] = s.GetTime return s - } func (s *storagePlugin) syscallHandler(v *vm.VM, id uint32) error { diff --git a/pkg/consensus/consensus.go b/pkg/consensus/consensus.go index 9bb26483a..3321bb8c0 100644 --- a/pkg/consensus/consensus.go +++ b/pkg/consensus/consensus.go @@ -309,7 +309,6 @@ events: s.handleChainBlock(b) default: } - } close(s.finished) } diff --git a/pkg/core/block/block_test.go b/pkg/core/block/block_test.go index b8042f3ef..834ca0620 100644 --- a/pkg/core/block/block_test.go +++ b/pkg/core/block/block_test.go @@ -239,7 +239,6 @@ func TestBlockEncodeDecode(t *testing.T) { func TestGetExpectedBlockSize(t *testing.T) { check := func(t *testing.T, stateRootEnabled bool) { - t.Run("without transactions", func(t *testing.T) { b := newDumbBlock() b.StateRootEnabled = stateRootEnabled diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 566626c63..9aeb78a93 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -1600,7 +1600,6 @@ func (bc *Blockchain) IsTxStillRelevant(t *transaction.Transaction, txpool *memp return bc.verifyTxWitnesses(t, nil, isPartialTx) == nil } return true - } // VerifyTx verifies whether transaction is bonafide or not relative to the diff --git a/pkg/core/blockchain_test.go b/pkg/core/blockchain_test.go index 3bbf4b043..6393016d1 100644 --- a/pkg/core/blockchain_test.go +++ b/pkg/core/blockchain_test.go @@ -1529,7 +1529,6 @@ func testDumpAndRestore(t *testing.T, dumpF, restoreF func(c *config.Config)) { require.Equal(t, bc.BlockHeight()-1, lastIndex) }) }) - } func TestDumpAndRestore(t *testing.T) { diff --git a/pkg/core/mpt/batch.go b/pkg/core/mpt/batch.go index 7a9409151..5c9287413 100644 --- a/pkg/core/mpt/batch.go +++ b/pkg/core/mpt/batch.go @@ -208,7 +208,6 @@ func (t *Trie) newSubTrieMany(prefix []byte, kv []keyValue, value []byte) (Node, if len(kv[0].value) == 0 { if len(kv) == 1 { return new(HashNode), 1, nil - } node, n, err := t.newSubTrieMany(prefix, kv[1:], nil) return node, n + 1, err diff --git a/pkg/core/native/management.go b/pkg/core/native/management.go index 2a1bc77d5..01aeab5b5 100644 --- a/pkg/core/native/management.go +++ b/pkg/core/native/management.go @@ -539,7 +539,6 @@ func (m *Management) getNextContractID(d dao.DAO) (int32, error) { si := d.GetStorageItem(m.ID, keyNextAvailableID) if si == nil { return 0, errors.New("nextAvailableID is not initialized") - } id := bigint.FromBytes(si) ret := int32(id.Int64()) diff --git a/pkg/core/native/name_service.go b/pkg/core/native/name_service.go index 7e3893f90..4116d1fbc 100644 --- a/pkg/core/native/name_service.go +++ b/pkg/core/native/name_service.go @@ -626,7 +626,6 @@ func domainFromString(name string) (string, bool) { return name, true } return name[i+1:], true - } func toDomain(name string) string { diff --git a/pkg/core/native/native_neo.go b/pkg/core/native/native_neo.go index 0580680fa..1a6af1a16 100644 --- a/pkg/core/native/native_neo.go +++ b/pkg/core/native/native_neo.go @@ -337,7 +337,6 @@ func (n *NEO) PostPersist(ic *interop.Context) error { } } } - } if n.gasPerBlockChanged.Load().(bool) { gr, err := n.getSortedGASRecordFromDAO(ic.DAO) diff --git a/pkg/core/native/util.go b/pkg/core/native/util.go index 73ac7f316..c882762cb 100644 --- a/pkg/core/native/util.go +++ b/pkg/core/native/util.go @@ -42,7 +42,6 @@ func getIntWithKey(id int32, dao dao.DAO, key []byte) int64 { si := dao.GetStorageItem(id, key) if si == nil { panic(fmt.Errorf("item with id = %d and key = %s is not initialized", id, hex.EncodeToString(key))) - } return bigint.FromBytes(si).Int64() } diff --git a/pkg/core/native_designate_test.go b/pkg/core/native_designate_test.go index 6f8bacb7f..0846a8a2c 100644 --- a/pkg/core/native_designate_test.go +++ b/pkg/core/native_designate_test.go @@ -116,7 +116,6 @@ func TestDesignate_DesignateAsRoleTx(t *testing.T) { bc.setNodesByRole(t, true, noderoles.NeoFSAlphabet, pubs) bc.getNodesByRole(t, true, noderoles.NeoFSAlphabet, bc.BlockHeight()+1, 1) }) - } func TestDesignate_DesignateAsRole(t *testing.T) { diff --git a/pkg/core/native_management_test.go b/pkg/core/native_management_test.go index b0f441e68..355a57e37 100644 --- a/pkg/core/native_management_test.go +++ b/pkg/core/native_management_test.go @@ -577,7 +577,6 @@ func TestContractDestroy(t *testing.T) { t.Run("check contract", func(t *testing.T) { checkContractState(t, bc, cs1.Hash, nil) }) - }) } diff --git a/pkg/core/native_name_service_test.go b/pkg/core/native_name_service_test.go index a428b48dc..8c394f86b 100644 --- a/pkg/core/native_name_service_test.go +++ b/pkg/core/native_name_service_test.go @@ -120,7 +120,6 @@ func TestExpiration(t *testing.T) { aer, err = bc.GetAppExecResults(tx.Hash(), trigger.Application) require.NoError(t, err) checkResult(t, &aer[0], stackitem.Null{}) - } const secondsInYear = 365 * 24 * 3600 diff --git a/pkg/core/native_neo_test.go b/pkg/core/native_neo_test.go index 19207137b..5050681da 100644 --- a/pkg/core/native_neo_test.go +++ b/pkg/core/native_neo_test.go @@ -226,7 +226,6 @@ func TestNEO_CalculateBonus(t *testing.T) { res, err := neo.CalculateNEOHolderReward(ic.DAO, big.NewInt(100), 5, 15) require.NoError(t, err) require.EqualValues(t, (100*5*5/10)+(100*5*1/10), res.Int64()) - }) } diff --git a/pkg/core/state/notification_event_test.go b/pkg/core/state/notification_event_test.go index 99defd0d9..2429b7c81 100644 --- a/pkg/core/state/notification_event_test.go +++ b/pkg/core/state/notification_event_test.go @@ -116,7 +116,6 @@ func TestMarshalUnmarshalJSONNotificationEvent(t *testing.T) { err := json.Unmarshal([]byte(errCase), new(NotificationEvent)) require.Error(t, err) } - }) } diff --git a/pkg/core/state/oracle_test.go b/pkg/core/state/oracle_test.go index 3c3a3abe2..dc0a9ed12 100644 --- a/pkg/core/state/oracle_test.go +++ b/pkg/core/state/oracle_test.go @@ -76,5 +76,4 @@ func TestOracleRequest_EncodeBinary(t *testing.T) { t.Run("Method", runInvalid(5, stackitem.NewMap())) t.Run("UserData", runInvalid(6, stackitem.NewMap())) }) - } diff --git a/pkg/crypto/keys/nep2_test.go b/pkg/crypto/keys/nep2_test.go index 218ab050a..78de1f5c6 100644 --- a/pkg/crypto/keys/nep2_test.go +++ b/pkg/crypto/keys/nep2_test.go @@ -9,7 +9,6 @@ import ( func TestNEP2Encrypt(t *testing.T) { for _, testCase := range keytestcases.Arr { - privKey, err := NewPrivateKeyFromHex(testCase.PrivateKey) if testCase.Invalid { assert.Error(t, err) diff --git a/pkg/crypto/keys/publickey.go b/pkg/crypto/keys/publickey.go index 9ff009490..a3660d616 100644 --- a/pkg/crypto/keys/publickey.go +++ b/pkg/crypto/keys/publickey.go @@ -161,7 +161,6 @@ func (p *PublicKey) getBytes(compressed bool) []byte { prefix = 0x04 yBytes := p.Y.Bytes() copy(res[1+coordLen+coordLen-len(yBytes):], yBytes) - } res[0] = prefix diff --git a/pkg/encoding/fixedn/fixed8_test.go b/pkg/encoding/fixedn/fixed8_test.go index 99ef0d74e..8498a5793 100644 --- a/pkg/encoding/fixedn/fixed8_test.go +++ b/pkg/encoding/fixedn/fixed8_test.go @@ -31,7 +31,6 @@ func TestFixed8Add(t *testing.T) { } func TestFixed8Sub(t *testing.T) { - a := Fixed8FromInt64(42) b := Fixed8FromInt64(34) diff --git a/pkg/io/binaryWriter.go b/pkg/io/binaryWriter.go index 9785b0449..5ad499988 100644 --- a/pkg/io/binaryWriter.go +++ b/pkg/io/binaryWriter.go @@ -119,7 +119,6 @@ func (w *BinWriter) WriteVarUint(val uint64) { w.WriteB(byte(0xfe)) w.WriteU32LE(uint32(val)) return - } w.WriteB(byte(0xff)) diff --git a/pkg/network/payload/getblocks.go b/pkg/network/payload/getblocks.go index 8a0bf0a56..e3434ebce 100644 --- a/pkg/network/payload/getblocks.go +++ b/pkg/network/payload/getblocks.go @@ -34,7 +34,6 @@ func (p *GetBlocks) DecodeBinary(br *io.BinReader) { if p.Count < -1 || p.Count == 0 { br.Err = errors.New("invalid count") } - } // EncodeBinary implements Serializable interface. diff --git a/pkg/network/server.go b/pkg/network/server.go index 2303b5be9..560829d5d 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -409,7 +409,6 @@ func (s *Server) run() { // because we have two goroutines sending signals here s.lock.Unlock() } - } } } diff --git a/pkg/network/server_test.go b/pkg/network/server_test.go index da1385430..d70618b54 100644 --- a/pkg/network/server_test.go +++ b/pkg/network/server_test.go @@ -178,7 +178,6 @@ func TestServerRegisterPeer(t *testing.T) { } return false }, time.Second, time.Millisecond*50) - } func TestGetBlocksByIndex(t *testing.T) { diff --git a/pkg/rpc/client/wsclient.go b/pkg/rpc/client/wsclient.go index 8a8e4824f..e0b9c7a52 100644 --- a/pkg/rpc/client/wsclient.go +++ b/pkg/rpc/client/wsclient.go @@ -209,7 +209,6 @@ func (c *WSClient) wsWriter() { } } } - } func (c *WSClient) makeWsRequest(r *request.Raw) (*response.Raw, error) { diff --git a/pkg/rpc/response/errors.go b/pkg/rpc/response/errors.go index 1e542dbd2..70201403b 100644 --- a/pkg/rpc/response/errors.go +++ b/pkg/rpc/response/errors.go @@ -44,7 +44,6 @@ func NewError(code int64, httpCode int, message string, data string, cause error Message: message, Data: data, } - } // NewParseError creates a new error with code diff --git a/pkg/rpc/server/server.go b/pkg/rpc/server/server.go index 085329474..5c06eb6b3 100644 --- a/pkg/rpc/server/server.go +++ b/pkg/rpc/server/server.go @@ -421,7 +421,6 @@ requestloop: break requestloop case resChan <- res: } - } s.subsLock.Lock() delete(s.subscribers, subscr) diff --git a/pkg/rpc/server/server_test.go b/pkg/rpc/server/server_test.go index 804426b34..d1d6138f8 100644 --- a/pkg/rpc/server/server_test.go +++ b/pkg/rpc/server/server_test.go @@ -1261,7 +1261,6 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) [] tc.check(t, e, res) } } - }) } }) diff --git a/pkg/rpc/server/subscription_test.go b/pkg/rpc/server/subscription_test.go index 9fe6ceafc..e2ca27ce4 100644 --- a/pkg/rpc/server/subscription_test.go +++ b/pkg/rpc/server/subscription_test.go @@ -311,7 +311,6 @@ func TestFilteredBlockSubscriptions(t *testing.T) { rmap := resp.Payload[0].(map[string]interface{}) primary := rmap["primary"].(float64) require.Equal(t, 3, int(primary)) - } callUnsubscribe(t, c, respMsgs, blockSubID) finishedFlag.CAS(false, true) diff --git a/pkg/services/oracle/neofs/neofs_test.go b/pkg/services/oracle/neofs/neofs_test.go index 6483875b9..82b25d4be 100644 --- a/pkg/services/oracle/neofs/neofs_test.go +++ b/pkg/services/oracle/neofs/neofs_test.go @@ -78,7 +78,6 @@ func TestParseNeoFSURL(t *testing.T) { require.Equal(t, tc.params, ps) } }) - } } diff --git a/pkg/services/oracle/transaction.go b/pkg/services/oracle/transaction.go index b76552f28..5902afe7c 100644 --- a/pkg/services/oracle/transaction.go +++ b/pkg/services/oracle/transaction.go @@ -79,7 +79,6 @@ func (t *incompleteTx) addResponse(pub *keys.PublicKey, sig []byte, isBackup boo ok: tx != nil, sig: sig, } - } // finalize checks is either main or backup tx has sufficient number of signatures and returns diff --git a/pkg/vm/vm_test.go b/pkg/vm/vm_test.go index d6d9a4e8a..2b3e97477 100644 --- a/pkg/vm/vm_test.go +++ b/pkg/vm/vm_test.go @@ -753,7 +753,6 @@ func TestArithNullArg(t *testing.T) { runWithArgs(t, prog, false, 0, stackitem.Null{}) runWithArgs(t, prog, nil, stackitem.NewInterop(nil), 1) // also has `.Value() == nil` }) - } }