-
public interface DarksideStreamerGrpc.AsyncServiceDarksidewalletd maintains two staging areas, blocks and transactions. The Stage*() gRPCs add items to the staging area; ApplyStaged() "applies" everything in the staging area to the working (operational) state that the mock zcashd serves; transactions are placed into their corresponding blocks (by height).
-
-
Method Summary
Modifier and Type Method Description voidreset(Darkside.DarksideMetaState request, StreamObserver<Service.Empty> responseObserver)Reset reverts all darksidewalletd state (active block range, latest height, staged blocks and transactions) and lightwalletd state (cache) to empty, the same as the initial state. This occurs synchronously and instantaneously; no reorg happens in lightwalletd. This is good to do before each independent test so that no state leaks from one test to another. Also sets (some of) the values returned by GetLightdInfo(). The Sapling activation height specified here must be where the block range starts.StreamObserver<Darkside.DarksideBlock>stageBlocksStream(StreamObserver<Service.Empty> responseObserver)StageBlocksStream accepts a list of blocks and saves them into the blocks staging area until ApplyStaged() is called; there is no immediate effect on the mock zcashd. Blocks are hex-encoded. Order is important, see ApplyStaged.voidstageBlocks(Darkside.DarksideBlocksURL request, StreamObserver<Service.Empty> responseObserver)StageBlocks is the same as StageBlocksStream() except the blocks are fetched from the given URL. Blocks are one per line, hex-encoded (not JSON).voidstageBlocksCreate(Darkside.DarksideEmptyBlocks request, StreamObserver<Service.Empty> responseObserver)StageBlocksCreate is like the previous two, except it creates 'count' empty blocks at consecutive heights starting at height 'height'. The 'nonce' is part of the header, so it contributes to the block hash; this lets you create identical blocks (same transactions and height), but with different hashes.StreamObserver<Service.RawTransaction>stageTransactionsStream(StreamObserver<Service.Empty> responseObserver)StageTransactionsStream stores the given transaction-height pairs in the staging area until ApplyStaged() is called. Note that these transactions are not returned by the production GetTransaction() gRPC until they appear in a "mined" block (contained in the active blockchain presented by the mock zcashd).voidstageTransactions(Darkside.DarksideTransactionsURL request, StreamObserver<Service.Empty> responseObserver)StageTransactions is the same except the transactions are fetched from the given url. They are all staged into the block at the given height. Staging transactions to different heights requires multiple calls.voidapplyStaged(Darkside.DarksideHeight request, StreamObserver<Service.Empty> responseObserver)ApplyStaged iterates the list of blocks that were staged by the StageBlocks*() gRPCs, in the order they were staged, and "merges" each into the active, working blocks list that the mock zcashd is presenting to lightwalletd. Even as each block is applied, the active list can't have gaps; if the active block range is 1000-1006, and the staged block range is 1003-1004, the resulting range is 1000-1004, with 1000-1002 unchanged, blocks 1003-1004 from the new range, and 1005-1006 dropped. After merging all blocks, ApplyStaged() appends staged transactions (in the order received) into each one's corresponding (by height) block The staging area is then cleared. The argument specifies the latest block height that mock zcashd reports (i.e. what's returned by GetLatestBlock). Note that ApplyStaged() can also be used to simply advance the latest block height presented by mock zcashd. That is, there doesn't need to be anything in the staging area.voidgetIncomingTransactions(Service.Empty request, StreamObserver<Service.RawTransaction> responseObserver)Calls to the production gRPC SendTransaction() store the transaction in a separate area (not the staging area); this method returns all transactions in this separate area, which is then cleared. The height returned with each transaction is -1 (invalid) since these transactions haven't been mined yet. The intention is that the transactions returned here can then, for example, be given to StageTransactions() to get them "mined" into a specified block on the next ApplyStaged().voidclearIncomingTransactions(Service.Empty request, StreamObserver<Service.Empty> responseObserver)Clear the incoming transaction pool.voidaddAddressUtxo(Service.GetAddressUtxosReply request, StreamObserver<Service.Empty> responseObserver)Add a GetAddressUtxosReply entry to be returned by GetAddressUtxos(). There is no staging or applying for these, very simple.voidclearAddressUtxo(Service.Empty request, StreamObserver<Service.Empty> responseObserver)Clear the list of GetAddressUtxos entries (can't fail)voidaddTreeState(Service.TreeState request, StreamObserver<Service.Empty> responseObserver)Adds a GetTreeState to the tree state cachevoidremoveTreeState(Service.BlockID request, StreamObserver<Service.Empty> responseObserver)Removes a GetTreeState for the given height from cache if present (can't fail)voidclearAllTreeStates(Service.Empty request, StreamObserver<Service.Empty> responseObserver)Clear the list of GetTreeStates entries (can't fail)-
-
Method Detail
-
reset
void reset(Darkside.DarksideMetaState request, StreamObserver<Service.Empty> responseObserver)
Reset reverts all darksidewalletd state (active block range, latest height, staged blocks and transactions) and lightwalletd state (cache) to empty, the same as the initial state. This occurs synchronously and instantaneously; no reorg happens in lightwalletd. This is good to do before each independent test so that no state leaks from one test to another. Also sets (some of) the values returned by GetLightdInfo(). The Sapling activation height specified here must be where the block range starts.
-
stageBlocksStream
StreamObserver<Darkside.DarksideBlock> stageBlocksStream(StreamObserver<Service.Empty> responseObserver)
StageBlocksStream accepts a list of blocks and saves them into the blocks staging area until ApplyStaged() is called; there is no immediate effect on the mock zcashd. Blocks are hex-encoded. Order is important, see ApplyStaged.
-
stageBlocks
void stageBlocks(Darkside.DarksideBlocksURL request, StreamObserver<Service.Empty> responseObserver)
StageBlocks is the same as StageBlocksStream() except the blocks are fetched from the given URL. Blocks are one per line, hex-encoded (not JSON).
-
stageBlocksCreate
void stageBlocksCreate(Darkside.DarksideEmptyBlocks request, StreamObserver<Service.Empty> responseObserver)
StageBlocksCreate is like the previous two, except it creates 'count' empty blocks at consecutive heights starting at height 'height'. The 'nonce' is part of the header, so it contributes to the block hash; this lets you create identical blocks (same transactions and height), but with different hashes.
-
stageTransactionsStream
StreamObserver<Service.RawTransaction> stageTransactionsStream(StreamObserver<Service.Empty> responseObserver)
StageTransactionsStream stores the given transaction-height pairs in the staging area until ApplyStaged() is called. Note that these transactions are not returned by the production GetTransaction() gRPC until they appear in a "mined" block (contained in the active blockchain presented by the mock zcashd).
-
stageTransactions
void stageTransactions(Darkside.DarksideTransactionsURL request, StreamObserver<Service.Empty> responseObserver)
StageTransactions is the same except the transactions are fetched from the given url. They are all staged into the block at the given height. Staging transactions to different heights requires multiple calls.
-
applyStaged
void applyStaged(Darkside.DarksideHeight request, StreamObserver<Service.Empty> responseObserver)
ApplyStaged iterates the list of blocks that were staged by the StageBlocks*() gRPCs, in the order they were staged, and "merges" each into the active, working blocks list that the mock zcashd is presenting to lightwalletd. Even as each block is applied, the active list can't have gaps; if the active block range is 1000-1006, and the staged block range is 1003-1004, the resulting range is 1000-1004, with 1000-1002 unchanged, blocks 1003-1004 from the new range, and 1005-1006 dropped. After merging all blocks, ApplyStaged() appends staged transactions (in the order received) into each one's corresponding (by height) block The staging area is then cleared. The argument specifies the latest block height that mock zcashd reports (i.e. what's returned by GetLatestBlock). Note that ApplyStaged() can also be used to simply advance the latest block height presented by mock zcashd. That is, there doesn't need to be anything in the staging area.
-
getIncomingTransactions
void getIncomingTransactions(Service.Empty request, StreamObserver<Service.RawTransaction> responseObserver)
Calls to the production gRPC SendTransaction() store the transaction in a separate area (not the staging area); this method returns all transactions in this separate area, which is then cleared. The height returned with each transaction is -1 (invalid) since these transactions haven't been mined yet. The intention is that the transactions returned here can then, for example, be given to StageTransactions() to get them "mined" into a specified block on the next ApplyStaged().
-
clearIncomingTransactions
void clearIncomingTransactions(Service.Empty request, StreamObserver<Service.Empty> responseObserver)
Clear the incoming transaction pool.
-
addAddressUtxo
void addAddressUtxo(Service.GetAddressUtxosReply request, StreamObserver<Service.Empty> responseObserver)
Add a GetAddressUtxosReply entry to be returned by GetAddressUtxos(). There is no staging or applying for these, very simple.
-
clearAddressUtxo
void clearAddressUtxo(Service.Empty request, StreamObserver<Service.Empty> responseObserver)
Clear the list of GetAddressUtxos entries (can't fail)
-
addTreeState
void addTreeState(Service.TreeState request, StreamObserver<Service.Empty> responseObserver)
Adds a GetTreeState to the tree state cache
-
removeTreeState
void removeTreeState(Service.BlockID request, StreamObserver<Service.Empty> responseObserver)
Removes a GetTreeState for the given height from cache if present (can't fail)
-
clearAllTreeStates
void clearAllTreeStates(Service.Empty request, StreamObserver<Service.Empty> responseObserver)
Clear the list of GetTreeStates entries (can't fail)
-
-
-
-