all: fix unnecessary whitespace (#1800)

This commit is contained in:
wit liu 2025-12-08 17:37:11 +08:00 committed by GitHub
parent 28efc50013
commit d6309612fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 0 additions and 40 deletions

View file

@ -469,7 +469,6 @@ func (ha *Hasher) run(n *Node, h hash.Hash, d int, i int, s []byte) {
h.Write(n.left) h.Write(n.left)
h.Write(n.right) h.Write(n.right)
s = h.Sum(nil) s = h.Sum(nil)
} else { } else {
s = append(n.left, n.right...) s = append(n.left, n.right...)
} }

View file

@ -653,7 +653,6 @@ func (rewardObj *AccountEpochReward) getRewardAndStatus(account string, data map
} }
return return
} }
} }
if signersData, exists := data["signersObserver"]; exists { if signersData, exists := data["signersObserver"]; exists {

View file

@ -161,7 +161,6 @@ func (x *XDPoS_v2) verifyHeader(chain consensus.ChainReader, header *types.Heade
} }
return utils.ErrPenaltiesNotLegit return utils.ErrPenaltiesNotLegit
} }
} else { } else {
if len(header.Validators) != 0 { if len(header.Validators) != 0 {
log.Warn("[verifyHeader] Validators shall not have values in non-epochSwitch block", "Hash", header.Hash(), "Number", header.Number, "header.Validators", header.Validators) log.Warn("[verifyHeader] Validators shall not have values in non-epochSwitch block", "Hash", header.Hash(), "Number", header.Number, "header.Validators", header.Validators)

View file

@ -192,7 +192,6 @@ func GetSnapshotSigner(bc *core.BlockChain, header *types.Header) (signersList,
snap, err := engine.GetSnapshot(bc, header) snap, err := engine.GetSnapshot(bc, header)
if err != nil { if err != nil {
return nil, err return nil, err
} }
ms := make(signersList) ms := make(signersList)

View file

@ -80,7 +80,6 @@ func TestIsYourTurnConsensusV2(t *testing.T) {
isYourTurn, _ = adaptor.YourTurn(blockchain, currentBlock.Header(), common.HexToAddress("xdc5F74529C0338546f82389402a01c31fB52c6f434")) isYourTurn, _ = adaptor.YourTurn(blockchain, currentBlock.Header(), common.HexToAddress("xdc5F74529C0338546f82389402a01c31fB52c6f434"))
assert.False(t, isYourTurn) assert.False(t, isYourTurn)
} }
func TestIsYourTurnConsensusV2CrossConfig(t *testing.T) { func TestIsYourTurnConsensusV2CrossConfig(t *testing.T) {

View file

@ -385,7 +385,6 @@ func GetSnapshotSigner(bc *core.BlockChain, header *types.Header) (signersList,
snap, err := engine.GetSnapshot(bc, header) snap, err := engine.GetSnapshot(bc, header)
if err != nil { if err != nil {
return nil, err return nil, err
} }
ms := make(signersList) ms := make(signersList)
@ -393,7 +392,6 @@ func GetSnapshotSigner(bc *core.BlockChain, header *types.Header) (signersList,
ms[addr.Hex()] = true ms[addr.Hex()] = true
} }
return ms, nil return ms, nil
} }
func GetCandidateFromCurrentSmartContract(backend bind.ContractBackend, t *testing.T) masterNodes { func GetCandidateFromCurrentSmartContract(backend bind.ContractBackend, t *testing.T) masterNodes {

View file

@ -174,7 +174,6 @@ func TestShouldNotCommitIfRoundsNotContinousFor3Rounds(t *testing.T) {
assert.Equal(t, grandGrandParentBlock.Hash(), highestCommitBlock.Hash) assert.Equal(t, grandGrandParentBlock.Hash(), highestCommitBlock.Hash)
assert.Equal(t, grandGrandParentBlock.Number(), highestCommitBlock.Number) assert.Equal(t, grandGrandParentBlock.Number(), highestCommitBlock.Number)
assert.Equal(t, types.Round(3), highestCommitBlock.Round) assert.Equal(t, types.Round(3), highestCommitBlock.Round)
} }
func TestProposedBlockMessageHandlerSuccessfullyGenerateVote(t *testing.T) { func TestProposedBlockMessageHandlerSuccessfullyGenerateVote(t *testing.T) {

View file

@ -282,7 +282,6 @@ func TestHookRewardAfterUpgrade(t *testing.T) {
} else { } else {
assert.Fail(t, "wrong reward") assert.Fail(t, "wrong reward")
} }
} }
resultObserver := reward["rewardsObserver"].(map[common.Address]interface{}) resultObserver := reward["rewardsObserver"].(map[common.Address]interface{})
// observer1 and it signs one tx, observer2 is inside penalty so no reward // observer1 and it signs one tx, observer2 is inside penalty so no reward

View file

@ -395,7 +395,6 @@ func TestShouldFailIfNotEnoughQCSignatures(t *testing.T) {
// Happy path // Happy path
err = adaptor.VerifyHeader(blockchain, headerWithDuplicatedSignatures, true) err = adaptor.VerifyHeader(blockchain, headerWithDuplicatedSignatures, true)
assert.Equal(t, utils.ErrInvalidQCSignatures, err) assert.Equal(t, utils.ErrInvalidQCSignatures, err)
} }
func TestShouldVerifyHeaders(t *testing.T) { func TestShouldVerifyHeaders(t *testing.T) {

View file

@ -225,7 +225,6 @@ func TestThrowErrorIfVoteMsgRoundIsMoreThanOneRoundAwayFromCurrentRound(t *testi
err = engineV2.VoteHandler(blockchain, voteMsg) err = engineV2.VoteHandler(blockchain, voteMsg)
assert.NotNil(t, err) assert.NotNil(t, err)
assert.Equal(t, "vote message round number: 6 is too far away from currentRound: 4", err.Error()) assert.Equal(t, "vote message round number: 6 is too far away from currentRound: 4", err.Error())
} }
func TestProcessVoteMsgThenTimeoutMsg(t *testing.T) { func TestProcessVoteMsgThenTimeoutMsg(t *testing.T) {

View file

@ -46,5 +46,4 @@ func TestPriceFeed(t *testing.T) {
t.Fatal("can't run function Foo() in smart contract: ", err) t.Fatal("can't run function Foo() in smart contract: ", err)
} }
fmt.Println("tx", tx) fmt.Println("tx", tx)
} }

View file

@ -1547,7 +1547,6 @@ func TestBlocksHashCacheUpdate(t *testing.T) {
t.Error("BlocksHashCache doesn't work when inserting block solely") t.Error("BlocksHashCache doesn't work when inserting block solely")
} }
}) })
} }
func TestAreTwoBlocksSamePath(t *testing.T) { func TestAreTwoBlocksSamePath(t *testing.T) {

View file

@ -692,7 +692,6 @@ func (pool *LendingPool) add(tx *types.LendingTransaction, local bool) (bool, er
log.Debug("Lending Pooled new executable transaction", "hash", hash, "useraddress", tx.UserAddress(), "nonce", tx.Nonce(), "status", tx.Status(), "lendingid", tx.LendingId()) log.Debug("Lending Pooled new executable transaction", "hash", hash, "useraddress", tx.UserAddress(), "nonce", tx.Nonce(), "status", tx.Status(), "lendingid", tx.LendingId())
return old != nil, nil return old != nil, nil
} }
// New transaction isn't replacing a pending one, push into queue // New transaction isn't replacing a pending one, push into queue
replace, err := pool.enqueueTx(hash, tx) replace, err := pool.enqueueTx(hash, tx)

View file

@ -495,7 +495,6 @@ func (pool *OrderPool) validateOrder(tx *types.OrderTransaction) error {
} else { } else {
tx.SetOrderHash(signer.Hash(tx)) tx.SetOrderHash(signer.Hash(tx))
} }
} else { } else {
if tx.OrderID() == 0 { if tx.OrderID() == 0 {
return ErrInvalidCancelledOrder return ErrInvalidCancelledOrder
@ -601,7 +600,6 @@ func (pool *OrderPool) add(tx *types.OrderTransaction, local bool) (bool, error)
log.Debug("Pooled new executable transaction", "hash", hash, "useraddress", tx.UserAddress().Hex(), "nonce", tx.Nonce(), "status", tx.Status(), "orderid", tx.OrderID()) log.Debug("Pooled new executable transaction", "hash", hash, "useraddress", tx.UserAddress().Hex(), "nonce", tx.Nonce(), "status", tx.Status(), "orderid", tx.OrderID())
go pool.txFeed.Send(core.OrderTxPreEvent{Tx: tx}) go pool.txFeed.Send(core.OrderTxPreEvent{Tx: tx})
return old != nil, nil return old != nil, nil
} }
// New transaction isn't replacing a pending one, push into queue // New transaction isn't replacing a pending one, push into queue
replace, err := pool.enqueueTx(hash, tx) replace, err := pool.enqueueTx(hash, tx)
@ -876,7 +874,6 @@ func (pool *OrderPool) promoteExecutables(accounts []common.Address) {
hash := tx.Hash() hash := tx.Hash()
log.Debug("Removed old queued transaction", "addr", tx.UserAddress().Hex(), "nonce", tx.Nonce(), "ohash", tx.OrderHash().Hex(), "status", tx.Status(), "orderid", tx.OrderID()) log.Debug("Removed old queued transaction", "addr", tx.UserAddress().Hex(), "nonce", tx.Nonce(), "ohash", tx.OrderHash().Hex(), "status", tx.Status(), "orderid", tx.OrderID())
delete(pool.all, hash) delete(pool.all, hash)
} }
// Gather all executable transactions and promote them // Gather all executable transactions and promote them

