Example #1
0
 private ConsensusPayload MakePayload(ConsensusMessage message)
 {
     message.ViewNumber = ViewNumber;
     return(new ConsensusPayload
     {
         Version = Version,
         PrevHash = PrevHash,
         BlockIndex = BlockIndex,
         ValidatorIndex = (ushort)MyIndex,
         Timestamp = Timestamp,
         Data = message.ToArray()
     });
 }
        public ExtensiblePayload CreatePayload(ConsensusMessage message, byte[] invocationScript = null)
        {
            ExtensiblePayload payload = new ExtensiblePayload
            {
                Category        = "dBFT",
                ValidBlockStart = 0,
                ValidBlockEnd   = message.BlockIndex,
                Sender          = GetSender(message.ValidatorIndex),
                Data            = message.ToArray(),
                Witness         = invocationScript is null ? null : new Witness
                {
                    InvocationScript   = invocationScript,
                    VerificationScript = Contract.CreateSignatureRedeemScript(Validators[message.ValidatorIndex])
                }
            };

            cachedMessages.TryAdd(payload.Hash, message);
            return(payload);
        }