Skip to content

Commit

Permalink
Fix ReplayCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
greymistcube committed Sep 26, 2023
1 parent c94ea14 commit 8852d04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ public ActionContext(

public bool BlockAction => TxId is null;

public void PutLog(string log)
{
// NOTE: Not implemented yet. See also Lib9c.Tests.Action.ActionContext.PutLog().
}

public void UseGas(long gas)
{
}
Expand Down Expand Up @@ -145,8 +140,14 @@ public ValidatorSet GetValidatorSet(BlockHash? offset)

public IAccountState GetAccountState(BlockHash? offset)
{
return new LocalCacheAccountState(_rocksDb, _source.GetAccountState, offset);
return new LocalCacheAccountState(
_rocksDb,
_source.GetAccountState,
offset);
}

public IAccountState GetAccountState(HashDigest<SHA256>? hash)
=> throw new NotImplementedException();
}

private sealed class LocalCacheAccountState : IAccountState
Expand All @@ -158,11 +159,11 @@ private sealed class LocalCacheAccountState : IAccountState

public LocalCacheAccountState(
RocksDb rocksDb,
Func<BlockHash?, IAccountState> sourceAccountStateGetter,
Func<BlockHash?, IAccountState> sourceAccountStateGetterWithBlockHash,
BlockHash? offset)
{
_rocksDb = rocksDb;
_sourceAccountStateGetter = sourceAccountStateGetter;
_sourceAccountStateGetter = sourceAccountStateGetterWithBlockHash;
_offset = offset;
}

Expand Down
5 changes: 2 additions & 3 deletions NineChronicles.Headless.Executable/Commands/ReplayCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public int Tx(

// Evaluate tx.
IAccountState previousBlockStates = blockChain.GetAccountState(previousBlock.Hash);
IAccount previousStates = AccountStateDelta.Create(previousBlockStates);
IAccount previousStates = new Account(previousBlockStates);
var actions = tx.Actions.Select(a => ToAction(a));
var actionEvaluations = EvaluateActions(
preEvaluationHash: targetBlock.PreEvaluationHash,
Expand Down Expand Up @@ -399,8 +399,7 @@ public int RemoteTx(
cacheDirectory ?? Path.Join(Path.GetTempPath(), "ncd-replay-remote-tx-cache"));

var previousBlockHash = BlockHash.FromString(previousBlockHashValue);
var previousStates =
AccountStateDelta.Create(blockChainStates.GetAccountState(previousBlockHash));
var previousStates = new Account(blockChainStates.GetAccountState(previousBlockHash));

var actions = transaction.Actions
.Select(ToAction)
Expand Down

0 comments on commit 8852d04

Please sign in to comment.