Skip to content

Commit e704319

Browse files
committed
block context
1 parent b21e941 commit e704319

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

Libplanet.Action/ActionEvaluator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ public IReadOnlyList<ICommittedActionEvaluation> Evaluate(
140140
var services = new ServiceCollection
141141
{
142142
{ typeof(IEvidenceContext), new EvidenceContext() },
143+
{ typeof(IBlockContext), new BlockContext(block) },
143144
};
144145
evaluations = evaluations.AddRange(EvaluatePolicyBeginBlockActions(
145146
block, services, previousState

Libplanet.Action/IBlockContext.cs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
using System;
2-
using Libplanet.Crypto;
32
using Libplanet.Types.Blocks;
43

54
namespace Libplanet.Action
65
{
76
public interface IBlockContext
87
{
9-
Address Miner { get; }
10-
118
long Height { get; }
129

1310
int ProtocolVersion { get; }
@@ -19,21 +16,14 @@ public interface IBlockContext
1916

2017
internal sealed class BlockContext : IBlockContext
2118
{
22-
public BlockContext(
23-
Address miner,
24-
long blockIndex,
25-
int blockProtocolVersion,
26-
BlockCommit? lastCommit
27-
)
19+
public BlockContext(IPreEvaluationBlock preEvaluationBlock)
2820
{
29-
Miner = miner;
30-
Height = blockIndex;
31-
ProtocolVersion = blockProtocolVersion;
32-
LastCommit = lastCommit;
21+
Height = preEvaluationBlock.Index;
22+
ProtocolVersion = preEvaluationBlock.ProtocolVersion;
23+
LastCommit = preEvaluationBlock.LastCommit;
24+
Timestamp = preEvaluationBlock.Timestamp;
3325
}
3426

35-
public Address Miner { get; }
36-
3727
public long Height { get; }
3828

3929
public int ProtocolVersion { get; }

0 commit comments

Comments
 (0)