Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hnt-pub
Miner
Commits
5b7f81fa
Unverified
Commit
5b7f81fa
authored
5 years ago
by
Marc Nijdam
Browse files
Options
Download
Email Patches
Plain Diff
Remove blockchain txn helpers that moved to core
parent
e636ee98
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Makefile
+0
-6
Makefile
rebar.lock
+1
-1
rebar.lock
src/miner.erl
+0
-40
src/miner.erl
src/miner_ebus.erl
+2
-2
src/miner_ebus.erl
with
3 additions
and
49 deletions
+3
-49
Makefile
+
0
-
6
View file @
5b7f81fa
...
...
@@ -52,9 +52,3 @@ devrel:
devrelease
:
$(REBAR)
as dev release
startdevrel
:
./_build/default/rel/miner/bin/miner ping
&&
./_build/default/rel/miner/bin/miner restart
||
./_build/default/rel/miner/bin/miner start
stopdevrel
:
./_build/default/rel/miner/bin/miner stop
This diff is collapsed.
Click to expand it.
rebar.lock
+
1
-
1
View file @
5b7f81fa
...
...
@@ -3,7 +3,7 @@
{<<"base32">>,{pkg,<<"base32">>,<<"0.1.0">>},3},
{<<"blockchain">>,
{git,"https://github.com/helium/blockchain-core.git",
{ref,"
b77601f88cf235d2b2ef572ebc7f4e4d0bf6e542
"}},
{ref,"
321018d704b9ff31f33942245fa2af5b83f176a5
"}},
0},
{<<"clique">>,
{git,"https://github.com/helium/clique.git",
...
...
This diff is collapsed.
Click to expand it.
src/miner.erl
+
0
-
40
View file @
5b7f81fa
...
...
@@ -14,8 +14,6 @@
%% ------------------------------------------------------------------
-
export
([
start_link
/
0
,
add_gateway_txn
/
4
,
assert_loc_txn
/
6
,
p2p_status
/
0
,
block_age
/
0
,
relcast_info
/
1
,
...
...
@@ -150,44 +148,6 @@ p2p_status() ->
{
CheckNatType
,
"nat_type"
},
{
CheckHeight
,
"height"
}]).
%%--------------------------------------------------------------------
%% @doc
%% @end
%%--------------------------------------------------------------------
-
spec
add_gateway_txn
(
OwnerB58
::
string
(),
PayerB58
::
string
(),
Fee
::
pos_integer
(),
StakingFee
::
non_neg_integer
())
->
{
ok
,
binary
()}.
add_gateway_txn
(
OwnerB58
,
PayerB58
,
Fee
,
StakingFee
)
->
Owner
=
libp2p_crypto
:
b58_to_bin
(
OwnerB58
),
Payer
=
libp2p_crypto
:
b58_to_bin
(
PayerB58
),
{
ok
,
PubKey
,
SigFun
,
_
ECDHFun
}
=
libp2p_swarm
:
keys
(
blockchain_swarm
:
swarm
()),
PubKeyBin
=
libp2p_crypto
:
pubkey_to_bin
(
PubKey
),
Txn
=
blockchain_txn_add_gateway_v1
:
new
(
Owner
,
PubKeyBin
,
Payer
,
StakingFee
,
Fee
),
SignedTxn
=
blockchain_txn_add_gateway_v1
:
sign_request
(
Txn
,
SigFun
),
{
ok
,
blockchain_txn
:
serialize
(
SignedTxn
)}.
%%--------------------------------------------------------------------
%% @doc
%% @end
%%--------------------------------------------------------------------
-
spec
assert_loc_txn
(
H3String
::
string
(),
OwnerB58
::
string
(),
PayerB58
::
string
(),
Nonce
::
non_neg_integer
(),
StakingFee
::
pos_integer
(),
Fee
::
pos_integer
()
)
->
{
ok
,
binary
()}.
assert_loc_txn
(
H3String
,
OwnerB58
,
PayerB58
,
Nonce
,
StakingFee
,
Fee
)
->
H3Index
=
h3
:
from_string
(
H3String
),
Owner
=
libp2p_crypto
:
b58_to_bin
(
OwnerB58
),
Payer
=
libp2p_crypto
:
b58_to_bin
(
PayerB58
),
{
ok
,
PubKey
,
SigFun
,
_
ECDHFun
}
=
libp2p_swarm
:
keys
(
blockchain_swarm
:
swarm
()),
PubKeyBin
=
libp2p_crypto
:
pubkey_to_bin
(
PubKey
),
Txn
=
blockchain_txn_assert_location_v1
:
new
(
PubKeyBin
,
Owner
,
Payer
,
H3Index
,
Nonce
,
StakingFee
,
Fee
),
SignedTxn
=
blockchain_txn_assert_location_v1
:
sign_request
(
Txn
,
SigFun
),
{
ok
,
blockchain_txn
:
serialize
(
SignedTxn
)}.
%%--------------------------------------------------------------------
%% @doc
%% @end
...
...
This diff is collapsed.
Click to expand it.
src/miner_ebus.erl
+
2
-
2
View file @
5b7f81fa
...
...
@@ -48,7 +48,7 @@ init(_Args) ->
handle_message
(
?
MINER_OBJECT
(
?
MINER_MEMBER_ADD_GW
)
=
Member
,
Msg
,
State
=
#state
{})
->
case
ebus_message
:
args
(
Msg
)
of
{
ok
,
[
OwnerB58
,
Fee
,
StakingFee
,
PayerB58
]}
->
case
(
catch
miner
:
add_gateway_txn
(
OwnerB58
,
PayerB58
,
Fee
,
StakingFee
))
of
case
(
catch
blockchain
:
add_gateway_txn
(
OwnerB58
,
PayerB58
,
Fee
,
StakingFee
))
of
{
ok
,
TxnBin
}
->
{
reply
,
[{
array
,
byte
}],
[
TxnBin
],
State
};
{
'EXIT'
,
Why
}
->
...
...
@@ -66,7 +66,7 @@ handle_message(?MINER_OBJECT(?MINER_MEMBER_ASSERT_LOC)=Member, Msg, State=#state
case
ebus_message
:
args
(
Msg
)
of
{
ok
,
[
H3String
,
OwnerB58
,
Nonce
,
StakingFee
,
Fee
,
PayerB58
]}
->
lager
:
info
(
"Requesting assert for
~p
"
,
[
H3String
]),
case
(
catch
miner
:
assert_loc_txn
(
H3String
,
OwnerB58
,
PayerB58
,
Nonce
,
StakingFee
,
Fee
))
of
case
(
catch
blockchain
:
assert_loc_txn
(
H3String
,
OwnerB58
,
PayerB58
,
Nonce
,
StakingFee
,
Fee
))
of
{
ok
,
TxnBin
}
->
{
reply
,
[{
array
,
byte
}],
[
TxnBin
],
State
};
{
'EXIT'
,
Why
}
->
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets