Skip to content

Commit a1cff9f

Browse files
committed
bug fix: chain could not be set
1 parent 1e6c806 commit a1cff9f

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed

blindbit.example.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# default: "127.0.0.1:8000"
33
host = "127.0.0.1:8000"
44

5-
# Defines on which chain the wallet runs. Allowed values: main, test, signet, regtest.
5+
# Defines on which chain the wallet runs. Allowed values: main, testnet, signet, regtest.
66
# Default: signet
77
chain = "signet"
88

@@ -31,4 +31,4 @@ max_parallel_requests = 4
3131
#
3232
# optional - will only generate tweaks (still both cut-through and full-index)
3333
# default: 0 set to 1 to activate
34-
tweaks_only = 1
34+
tweaks_only = 0

src/common/config.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ func LoadConfigs(pathToConfig string) {
1818
// network
1919
viper.SetDefault("max_parallel_requests", MaxParallelRequests)
2020
viper.SetDefault("host", Host)
21+
viper.SetDefault("chain", "signet")
2122

2223
// RPC endpoint only. Fails if others are not set
2324
viper.SetDefault("rpc_endpoint", RpcEndpoint)
2425

26+
//Others
27+
viper.SetDefault("tweaks_only", false)
28+
2529
/* read and set config variables */
2630
Host = viper.GetString("host")
2731

@@ -34,4 +38,21 @@ func LoadConfigs(pathToConfig string) {
3438
RpcUser = viper.GetString("rpc_user")
3539

3640
SyncStartHeight = viper.GetUint32("sync_start_height")
41+
42+
TweaksOnly = viper.GetBool("tweaks_only")
43+
44+
chainInput := viper.GetString("chain")
45+
46+
switch chainInput {
47+
case "main":
48+
Chain = Mainnet
49+
case "signet":
50+
Chain = Signet
51+
case "regtest":
52+
Chain = Regtest
53+
case "testnet":
54+
Chain = Testnet3
55+
default:
56+
panic("chain undefined")
57+
}
3758
}

src/core/cleanup.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ func overwriteUTXOsWithLookUp(utxos []types.UTXO) error {
3535
// todo construct the subsequent deletion of all utxos per transaction once all per transaction are spent
3636
func markSpentUTXOsAndTweaks(utxos []types.UTXO) error {
3737
if len(utxos) == 0 {
38+
if common.Chain == common.Mainnet {
39+
// no warnings on other chains as it is very likely to not have any taproot outputs for several blocks on end
40+
common.WarningLogger.Println("no utxos to mark as spent")
41+
}
3842
return nil
3943
}
4044

@@ -53,11 +57,6 @@ func markSpentUTXOsAndTweaks(utxos []types.UTXO) error {
5357
common.ErrorLogger.Println(err)
5458
return err
5559
}
56-
//err := dblevel.InsertUTXOs(utxos)
57-
//if err != nil {
58-
// common.ErrorLogger.Println(err)
59-
// return err
60-
//}
6160

6261
// Now begin process to find the tweaks that need to be deleted
6362

src/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ func main() {
125125
//todo create proper handling for exporting data
126126
//exportAll()
127127

128+
// todo print settings
129+
common.InfoLogger.Printf("Tweaks only: %t\n", common.TweaksOnly)
130+
128131
//moved into go routine such that the interrupt signal will apply properly
129132
go func() {
130133
startSync := time.Now()

0 commit comments

Comments
 (0)