Skip to content

Commit

Permalink
Made conf target > priority conversion configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Talej committed Nov 11, 2023
1 parent 68296a2 commit 5dd70c9
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 9 deletions.
7 changes: 6 additions & 1 deletion cyphernodeconf_docker/templates/proxy/proxy.env
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ WATCHER_BTC_NODE_PRUNED=<%= bitcoin_prune ? 'true' : 'false' %>
OTSCLIENT_CONTAINER=otsclient:6666
OTS_FILES=/proxy/otsfiles
XPUB_DERIVATION_GAP=100
PGPASSFILE=/proxy/db/pgpass
PGPASSFILE=/proxy/db/pgpass

CONFTARGET_PRIORITY_FASTEST=1
CONFTARGET_PRIORITY_HALFHOUR=3
CONFTARGET_PRIORITY_HOUR=6
CONFTARGET_PRIORITY_ECONOMY=59
4 changes: 4 additions & 0 deletions proxy_docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ WATCHER_BTC_NODE_PRUNED=false
OTSCLIENT_CONTAINER=otsclient:6666
OTS_FILES=/proxy/otsfiles
XPUB_DERIVATION_GAP=100
CONFTARGET_PRIORITY_FASTEST=1
CONFTARGET_PRIORITY_HALFHOUR=3
CONFTARGET_PRIORITY_HOUR=6
CONFTARGET_PRIORITY_ECONOMY=59
```

## Create sqlite3 database path and give rights
Expand Down
34 changes: 26 additions & 8 deletions proxy_docker/app/script/walletoperations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -360,25 +360,43 @@ getfeeratefromurl() {
return 0
}

getfeerate() {
trace "Entering getfeerate()..."

getpriorityfromconftarget() {
local conf_target=${1}
trace "[getfeerate] conf_target=${conf_target}"
trace "[getpriorityfromconftarget] conf_target=${conf_target}"

conftarget_fastest=$(($CONFTARGET_PRIORITY_FASTEST + 1))
conftarget_halfhour=$(($CONFTARGET_PRIORITY_HALFHOUR + 1))
conftarget_hour=$(($CONFTARGET_PRIORITY_HOUR + 1))
conftarget_economy=$(($CONFTARGET_PRIORITY_ECONOMY + 1))

local priority
if [ "$conf_target" -lt 2 ]; then
if [ "$conf_target" -lt $conftarget_fastest ]; then
priority="fastest"
elif [ "${conf_target}" -lt 4 ]; then
elif [ "$conf_target" -lt $conftarget_halfhour ]; then
priority="halfHour"
elif [ "$conf_target" -lt 7 ]; then
elif [ "$conf_target" -lt $conftarget_hour ]; then
priority="hour"
elif [ "$conf_target" -lt 60 ]; then
elif [ "$conf_target" -lt $conftarget_economy ]; then
priority="economy"
else
priority="minimum"
fi

echo $priority
}

CONFTARGET_PRIORITY_FASTEST=1
CONFTARGET_PRIORITY_HALFHOUR=3
CONFTARGET_PRIORITY_HOUR=6
CONFTARGET_PRIORITY_ECONOMY=59

getfeerate() {
trace "Entering getfeerate()..."

local conf_target=${1}
trace "[getfeerate] conf_target=${conf_target}"

local priority=$(getpriorityfromconftarget "${conf_target}")
trace "[getfeerate] priority=${priority}"

local feerate=$(getfeeratefromurl "https://mempool.bullbitcoin.com/api/v1/fees/recommended" "${priority}")
Expand Down
5 changes: 5 additions & 0 deletions proxy_docker/env.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ DERIVATION_PUB32=upub5GtUcgGed1aGH4HKQ3vMYrsmLXwmHhS1AeX33ZvDgZiyvkGhNTvGd2TA5Lr
DERIVATION_PATH=0/n
WATCHER_BTC_NODE_PRUNED=false
XPUB_DERIVATION_GAP=100

CONFTARGET_PRIORITY_FASTEST=1
CONFTARGET_PRIORITY_HALFHOUR=3
CONFTARGET_PRIORITY_HOUR=6
CONFTARGET_PRIORITY_ECONOMY=59

0 comments on commit 5dd70c9

Please sign in to comment.