View file

@ -194,10 +194,8 @@ func (tx *LendingTransaction) From() *common.Address {
} else { } else {
return &f return &f
} }
} }
return nil return nil
} }
// WithSignature returns a new transaction with the given signature. // WithSignature returns a new transaction with the given signature.

View file

@ -188,7 +188,6 @@ func (ordersign OrderTxSigner) Sender(tx *OrderTransaction) (common.Address, err
} }
address := crypto.PubkeyToAddress(*pubKey) address := crypto.PubkeyToAddress(*pubKey)
return address, nil return address, nil
} }
// CacheOrderSigner cache signed order // CacheOrderSigner cache signed order

View file

@ -514,7 +514,6 @@ func (tx *Transaction) IsVotingTransaction() (bool, *common.Address) {
addr := data[end-20 : end] addr := data[end-20 : end]
m := common.BytesToAddress(addr) m := common.BytesToAddress(addr)
return true, &m return true, &m
} }
func (tx *Transaction) IsXDCXApplyTransaction() bool { func (tx *Transaction) IsXDCXApplyTransaction() bool {

View file

@ -111,7 +111,6 @@ func TestEIP155SigningVitalik(t *testing.T) {
if from != addr { if from != addr {
t.Errorf("%d: expected %x got %x", i, addr, from) t.Errorf("%d: expected %x got %x", i, addr, from)
} }
} }
} }

