private void RequestChangeView(ChangeViewReason reason) { if (context.WatchOnly) { return; } // Request for next view is always one view more than the current context.ViewNumber // Nodes will not contribute for changing to a view higher than (context.ViewNumber+1), unless they are recovered // The latter may happen by nodes in higher views with, at least, `M` proofs byte expectedView = context.ViewNumber; expectedView++; ChangeTimer(TimeSpan.FromMilliseconds(neoSystem.Settings.MillisecondsPerBlock << (expectedView + 1))); if ((context.CountCommitted + context.CountFailed) > context.F) { RequestRecovery(); } else { Log($"Sending {nameof(ChangeView)}: height={context.Block.Index} view={context.ViewNumber} nv={expectedView} nc={context.CountCommitted} nf={context.CountFailed} reason={reason}"); localNode.Tell(new LocalNode.SendDirectly { Inventory = context.MakeChangeView(reason) }); CheckExpectedView(expectedView); } }
public ExtensiblePayload MakeChangeView(ChangeViewReason reason) { return(ChangeViewPayloads[MyIndex] = MakeSignedPayload(new ChangeView { Reason = reason, Timestamp = TimeProvider.Current.UtcNow.ToTimestampMS() })); }
public override void Deserialize(BinaryReader reader) { base.Deserialize(reader); Timestamp = reader.ReadUInt64(); Reason = (ChangeViewReason)reader.ReadByte(); }