Skip to content

Commit

Permalink
[GH-#125] Lock time block constant added to TxData
Browse files Browse the repository at this point in the history
  • Loading branch information
d-velev committed Nov 24, 2017
1 parent c8e41c4 commit 2284e9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions apps/aecore/lib/aecore/miner/worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ defmodule Aecore.Miner.Worker do
require Logger

@coinbase_transaction_value 100
@coinbase_lock_time_block 10
@nonce_per_cycle 1

def start_link(_args) do
Expand Down Expand Up @@ -176,7 +175,7 @@ defmodule Aecore.Miner.Worker do
total_fees = calculate_total_fees(valid_txs)
valid_txs = [get_coinbase_transaction(pubkey, total_fees,
latest_block.header.height + 1 +
@coinbase_lock_time_block) | valid_txs]
TxData.get_lock_time_block()) | valid_txs]
root_hash = BlockValidation.calculate_root_hash(valid_txs)

new_block_state = ChainState.calculate_block_state(valid_txs)
Expand Down
5 changes: 5 additions & 0 deletions apps/aecore/lib/aecore/structures/tx_data.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ defmodule Aecore.Structures.TxData do
alias Aecore.Structures.TxData
@type tx_data() :: %TxData{}

@lock_time_block 10

@doc """
Definition of Aecore TxData structure
Expand All @@ -18,6 +20,9 @@ defmodule Aecore.Structures.TxData do
defstruct [:nonce, :from_acc, :to_acc, :value, :fee, :lock_time_block]
use ExConstructor

@spec get_lock_time_block() :: integer()
def get_lock_time_block(), do: @lock_time_block

@spec create(binary(), binary(), integer(), integer(), integer(), integer()) :: {:ok, %TxData{}}
def create(from_acc, to_acc, value, nonce, fee, lock_time_block) do
{:ok, %TxData{from_acc: from_acc,
Expand Down

0 comments on commit 2284e9a

Please sign in to comment.