UNPKG

3.23 kBTypeScriptView Raw
1import { ECPoint, PrivateKey } from '@neo-one/client-common';
2import { Blockchain, ConsensusMessage, Node, Transaction } from '@neo-one/node-core';
3import { ConsensusContext } from './ConsensusContext';
4import { BlockSentContext, Context, HeaderContext, InitialContext, RequestReceivedContext, SignatureSentContext, ViewChangingContext } from './context';
5import { Result } from './types';
6export declare const signAndRelay: ({ node, privateKey, context, consensusMessage, }: {
7 readonly node: Node;
8 readonly privateKey: PrivateKey;
9 readonly context: Context<Context<any>>;
10 readonly consensusMessage: ConsensusMessage;
11}) => void;
12export declare const getInitialContextAdd: ({ blockchain, publicKey, validators, blockReceivedTimeSeconds, }: {
13 readonly blockchain: Blockchain;
14 readonly publicKey: ECPoint;
15 readonly validators: readonly ECPoint[];
16 readonly blockReceivedTimeSeconds?: number | undefined;
17}) => {
18 type: string;
19 previousHash: import("@neo-one/client-common").UInt256;
20 blockIndex: number;
21 viewNumber: number;
22 myIndex: number;
23 primaryIndex: number;
24 expectedView: number[];
25 validators: readonly ECPoint[];
26 blockReceivedTimeSeconds: number | undefined;
27};
28export declare const initializeNewConsensus: ({ blockchain, publicKey, consensusContext, }: {
29 readonly blockchain: Blockchain;
30 readonly publicKey: ECPoint;
31 readonly consensusContext: ConsensusContext;
32}) => Promise<Result<InitialContext>>;
33export declare const initializeConsensus: ({ node, context: contextIn, viewNumber, consensusContext, }: {
34 readonly node: Node;
35 readonly context: Context<Context<any>>;
36 readonly viewNumber: number;
37 readonly consensusContext: ConsensusContext;
38}) => Result<InitialContext | SignatureSentContext>;
39export declare function checkSignatures<TContext extends HeaderContext>({ node, context, }: {
40 readonly node: Node;
41 readonly context: TContext;
42}): Promise<Result<TContext | BlockSentContext>>;
43export declare const signAndRelayChangeView: ({ node, privateKey, context, }: {
44 readonly node: Node;
45 readonly privateKey: PrivateKey;
46 readonly context: Context<Context<any>>;
47}) => void;
48export declare const checkExpectedView: ({ context, viewNumber, }: {
49 readonly context: Context<Context<any>>;
50 readonly viewNumber: number;
51}) => boolean;
52export declare const initializeConsensusInitial: ({ blockchain, context, viewNumber, consensusContext, }: {
53 readonly blockchain: Blockchain;
54 readonly context: Context<Context<any>>;
55 readonly viewNumber: number;
56 readonly consensusContext: ConsensusContext;
57}) => Result<InitialContext>;
58export declare const incrementExpectedView: (context: Context<Context<any>>) => readonly number[];
59export declare const addTransaction: ({ context: contextIn, node, privateKey, transaction, verify, consensusContext, }: {
60 readonly context: RequestReceivedContext;
61 readonly node: Node;
62 readonly privateKey: PrivateKey;
63 readonly transaction: Transaction;
64 readonly verify: boolean;
65 readonly consensusContext: ConsensusContext;
66}) => Promise<Result<BlockSentContext | InitialContext | SignatureSentContext | ViewChangingContext | RequestReceivedContext>>;