Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouop0 committed Feb 2, 2024
1 parent 2f0f068 commit f51ad3c
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
1 change: 0 additions & 1 deletion internal/handler/checkstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,5 @@ func CheckStatusTimeOut(ctx *svc.ServiceContext) {
}
time.Sleep(2 * time.Second)
}

}
}
20 changes: 10 additions & 10 deletions internal/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import (
func Run(ctx *svc.ServiceContext) {
//// 最新高度
go LatestBlackNumber(ctx)
//// 同步区块
//go SyncBlock(ctx)
//// 同步事件
//go SyncEvent(ctx)
//执行committer
//go Committer(ctx)
// 同步区块
go SyncBlock(ctx)
// 同步事件
go SyncEvent(ctx)
// 执行committer
go Committer(ctx)
// 检查vote状态
//go CheckStatus(ctx)
//// 检查并铭刻
go CheckStatus(ctx)
// 检查并铭刻
go Inscribe(ctx)
//// check time out
//go CheckStatusTimeOut(ctx)
// check time out
go CheckStatusTimeOut(ctx)

//// 检查
// go CheckBlock(ctx)
Expand Down
4 changes: 2 additions & 2 deletions internal/handler/inscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package handler

import (
"encoding/json"
"time"

"github.com/b2network/b2committer/pkg/btcapi"
btcmempool "github.com/b2network/b2committer/pkg/btcapi/mempool"
"time"

"github.com/b2network/b2committer/pkg/inscribe"

Expand Down Expand Up @@ -76,7 +77,6 @@ func Inscribe(ctx *svc.ServiceContext) {
continue
}
}

}
}
}
3 changes: 2 additions & 1 deletion internal/handler/latestBlockNumber.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package handler

import (
"context"
"time"

"github.com/b2network/b2committer/pkg/btcapi"
btcmempool "github.com/b2network/b2committer/pkg/btcapi/mempool"
"time"

"github.com/b2network/b2committer/pkg/log"

Expand Down
8 changes: 3 additions & 5 deletions internal/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ type B2NODEConfig struct {
}

type BitcoinRPCConfig struct {
NetworkName string `env:"NETWORK_NAME" envDefault:"signet"`
PrivateKey string `env:"BITCOIN_PRIVATE_KEY" envDefault:"c545a409ff7f2e66b4bc863a59dcccf0f4387668a92152a058446bcb58a57027"` // signet tb1p2rfzw7mdyvkashtls5z6y7e5wlwdfzvjyay9mk2xgsdmzt5zwykq2e0rq8
NetworkName string `env:"NETWORK_NAME" envDefault:"signet"`
PrivateKey string `env:"BITCOIN_PRIVATE_KEY" envDefault:"c545a409ff7f2e66b4bc863a59dcccf0f4387668a92152a058446bcb58a57027"`
// signet tb1p2rfzw7mdyvkashtls5z6y7e5wlwdfzvjyay9mk2xgsdmzt5zwykq2e0rq8
DestinationAddress string `env:"COMMITTER_DESTINATION_ADDRESS" envDefault:"tb1pvhr4e58yatk9uve22rr5umxs0jh9g0j0gtcj0ry2wf23lddhjptsf6c360"`
//c5b87dffa5ada5e75d72413cf5570a26f9a432b10ab3ef8708c00ca75b96dc74
//tb1pvhr4e58yatk9uve22rr5umxs0jh9g0j0gtcj0ry2wf23lddhjptsf6c360

}

var (
Expand Down
7 changes: 4 additions & 3 deletions pkg/b2node/b2node.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"github.com/b2network/b2committer/pkg/rpc"
"strconv"

"github.com/b2network/b2committer/pkg/rpc"

sdkmath "cosmossdk.io/math"

clientTx "github.com/cosmos/cosmos-sdk/client/tx"
Expand Down Expand Up @@ -41,7 +42,7 @@ type GasPriceRsp struct {
Result string `json:"result"`
}

func NewNodeClient(privateKeyHex string, chainID string, address string, grpcConn *grpc.ClientConn, rpcUrl string) *NodeClient {
func NewNodeClient(privateKeyHex string, chainID string, address string, grpcConn *grpc.ClientConn, rpcURL string) *NodeClient {
privatekeyBytes, err := hex.DecodeString(privateKeyHex)
if nil != err {
panic(err)
Expand All @@ -53,7 +54,7 @@ func NewNodeClient(privateKeyHex string, chainID string, address string, grpcCon
Address: address,
ChainID: chainID,
GrpcConn: grpcConn,
RPCUrl: rpcUrl,
RPCUrl: rpcURL,
}
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/btcapi/btcapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package btcapi

import (
"fmt"
"github.com/btcsuite/btcd/chaincfg"
"io"
"net/http"

"github.com/btcsuite/btcd/chaincfg"

"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
Expand Down
6 changes: 3 additions & 3 deletions pkg/btcapi/mempool/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ func (c *Client) BroadcastTx(tx *wire.MsgTx) (*chainhash.Hash, error) {
return txHash, nil
}

func (c *Client) GetTransactionByID(ID string) (*btcapi.Transaction, error) {
res, err := c.request(http.MethodGet, fmt.Sprintf("/tx/%s", ID), nil)
func (c *Client) GetTransactionByID(id string) (*btcapi.Transaction, error) {
res, err := c.request(http.MethodGet, fmt.Sprintf("/tx/%s", id), nil)
if err != nil {
return nil, err
}
Expand All @@ -87,7 +87,7 @@ func (c *Client) GetTransactionByID(ID string) (*btcapi.Transaction, error) {
}

func (c *Client) GetCurrentBlockHash() (int64, error) {
res, err := c.request(http.MethodGet, fmt.Sprintf("/blocks/tip/height"), nil)
res, err := c.request(http.MethodGet, "/blocks/tip/height", nil)
if err != nil {
return 0, err
}
Expand Down

0 comments on commit f51ad3c

Please sign in to comment.