Ejemplo n.º 1
0
 private IPromise FinalizeInPromise(DynamicGlobalPropertiesObject dynamicGlobalProperty)
 {
     return(new Promise((resolve, reject) =>
     {
         new Task(() =>
         {
             try
             {
                 headBlockTime = dynamicGlobalProperty.Time;
                 if (expiration.IsZero())
                 {
                     expiration = TimeTool.ZeroTime().AddSeconds(BaseExpirationSeconds + ChainConfig.ExpireInSeconds);
                 }
                 referenceBlockNumber = (ushort)dynamicGlobalProperty.HeadBlockNumber;
                 var prefix = dynamicGlobalProperty.HeadBlockId.FromHex2Data();
                 if (!BitConverter.IsLittleEndian)
                 {
                     Array.Reverse(prefix);
                 }
                 referenceBlockPrefix = BitConverter.ToUInt32(prefix, 4);
                 buffer = new TransactionData(this).ToBuffer().ToArray();
                 resolve();
             }
             catch (Exception ex)
             {
                 reject(ex);
             }
         }).Start();
     }));
 }
Ejemplo n.º 2
0
        IPromise FinalizeInPromise(DynamicGlobalPropertiesObject dynamicGlobalProperty)
        {
            headBlockTime = dynamicGlobalProperty.Time;
            if (expiration.IsZero())
            {
                expiration = Tool.ZeroTime().AddSeconds(BaseExpirationSeconds + ChainConfig.ExpireInSeconds);
            }
            referenceBlockNumber = ( ushort )dynamicGlobalProperty.HeadBlockNumber;
            var prefix = Tool.FromHex(dynamicGlobalProperty.HeadBlockId);

            if (!BitConverter.IsLittleEndian)
            {
                Array.Reverse(prefix);
            }
            referenceBlockPrefix = BitConverter.ToUInt32(prefix, 4);
            buffer = new TransactionData(this).ToBuffer().ToArray();
            return(Promise.Resolved());
        }