Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Ledger Manager Issues #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/block_calculator/supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ defmodule Miner.BlockCalculator.Supervisor do
|> Enum.find(& String.starts_with?(List.to_string(&1), "--address="))
|> IO.inspect
|> List.to_string()

address
end

Expand Down
7 changes: 4 additions & 3 deletions lib/ledger/ledger_manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ defmodule Miner.LedgerManager do
|> Kernel.+(1)
|> Range.new(:binary.decode_unsigned(Ledger.last_block().index))
|> Enum.map(&Ledger.block_at_height/1)
|> IO.inspect
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stray IO.inspect

|> Enum.filter(fn elem -> elem !== :none end) |> IO.inspect

# Find transaction inputs that need to be reversed
# TODO: We're looping over blocks_to_reverse twice here (once to parse
Expand Down Expand Up @@ -260,9 +262,8 @@ defmodule Miner.LedgerManager do
# Return a list of all transaction inputs for every transaction in this block
@spec parse_transaction_inputs(Block) :: list
defp parse_transaction_inputs(block) do
block.transactions
|> Enum.flat_map(&(&1.inputs))
|> Enum.map(&(Map.delete(&1, :signature)))
block.transactions
|> Enum.flat_map(&(&1.inputs))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use pipes when there is only one function

end

@spec parse_transaction_outputs(Block) :: list
Expand Down
3 changes: 2 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ defmodule Miner.Mixfile do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:elixium_core, "~> 0.3"},
{:local_dependency, path: "../elixium_core", app: false},
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not commit this

#{:elixium_core, "~> 0.3"},
{:decimal, "~> 1.0"},
{:poison, "~> 3.1"},
{:distillery, "~> 2.0"}
Expand Down