Skip to content

Commit

Permalink
remove unused methods
Browse files Browse the repository at this point in the history
These methods are thin wrappers anyway.
  • Loading branch information
buck54321 committed Dec 5, 2021
1 parent 0db789f commit e34f69d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 60 deletions.
30 changes: 0 additions & 30 deletions client/asset/eth/nodeclient.go
Expand Up @@ -155,17 +155,6 @@ func (n *nodeClient) block(ctx context.Context, hash common.Hash) (*types.Block,
return n.leth.ApiBackend.BlockByHash(ctx, hash)
}

// accounts returns all accounts from the internal node.
func (n *nodeClient) accounts() []*accounts.Account {
var accts []*accounts.Account
for _, wallet := range n.node.AccountManager().Wallets() {
for _, acct := range wallet.Accounts() {
accts = append(accts, &acct)
}
}
return accts
}

func (n *nodeClient) stateAt(ctx context.Context, bn rpc.BlockNumber) (*state.StateDB, error) {
state, _, err := n.leth.ApiBackend.StateAndHeaderByNumberOrHash(ctx, rpc.BlockNumberOrHashWithNumber(bn))
if err != nil {
Expand Down Expand Up @@ -312,19 +301,6 @@ func (n *nodeClient) addPeer(peerURL string) error {
return nil
}

// nodeInfo retrieves useful information about a node.
// Not used in production. TODO: remove?
func (n *nodeClient) nodeInfo() *p2p.NodeInfo {
return n.p2pSrv.NodeInfo()
}

// listWallets list all of the wallet's wallets? and accounts along with details
// such as locked status.
// Not used in production. TODO: remove?
func (n *nodeClient) listWallets() []accounts.Wallet {
return n.creds.ks.Wallets()
}

// sendTransaction sends a tx.
func (n *nodeClient) sendTransaction(ctx context.Context, txOpts *bind.TransactOpts,
to common.Address, data []byte) (*types.Transaction, error) {
Expand Down Expand Up @@ -360,12 +336,6 @@ func (n *nodeClient) syncProgress() ethereum.SyncProgress {
return n.leth.ApiBackend.SyncProgress()
}

// peers returns connected peers.
// Not used in production. TODO: remove?
func (n *nodeClient) peers() []*p2p.Peer {
return n.p2pSrv.Peers()
}

// swap gets a swap keyed by secretHash in the contract.
func (n *nodeClient) swap(ctx context.Context, secretHash [32]byte, contractVer uint32) (swap *dexeth.SwapState, err error) {
return swap, n.withcontractor(contractVer, func(c contractor) error {
Expand Down
30 changes: 0 additions & 30 deletions client/asset/eth/nodeclient_harness_test.go
Expand Up @@ -247,7 +247,6 @@ func syncClient(cl *nodeClient) error {

func TestBasicRetrieval(t *testing.T) {
syncClient(ethClient)
t.Run("testNodeInfo", testNodeInfo)
t.Run("testBestBlockHash", testBestBlockHash)
t.Run("testBestHeader", testBestHeader)
t.Run("testBlock", testBlock)
Expand All @@ -257,16 +256,13 @@ func TestBasicRetrieval(t *testing.T) {
func TestPeering(t *testing.T) {
t.Run("testAddPeer", testAddPeer)
t.Run("testSyncProgress", testSyncProgress)
t.Run("testPeers", testPeers)
t.Run("testGetCodeAt", testGetCodeAt)
}

func TestAccount(t *testing.T) {
t.Run("testAccounts", testAccounts)
t.Run("testBalance", testBalance)
t.Run("testUnlock", testUnlock)
t.Run("testLock", testLock)
t.Run("testListWallets", testListWallets)
t.Run("testSendTransaction", testSendTransaction)
t.Run("testTransactionReceipt", testTransactionReceipt)
t.Run("testSignMessage", testSignMessage)
Expand All @@ -284,11 +280,6 @@ func TestContract(t *testing.T) {
// t.Run("testRefund", testRefund)
}

func testNodeInfo(t *testing.T) {
ni := ethClient.nodeInfo()
spew.Dump(ni)
}

func testAddPeer(t *testing.T) {
if err := ethClient.addPeer(alphaNode); err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -323,14 +314,6 @@ func testBlock(t *testing.T) {
spew.Dump(b)
}

func testAccounts(t *testing.T) {
accts := ethClient.accounts()
if len(accts) == 0 {
t.Errorf("Found no accounts")
}
spew.Dump(accts)
}

func testBalance(t *testing.T) {
bal, err := ethClient.balance(ctx)
if err != nil {
Expand All @@ -356,14 +339,6 @@ func testLock(t *testing.T) {
}
}

func testListWallets(t *testing.T) {
wallets := ethClient.listWallets()
if len(wallets) == 0 {
t.Fatalf("no wallets")
}
spew.Dump(wallets)
}

func testSendTransaction(t *testing.T) {
err := ethClient.unlock(pw)
if err != nil {
Expand Down Expand Up @@ -463,11 +438,6 @@ func testSyncProgress(t *testing.T) {
spew.Dump(ethClient.syncProgress())
}

func testPeers(t *testing.T) {
peers := ethClient.peers()
spew.Dump(peers)
}

func TestInitiateGas(t *testing.T) {
err := ethClient.unlock(pw)
if err != nil {
Expand Down

0 comments on commit e34f69d

Please sign in to comment.