Skip to content

Commit 08e84a5

Browse files
committed
bug fixes
1 parent f69e0a5 commit 08e84a5

File tree

6 files changed

+18
-7
lines changed

6 files changed

+18
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ You still have to set up a config file in any case as the rpc users can't and **
4545
- REASON: UTXOs are currently blindly added based on being taproot. There is no check whether the inputs are
4646
eligible. Will be fixed asap.
4747
- [Should be fixed] cleanup has an error on block 712,517 as per
48-
this [issue](https://github.com/setavenger/BlindBit-Backend/issues/2#issuecomment-2069827679). Needs fixing asap.
48+
this [issue](https://github.com/setavenger/blindbit-oracle/issues/2#issuecomment-2069827679). Needs fixing asap.
4949
- program can only be run in tweak only mode for the time being
5050

5151
## Todos

src/common/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func LoadConfigs(pathToConfig string) {
1010

1111
// Handle errors reading the config file
1212
if err := viper.ReadInConfig(); err != nil {
13-
WarningLogger.Println("No config file detected", err.Error())
13+
ErrorLogger.Println("No config file detected", err.Error())
1414
return
1515
}
1616

src/common/util.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"crypto/sha256"
55
"github.com/shopspring/decimal"
66
"golang.org/x/crypto/ripemd160"
7+
"os/user"
8+
"strings"
79
)
810

911
func ReverseBytes(bytes []byte) []byte {
@@ -43,3 +45,10 @@ func Hash160(data []byte) []byte {
4345
ripemd160Hasher.Write(sha256Hash[:]) // Hash the SHA256 hash
4446
return ripemd160Hasher.Sum(nil)
4547
}
48+
49+
func ResolvePath(path string) string {
50+
usr, _ := user.Current()
51+
dir := usr.HomeDir
52+
53+
return strings.Replace(path, "~", dir, 1)
54+
}

src/common/vars.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ var (
5454
var NumsH = []byte{80, 146, 155, 116, 193, 160, 73, 84, 183, 139, 75, 96, 53, 233, 122, 94, 7, 138, 90, 15, 40, 236, 150, 213, 71, 191, 238, 154, 206, 128, 58, 192}
5555

5656
func SetDirectories() {
57+
BaseDirectory = ResolvePath(BaseDirectory)
58+
5759
DBPath = BaseDirectory + "/data"
5860
LogsPath = BaseDirectory + "/logs"
5961

src/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ func init() {
2929
flag.Parse()
3030

3131
common.SetDirectories() // todo a proper set settings function which does it all would be good to avoid several small function calls
32-
3332
err := os.Mkdir(common.BaseDirectory, 0750)
3433
if err != nil && !strings.Contains(err.Error(), "file exists") {
3534
fmt.Println(err.Error())
@@ -75,11 +74,11 @@ func init() {
7574
openLevelDBConnections()
7675

7776
if common.RpcUser == "" {
78-
panic("rpc user not set")
77+
panic("rpc user not set") // todo use cookie file to circumvent this requirement
7978
}
8079

8180
if common.RpcPass == "" {
82-
panic("rpc pass not set")
81+
panic("rpc pass not set") // todo use cookie file to circumvent this requirement
8382
}
8483
}
8584

src/server/api.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import (
1414
)
1515

1616
// ApiHandler todo might not need ApiHandler struct if no data is stored within.
17-
// Will keep for now just in case, so I don't have to refactor twice
17+
//
18+
// Will keep for now just in case, so I don't have to refactor twice
1819
type ApiHandler struct{}
1920

2021
type TxRequest struct {
@@ -183,7 +184,7 @@ func (h *ApiHandler) GetTweakDataByHeight(c *gin.Context) {
183184
serveTweakData = append(serveTweakData, hex.EncodeToString(tweak.Data[:]))
184185
}
185186

186-
c.JSON(200, serveTweakData)
187+
c.JSON(http.StatusOK, serveTweakData)
187188
}
188189

189190
func (h *ApiHandler) GetTweakIndexDataByHeight(c *gin.Context) {

0 commit comments

Comments
 (0)