View file

@ -717,5 +717,4 @@ func (c *blake2F) Run(input []byte) ([]byte, error) {
binary.LittleEndian.PutUint64(output[offset:offset+8], h[i]) binary.LittleEndian.PutUint64(output[offset:offset+8], h[i])
} }
return output, nil return output, nil
} }

View file

@ -224,7 +224,6 @@ func newSpuriousDragonInstructionSet() JumpTable {
instructionSet := newTangerineWhistleInstructionSet() instructionSet := newTangerineWhistleInstructionSet()
instructionSet[EXP].dynamicGas = gasExpEIP158 instructionSet[EXP].dynamicGas = gasExpEIP158
return validate(instructionSet) return validate(instructionSet)
} }
// EIP 150 a.k.a Tangerine Whistle // EIP 150 a.k.a Tangerine Whistle

View file

@ -358,7 +358,6 @@ func New(stack *node.Node, config *ethconfig.Config, XDCXServ *XDCx.XDCX, lendin
eth.txPool.IsSigner = func(address common.Address) bool { eth.txPool.IsSigner = func(address common.Address) bool {
return c.IsAuthorisedAddress(eth.blockchain, eth.blockchain.CurrentHeader(), address) return c.IsAuthorisedAddress(eth.blockchain, eth.blockchain.CurrentHeader(), address)
} }
} }
// Start the RPC service // Start the RPC service
eth.netRPCService = ethapi.NewNetAPI(eth.p2pServer, eth.NetVersion()) eth.netRPCService = ethapi.NewNetAPI(eth.p2pServer, eth.NetVersion())

View file

@ -537,7 +537,6 @@ func testThrottling(t *testing.T, protocol int, mode SyncMode) {
tester.downloader.queue.resultCache.lock.Unlock() tester.downloader.queue.resultCache.lock.Unlock()
frozen = int(atomic.LoadUint32(&blocked)) frozen = int(atomic.LoadUint32(&blocked))
retrieved = len(tester.ownBlocks) retrieved = len(tester.ownBlocks)
} }
tester.lock.Unlock() tester.lock.Unlock()
@ -569,7 +568,6 @@ func testThrottling(t *testing.T, protocol int, mode SyncMode) {
t.Fatalf("block synchronization failed: %v", err) t.Fatalf("block synchronization failed: %v", err)
} }
tester.terminate() tester.terminate()
} }
// Tests that simple synchronization against a forked chain works correctly. In // Tests that simple synchronization against a forked chain works correctly. In

View file

@ -49,5 +49,4 @@ func TestPeerThroughputSorting(t *testing.T) {
if got, exp := sortPeers.p[2].id, "b"; got != exp { if got, exp := sortPeers.p[2].id, "b"; got != exp {
t.Errorf("sort fail, got %v exp %v", got, exp) t.Errorf("sort fail, got %v exp %v", got, exp)
} }
} }

View file

@ -168,7 +168,6 @@ func TestBasics(t *testing.T) {
if got, exp := fetchReq.Headers[0].Number.Uint64(), uint64(1); got != exp { if got, exp := fetchReq.Headers[0].Number.Uint64(), uint64(1); got != exp {
t.Fatalf("expected header %d, got %d", exp, got) t.Fatalf("expected header %d, got %d", exp, got)
} }
} }
//fmt.Printf("blockTaskQueue len: %d\n", q.blockTaskQueue.Size()) //fmt.Printf("blockTaskQueue len: %d\n", q.blockTaskQueue.Size())
//fmt.Printf("receiptTaskQueue len: %d\n", q.receiptTaskQueue.Size()) //fmt.Printf("receiptTaskQueue len: %d\n", q.receiptTaskQueue.Size())
@ -208,7 +207,6 @@ func TestEmptyBlocks(t *testing.T) {
if fetchReq != nil { if fetchReq != nil {
t.Fatal("there should be no body fetch tasks remaining") t.Fatal("there should be no body fetch tasks remaining")
} }
} }
if q.blockTaskQueue.Size() != len(emptyChain.blocks)-10 { if q.blockTaskQueue.Size() != len(emptyChain.blocks)-10 {
t.Errorf("expected block task queue to be 0, got %d", q.blockTaskQueue.Size()) t.Errorf("expected block task queue to be 0, got %d", q.blockTaskQueue.Size())
@ -270,7 +268,6 @@ func XTestDelivery(t *testing.T) {
fmt.Printf("got %d results, %d tot\n", len(res), tot) fmt.Printf("got %d results, %d tot\n", len(res), tot)
// Now we can forget about these // Now we can forget about these
world.forget(res[len(res)-1].Header.Number.Uint64()) world.forget(res[len(res)-1].Header.Number.Uint64())
} }
}) })
wg.Go(func() { wg.Go(func() {
@ -328,7 +325,6 @@ func XTestDelivery(t *testing.T) {
} }
for i := 0; i < 50; i++ { for i := 0; i < 50; i++ {
time.Sleep(2990 * time.Millisecond) time.Sleep(2990 * time.Millisecond)
} }
}) })
wg.Go(func() { wg.Go(func() {

View file

@ -996,7 +996,6 @@ func (pm *ProtocolManager) BroadcastSyncInfo(syncInfo *types.SyncInfo) {
} }
log.Trace("Propagated SyncInfo", "hash", hash, "recipients", len(peers)) log.Trace("Propagated SyncInfo", "hash", hash, "recipients", len(peers))
} }
} }
// OrderBroadcastTx will propagate a transaction to all peers which are not known to // OrderBroadcastTx will propagate a transaction to all peers which are not known to

