Unverified Commit 5b7f81fa authored by Marc Nijdam's avatar Marc Nijdam
Browse files

Remove blockchain txn helpers that moved to core

parent e636ee98
Showing with 3 additions and 49 deletions
+3 -49
......@@ -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
......@@ -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",
......
......@@ -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
......
......@@ -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} ->
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment