Skip to content

Commit

Permalink
fix unbound SigType
Browse files Browse the repository at this point in the history
  • Loading branch information
samantehrani committed Jan 3, 2025
1 parent f59e318 commit 81f404e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "lib/RandomX"]
path = apps/arweave/lib/RandomX
url = https://github.com/ArweaveTeam/RandomX.git
[submodule "apps/arweave/lib/secp256k1"]
path = apps/arweave/lib/secp256k1
url = https://github.com/bitcoin-core/secp256k1
1 change: 1 addition & 0 deletions apps/arweave/lib/secp256k1
Submodule secp256k1 added at f79f46
8 changes: 4 additions & 4 deletions apps/arweave/src/ar_node.erl
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ get_block_shadow_from_cache(H) ->

%% @doc Get the current balance of a given wallet address.
%% The balance returned is in relation to the nodes current wallet list.
get_balance({SigType, PubKey}) ->
get_balance(ar_wallet:to_address(PubKey, SigType));
get_balance({_, Identifier}) ->
get_balance(ar_wallet:to_address(Identifier));
get_balance(MaybeRSAPub) when byte_size(MaybeRSAPub) == 512 ->
%% A legacy feature where we may search the public key instead of address.
ar_wallets:get_balance(ar_wallet:to_rsa_address(MaybeRSAPub));
Expand All @@ -216,8 +216,8 @@ get_balance(Addr) ->

%% @doc Get the last tx id associated with a given wallet address.
%% Should the wallet not have made a tx the empty binary will be returned.
get_last_tx({SigType, PubKey}) ->
get_last_tx(ar_wallet:to_address(PubKey, SigType));
get_last_tx({_, Identifier}) ->
get_last_tx(ar_wallet:to_address(Identifier));
get_last_tx(MaybeRSAPub) when byte_size(MaybeRSAPub) == 512 ->
%% A legacy feature where we may search the public key instead of address.
get_last_tx(ar_wallet:to_rsa_address(MaybeRSAPub));
Expand Down
2 changes: 1 addition & 1 deletion apps/arweave/src/ar_node_utils.erl
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ validate_block(merkle_rebase_support_threshold, {NewB, OldB}) ->
is_wallet_invalid(#tx{ signature = <<>> }, _Wallets) ->
false;
is_wallet_invalid(#tx{ owner = Owner}, Wallets) ->
Address = ar_wallet:to_address(Owner, SigType),
Address = ar_wallet:to_address(Owner),
case maps:get(Address, Wallets, not_found) of
{Balance, LastTX} when Balance >= 0 ->
case Balance of
Expand Down

0 comments on commit 81f404e

Please sign in to comment.