Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gofumpt #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion bifrost/pkg/chainclients/bitcoin/bitcoin.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ func (c *Client) extractTxs(block *btcjson.GetBlockVerboseTxResult) (types.TxIn,
// - vout:0 doesn't have address
// - count vouts > 4
// - count vouts with coins (value) > 2
//
func (c *Client) ignoreTx(tx *btcjson.TxRawResult) bool {
if len(tx.Vin) == 0 || len(tx.Vout) == 0 || len(tx.Vout) > 4 {
return true
Expand Down
78 changes: 39 additions & 39 deletions bifrost/pkg/chainclients/bitcoin/bitcoin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (s *BitcoinSuite) TestFetchTxs(c *C) {
func (s *BitcoinSuite) TestGetSender(c *C) {
tx := btcjson.TxRawResult{
Vin: []btcjson.Vin{
btcjson.Vin{
{
Txid: "31f8699ce9028e9cd37f8a6d58a79e614a96e3fdd0f58be5fc36d2d95484716f",
Vout: 0,
},
Expand All @@ -186,7 +186,7 @@ func (s *BitcoinSuite) TestGetSender(c *C) {
func (s *BitcoinSuite) TestGetMemo(c *C) {
tx := btcjson.TxRawResult{
Vout: []btcjson.Vout{
btcjson.Vout{
{
ScriptPubKey: btcjson.ScriptPubKeyResult{
Asm: "OP_RETURN 74686f72636861696e3a636f6e736f6c6964617465",
},
Expand All @@ -199,12 +199,12 @@ func (s *BitcoinSuite) TestGetMemo(c *C) {

tx = btcjson.TxRawResult{
Vout: []btcjson.Vout{
btcjson.Vout{
{
ScriptPubKey: btcjson.ScriptPubKeyResult{
Asm: "OP_RETURN 737761703a6574682e3078633534633135313236393646334541373935366264396144343130383138654563414443466666663a30786335346331353132363936463345413739353662643961443431",
},
},
btcjson.Vout{
{
ScriptPubKey: btcjson.ScriptPubKeyResult{
Asm: "OP_RETURN 30383138654563414443466666663a3130303030303030303030",
},
Expand All @@ -227,19 +227,19 @@ func (s *BitcoinSuite) TestIgnoreTx(c *C) {
// valid tx that will NOT be ignored
tx := btcjson.TxRawResult{
Vin: []btcjson.Vin{
btcjson.Vin{
{
Txid: "24ed2d26fd5d4e0e8fa86633e40faf1bdfc8d1903b1cd02855286312d48818a2",
Vout: 0,
},
},
Vout: []btcjson.Vout{
btcjson.Vout{
{
Value: 0.12345678,
ScriptPubKey: btcjson.ScriptPubKeyResult{
Addresses: []string{"tb1qkq7weysjn6ljc2ywmjmwp8ttcckg8yyxjdz5k6"},
},
},
btcjson.Vout{
{
ScriptPubKey: btcjson.ScriptPubKeyResult{
Asm: "OP_RETURN 74686f72636861696e3a636f6e736f6c6964617465",
},
Expand All @@ -252,7 +252,7 @@ func (s *BitcoinSuite) TestIgnoreTx(c *C) {
// invalid tx missing Vout
tx = btcjson.TxRawResult{
Vin: []btcjson.Vin{
btcjson.Vin{
{
Txid: "24ed2d26fd5d4e0e8fa86633e40faf1bdfc8d1903b1cd02855286312d48818a2",
Vout: 0,
},
Expand All @@ -265,19 +265,19 @@ func (s *BitcoinSuite) TestIgnoreTx(c *C) {
// invalid tx missing vout[0].Value == no coins
tx = btcjson.TxRawResult{
Vin: []btcjson.Vin{
btcjson.Vin{
{
Txid: "24ed2d26fd5d4e0e8fa86633e40faf1bdfc8d1903b1cd02855286312d48818a2",
Vout: 0,
},
},
Vout: []btcjson.Vout{
btcjson.Vout{
{
Value: 0,
ScriptPubKey: btcjson.ScriptPubKeyResult{
Addresses: []string{"tb1qkq7weysjn6ljc2ywmjmwp8ttcckg8yyxjdz5k6"},
},
},
btcjson.Vout{
{
ScriptPubKey: btcjson.ScriptPubKeyResult{
Asm: "OP_RETURN 74686f72636861696e3a636f6e736f6c6964617465",
},
Expand All @@ -290,19 +290,19 @@ func (s *BitcoinSuite) TestIgnoreTx(c *C) {
// invalid tx missing vin[0].Txid means coinbase
tx = btcjson.TxRawResult{
Vin: []btcjson.Vin{
btcjson.Vin{
{
Txid: "",
Vout: 0,
},
},
Vout: []btcjson.Vout{
btcjson.Vout{
{
Value: 0.1234565,
ScriptPubKey: btcjson.ScriptPubKeyResult{
Addresses: []string{"tb1qkq7weysjn6ljc2ywmjmwp8ttcckg8yyxjdz5k6"},
},
},
btcjson.Vout{
{
ScriptPubKey: btcjson.ScriptPubKeyResult{
Asm: "OP_RETURN 74686f72636861696e3a636f6e736f6c6964617465",
},
Expand All @@ -316,13 +316,13 @@ func (s *BitcoinSuite) TestIgnoreTx(c *C) {
tx = btcjson.TxRawResult{
Vin: []btcjson.Vin{},
Vout: []btcjson.Vout{
btcjson.Vout{
{
Value: 0.1234565,
ScriptPubKey: btcjson.ScriptPubKeyResult{
Addresses: []string{"tb1qkq7weysjn6ljc2ywmjmwp8ttcckg8yyxjdz5k6"},
},
},
btcjson.Vout{
{
ScriptPubKey: btcjson.ScriptPubKeyResult{
Asm: "OP_RETURN 74686f72636861696e3a636f6e736f6c6964617465",
},
Expand All @@ -335,13 +335,13 @@ func (s *BitcoinSuite) TestIgnoreTx(c *C) {
// invalid tx multiple vout[0].Addresses
tx = btcjson.TxRawResult{
Vin: []btcjson.Vin{
btcjson.Vin{
{
Txid: "24ed2d26fd5d4e0e8fa86633e40faf1bdfc8d1903b1cd02855286312d48818a2",
Vout: 0,
},
},
Vout: []btcjson.Vout{
btcjson.Vout{
{
Value: 0.1234565,
ScriptPubKey: btcjson.ScriptPubKeyResult{
Addresses: []string{
Expand All @@ -350,7 +350,7 @@ func (s *BitcoinSuite) TestIgnoreTx(c *C) {
},
},
},
btcjson.Vout{
{
ScriptPubKey: btcjson.ScriptPubKeyResult{
Asm: "OP_RETURN 74686f72636861696e3a636f6e736f6c6964617465",
},
Expand All @@ -363,37 +363,37 @@ func (s *BitcoinSuite) TestIgnoreTx(c *C) {
// invalid tx > 2 vout with coins we only expect 2 max
tx = btcjson.TxRawResult{
Vin: []btcjson.Vin{
btcjson.Vin{
{
Txid: "24ed2d26fd5d4e0e8fa86633e40faf1bdfc8d1903b1cd02855286312d48818a2",
Vout: 0,
},
},
Vout: []btcjson.Vout{
btcjson.Vout{
{
Value: 0.1234565,
ScriptPubKey: btcjson.ScriptPubKeyResult{
Addresses: []string{
"bc1q0s4mg25tu6termrk8egltfyme4q7sg3h0e56p3",
},
},
},
btcjson.Vout{
{
Value: 0.1234565,
ScriptPubKey: btcjson.ScriptPubKeyResult{
Addresses: []string{
"tb1qkq7weysjn6ljc2ywmjmwp8ttcckg8yyxjdz5k6",
},
},
},
btcjson.Vout{
{
Value: 0.1234565,
ScriptPubKey: btcjson.ScriptPubKeyResult{
Addresses: []string{
"tb1qkq7weysjn6ljc2ywmjmwp8ttcckg8yyxjdz5k6",
},
},
},
btcjson.Vout{
{
ScriptPubKey: btcjson.ScriptPubKeyResult{
Asm: "OP_RETURN 74686f72636861696e3a636f6e736f6c6964617465",
},
Expand All @@ -406,29 +406,29 @@ func (s *BitcoinSuite) TestIgnoreTx(c *C) {
// valid tx == 2 vout with coins, 1 to vault, 1 with change back to user
tx = btcjson.TxRawResult{
Vin: []btcjson.Vin{
btcjson.Vin{
{
Txid: "24ed2d26fd5d4e0e8fa86633e40faf1bdfc8d1903b1cd02855286312d48818a2",
Vout: 0,
},
},
Vout: []btcjson.Vout{
btcjson.Vout{
{
Value: 0.1234565,
ScriptPubKey: btcjson.ScriptPubKeyResult{
Addresses: []string{
"bc1q0s4mg25tu6termrk8egltfyme4q7sg3h0e56p3",
},
},
},
btcjson.Vout{
{
Value: 0.1234565,
ScriptPubKey: btcjson.ScriptPubKeyResult{
Addresses: []string{
"tb1qkq7weysjn6ljc2ywmjmwp8ttcckg8yyxjdz5k6",
},
},
},
btcjson.Vout{
{
ScriptPubKey: btcjson.ScriptPubKeyResult{
Asm: "OP_RETURN 74686f72636861696e3a636f6e736f6c6964617465",
},
Expand All @@ -443,19 +443,19 @@ func (s *BitcoinSuite) TestGetGas(c *C) {
// vin[0] returns value 0.19590108
tx := btcjson.TxRawResult{
Vin: []btcjson.Vin{
btcjson.Vin{
{
Txid: "24ed2d26fd5d4e0e8fa86633e40faf1bdfc8d1903b1cd02855286312d48818a2",
Vout: 0,
},
},
Vout: []btcjson.Vout{
btcjson.Vout{
{
Value: 0.12345678,
ScriptPubKey: btcjson.ScriptPubKeyResult{
Addresses: []string{"tb1qkq7weysjn6ljc2ywmjmwp8ttcckg8yyxjdz5k6"},
},
},
btcjson.Vout{
{
ScriptPubKey: btcjson.ScriptPubKeyResult{
Asm: "OP_RETURN 74686f72636861696e3a636f6e736f6c6964617465",
},
Expand All @@ -468,25 +468,25 @@ func (s *BitcoinSuite) TestGetGas(c *C) {

tx = btcjson.TxRawResult{
Vin: []btcjson.Vin{
btcjson.Vin{
{
Txid: "5b0876dcc027d2f0c671fc250460ee388df39697c3ff082007b6ddd9cb9a7513",
Vout: 1,
},
},
Vout: []btcjson.Vout{
btcjson.Vout{
{
Value: 0.00195384,
ScriptPubKey: btcjson.ScriptPubKeyResult{
Addresses: []string{"tb1qkq7weysjn6ljc2ywmjmwp8ttcckg8yyxjdz5k6"},
},
},
btcjson.Vout{
{
Value: 1.49655603,
ScriptPubKey: btcjson.ScriptPubKeyResult{
Addresses: []string{"tb1qkq7weysjn6ljc2ywmjmwp8ttcckg8yyxjdz5k6"},
},
},
btcjson.Vout{
{
ScriptPubKey: btcjson.ScriptPubKeyResult{
Asm: "OP_RETURN 74686f72636861696e3a636f6e736f6c6964617465",
},
Expand Down Expand Up @@ -563,7 +563,7 @@ func (s *BitcoinSuite) TestOnObservedTxIn(c *C) {
Count: "1",
Chain: common.BTCChain,
TxArray: []types.TxInItem{
types.TxInItem{
{
Tx: "31f8699ce9028e9cd37f8a6d58a79e614a96e3fdd0f58be5fc36d2d95484716f",
Sender: "bc1q2gjc0rnhy4nrxvuklk6ptwkcs9kcr59mcl2q9j",
To: "bc1q0s4mg25tu6termrk8egltfyme4q7sg3h0e56p3",
Expand Down Expand Up @@ -594,7 +594,7 @@ func (s *BitcoinSuite) TestOnObservedTxIn(c *C) {
Count: "1",
Chain: common.BTCChain,
TxArray: []types.TxInItem{
types.TxInItem{
{
Tx: "24ed2d26fd5d4e0e8fa86633e40faf1bdfc8d1903b1cd02855286312d48818a2",
Sender: "bc1q0s4mg25tu6termrk8egltfyme4q7sg3h0e56p3",
To: "bc1q2gjc0rnhy4nrxvuklk6ptwkcs9kcr59mcl2q9j",
Expand Down Expand Up @@ -625,7 +625,7 @@ func (s *BitcoinSuite) TestOnObservedTxIn(c *C) {
Count: "2",
Chain: common.BTCChain,
TxArray: []types.TxInItem{
types.TxInItem{
{
Tx: "44ed2d26fd5d4e0e8fa86633e40faf1bdfc8d1903b1cd02855286312d48818a2",
Sender: "bc1q0s4mg25tu6termrk8egltfyme4q7sg3h0e56p3",
To: "bc1q2gjc0rnhy4nrxvuklk6ptwkcs9kcr59mcl2q9j",
Expand All @@ -635,7 +635,7 @@ func (s *BitcoinSuite) TestOnObservedTxIn(c *C) {
Memo: "MEMO",
ObservedVaultPubKey: pkey,
},
types.TxInItem{
{
Tx: "54ed2d26fd5d4e0e8fa86633e40faf1bdfc8d1903b1cd02855286312d48818a2",
Sender: "bc1q0s4mg25tu6termrk8egltfyme4q7sg3h0e56p3",
To: "bc1q2gjc0rnhy4nrxvuklk6ptwkcs9kcr59mcl2q9j",
Expand Down
3 changes: 1 addition & 2 deletions bifrost/pubkeymanager/mock_pool_address_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ var (
validpb = "thorpub1addwnpepqfgfxharps79pqv8fv9ndqh90smw8c3slrtrssn58ryc5g3p9sx856x07yn"
)

type MockPoolAddressValidator struct {
}
type MockPoolAddressValidator struct{}

func NewMockPoolAddressValidator() *MockPoolAddressValidator {
return &MockPoolAddressValidator{}
Expand Down
3 changes: 2 additions & 1 deletion bifrost/signer/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ func NewSigner(cfg config.SignerConfiguration,
tssServer *tssp.TssServer,
tssCfg config.TSSConfiguration,
chains map[common.Chain]chainclients.ChainClient,
m *metrics.Metrics) (*Signer, error) {
m *metrics.Metrics,
) (*Signer, error) {
storage, err := NewSignerStore(cfg.SignerDbPath, thorchainBridge.GetConfig().SignerPasswd)
if err != nil {
return nil, fmt.Errorf("fail to create thorchain scan storage: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion bifrost/thorclient/types/account_resp.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package types

/// AccountResp the response from thorclient
// / AccountResp the response from thorclient
type AccountResp struct {
Height string `json:"height"`
Result struct {
Expand Down
3 changes: 1 addition & 2 deletions bifrost/tss/mock_thorchain_keymanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import (
)

// MockThorchainKeymanager is to mock the TSS , so as we could test it
type MockThorchainKeyManager struct {
}
type MockThorchainKeyManager struct{}

func (k *MockThorchainKeyManager) Sign(tx.StdSignMsg) ([]byte, error) {
return nil, nil
Expand Down
3 changes: 1 addition & 2 deletions cmd/bifrost/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ func (mts *MockTssServer) GetStatus() common.TssStatus {
}
}

type HealthServerTestSuite struct {
}
type HealthServerTestSuite struct{}

var _ = Suite(&HealthServerTestSuite{})

Expand Down
1 change: 1 addition & 0 deletions constants/constant_values_chaosnet.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build chaosnet
// +build chaosnet

// For internal testing and mockneting
Expand Down
1 change: 1 addition & 0 deletions constants/constants_mocknet.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mocknet
// +build mocknet

// For internal testing and mockneting
Expand Down
1 change: 1 addition & 0 deletions constants/constants_testnet.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build testnet
// +build testnet

// For Public TestNet
Expand Down
1 change: 1 addition & 0 deletions constants/constants_testnet_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build testnet
// +build testnet

package constants
Expand Down
Loading