示例#1
0
 private static void AddBlock(uint blockNumber, SignedBlockData block)
 {
     lock (blocksLocler)
     {
         if (blocks.Count > BLOCKS_LIMIT)
         {
             blocks.Clear();
         }
         blocks[blockNumber] = block;
     }
 }
        public IPromise BroadcastBlock(SignedBlockData block)
        {
            if (IsInitialized)
            {
                return(new Promise((resolve, reject) =>
                {
#if ECHO_DEBUG
                    var debug = true;
#else
                    var debug = false;
#endif
                    var requestId = GenerateNewId();
                    var methodName = "broadcast_block";
                    var title = methodName + " " + requestId;
                    var parameters = new Parameters {
                        Id.Value, methodName, new object[] { block }
                    };
                    DoRequestVoid(requestId, parameters, resolve, reject, title, debug);
                }));
            }
            return(Init().Then(api => api.BroadcastBlock(block)));
        }
示例#3
0
 private static void GetBlock(uint blockNumber, SignedBlockData block) => OnGetBlock.SafeInvoke(blockNumber, block);