public async Task Init(Block block, RawOperation op, RawRevealContent content) { var sender = await Cache.Accounts.GetAsync(content.Source); sender.Delegate ??= Cache.Accounts.GetDelegate(sender.DelegateId); PubKey = content.PublicKey; Reveal = new RevealOperation { Id = Cache.AppState.NextOperationId(), OpHash = op.Hash, Block = block, Level = block.Level, Timestamp = block.Timestamp, BakerFee = content.Fee, Counter = content.Counter, GasLimit = content.GasLimit, StorageLimit = content.StorageLimit, Sender = sender, Status = content.Metadata.Result.Status switch { "applied" => OperationStatus.Applied, "backtracked" => OperationStatus.Backtracked, _ => throw new NotImplementedException() } }; }
protected async Task ValidateReveal(RawRevealContent reveal, RawBlock rawBlock) { if (!await Cache.Accounts.ExistsAsync(reveal.Source)) { throw new ValidationException("unknown source account"); } ValidateFeeBalanceUpdates( reveal.Metadata.BalanceUpdates, rawBlock.Metadata.Baker, reveal.Source, reveal.Fee, rawBlock.Metadata.LevelInfo.Cycle); }
public static async Task <RevealsCommit> Apply(ProtocolHandler proto, Block block, RawOperation op, RawRevealContent content) { var commit = new RevealsCommit(proto); await commit.Init(block, op, content); await commit.Apply(); return(commit); }