Skip to content

Commit 3d50ac3

Browse files
authored
Fix charge_when_no_offer (#717)
* Fix charge_when_no_offer * Fix status badge
1 parent 711e7a6 commit 3d50ac3

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Helium Router [![Tests](https://github.com/helium/router/actions/workflows/main.yml/badge.svg)](https://github.com/helium/router/actions/workflows/main.yml)
1+
# Helium Router [![Tests](https://github.com/helium/router/actions/workflows/tests.yml/badge.svg)](https://github.com/helium/router/actions/workflows/tests.yml)
22

33
Helium's LoRa Network Server (LNS) backend.
44

src/device/router_device_worker.erl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1569,7 +1569,7 @@ validate_frame_(Packet, PubKeyBin, HotspotRegion, Device0, OfferCache, Blockchai
15691569
maybe_charge(Device, PayloadSize, Blockchain, PubKeyBin, PHash, OfferCache) ->
15701570
case maps:get({PubKeyBin, PHash}, OfferCache, undefined) of
15711571
undefined ->
1572-
case application:get_env(router, charge_when_no_offer, true) of
1572+
case charge_when_no_offer() of
15731573
false ->
15741574
Metadata = router_device:metadata(Device),
15751575
{Balance, Nonce} =
@@ -1587,6 +1587,14 @@ maybe_charge(Device, PayloadSize, Blockchain, PubKeyBin, PHash, OfferCache) ->
15871587
router_console_dc_tracker:charge(Device, PayloadSize, Blockchain)
15881588
end.
15891589

1590+
-spec charge_when_no_offer() -> boolean().
1591+
charge_when_no_offer() ->
1592+
case application:get_env(router, charge_when_no_offer, true) of
1593+
"true" -> true;
1594+
true -> true;
1595+
_ -> false
1596+
end.
1597+
15901598
%%%-------------------------------------------------------------------
15911599
%% @doc
15921600
%% Check device's message queue to potentially wait or send reply

0 commit comments

Comments
 (0)