View file

@ -1152,7 +1152,6 @@ func (w *Work) commitTransactions(mux *event.TypeMux, balanceFee map[common.Addr
log.Warn("[commitTransactions] Error when sending PendingStateEvent", "tcount", tcount) log.Warn("[commitTransactions] Error when sending PendingStateEvent", "tcount", tcount)
} }
}(w.tcount) }(w.tcount)
} }
} }

View file

@ -514,7 +514,6 @@ func (test rpcPrefixTest) check(t *testing.T, node *Node) {
if err == nil { if err == nil {
t.Errorf("Error: %s: WebSocket connection succeeded for path in wantNoWS", path) t.Errorf("Error: %s: WebSocket connection succeeded for path in wantNoWS", path)
} }
} }
} }

View file

@ -457,7 +457,6 @@ func (h *virtualHostHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// It's an IP address, we can serve that // It's an IP address, we can serve that
h.next.ServeHTTP(w, r) h.next.ServeHTTP(w, r)
return return
} }
// Not an IP address, but a hostname. Need to validate // Not an IP address, but a hostname. Need to validate
if _, exist := h.vhosts["*"]; exist { if _, exist := h.vhosts["*"]; exist {

View file

@ -502,7 +502,6 @@ func (t *expectEvents) expect(events ...*Event) {
if event.Conn.Up != expected.Conn.Up { if event.Conn.Up != expected.Conn.Up {
t.Fatalf("expected conn event %d to have up=%t, got up=%t", i, expected.Conn.Up, event.Conn.Up) t.Fatalf("expected conn event %d to have up=%t, got up=%t", i, expected.Conn.Up, event.Conn.Up)
} }
} }
i++ i++

View file

@ -155,7 +155,6 @@ func probabilistic(net *Network, quit chan struct{}, nodeCount int) {
} }
wg.Wait() wg.Wait()
} }
} }
// connect nodeCount number of nodes in a ring // connect nodeCount number of nodes in a ring

View file

@ -245,7 +245,6 @@ func (net *Network) watchPeerEvents(id discover.NodeID, events chan *p2p.PeerEve
case p2p.PeerEventTypeMsgRecv: case p2p.PeerEventTypeMsgRecv:
net.DidReceive(peer, id, event.Protocol, *event.MsgCode) net.DidReceive(peer, id, event.Protocol, *event.MsgCode)
} }
case err := <-sub.Err(): case err := <-sub.Err():

View file

@ -65,5 +65,4 @@ func (test *DifficultyTest) Run(config *params.ChainConfig) error {
test.CurrentTimestamp, test.CurrentBlockNumber, actual, exp) test.CurrentTimestamp, test.CurrentBlockNumber, actual, exp)
} }
return nil return nil
} }