Interface IStagePolicy
An interface to configure a BlockChain's strategy to deal with staged transactions.
Namespace: Libplanet.Blockchain.Policies
Assembly: Libplanet.dll
Syntax
public interface IStagePolicy
Remarks
Every operation of an implementation of this interface
must be thread-safe.
Methods
| Improve this Doc View SourceGet(BlockChain, TxId, Boolean)
Retrieves a staged Transaction by its id
.
Declaration
Transaction Get(BlockChain blockChain, TxId id, bool filtered = true)
Parameters
Type | Name | Description |
---|---|---|
BlockChain | blockChain | The BlockChain that the stage belongs to. |
TxId | id | The Id to get. |
Boolean | filtered | Whether to filter masked staged Transactions or not. Set to true by default. |
Returns
Type | Description |
---|---|
Transaction | The staged Transaction associated with |
Remarks
Every operation of an implementation of this interface
must be thread-safe.
GetNextTxNonce(BlockChain, Address)
Calculates the next nonce according for given address
.
Declaration
long GetNextTxNonce(BlockChain blockChain, Address address)
Parameters
Type | Name | Description |
---|---|---|
BlockChain | blockChain | The BlockChain that the stage belongs to. |
Address | address | The Address to calculate the next nonce for. |
Returns
Type | Description |
---|---|
Int64 | The next appropriate nonce for |
Remarks
Every operation of an implementation of this interface
must be thread-safe.
Ignore(BlockChain, TxId)
Marks given id
as ignored.
Declaration
void Ignore(BlockChain blockChain, TxId id)
Parameters
Type | Name | Description |
---|---|---|
BlockChain | blockChain | The BlockChain that the stage belongs to. |
TxId | id | The Id to ignore. |
Remarks
If the Transaction associated with id
is already
staged, this also unstages the Transaction.
Ignores(BlockChain, TxId)
Checks if given id
is marked as ignored.
Declaration
bool Ignores(BlockChain blockChain, TxId id)
Parameters
Type | Name | Description |
---|---|---|
BlockChain | blockChain | The BlockChain that the stage belongs to. |
TxId | id | The Id to check. |
Returns
Type | Description |
---|---|
Boolean | true if |
Remarks
Every operation of an implementation of this interface
must be thread-safe.
Iterate(BlockChain, Boolean)
Enumerates all staged Transactions.
Declaration
IEnumerable<Transaction> Iterate(BlockChain blockChain, bool filtered = true)
Parameters
Type | Name | Description |
---|---|---|
BlockChain | blockChain | The BlockChain that the stage belongs to. |
Boolean | filtered | Whether to filter masked staged Transactions or not. Set to true by default. |
Returns
Type | Description |
---|---|
IEnumerable<Transaction> | All staged transactions. No ordering is guaranteed. |
Remarks
Every operation of an implementation of this interface
must be thread-safe.
Stage(BlockChain, Transaction)
Stages a transaction
.
Declaration
bool Stage(BlockChain blockChain, Transaction transaction)
Parameters
Type | Name | Description |
---|---|---|
BlockChain | blockChain | The BlockChain that the stage belongs to. |
Transaction | transaction | The Transaction to be staged. |
Returns
Type | Description |
---|---|
Boolean | true if staging was successful, false otherwise. |
Remarks
This does not throw any exception regardless of whether transaction
was successfully staged or not.
If the Id of transaction
is marked
as ignored, transaction
will not be staged.
Unstage(BlockChain, TxId)
Unstages a transaction id
.
Declaration
bool Unstage(BlockChain blockChain, TxId id)
Parameters
Type | Name | Description |
---|---|---|
BlockChain | blockChain | The BlockChain that the stage belongs to. |
TxId | id | The Id to unstage. |
Returns
Type | Description |
---|---|
Boolean | true if unstaging was successful, false otherwise. |
Remarks
This does not throw any exception regardless of whether id
was
successfully unstaged or not.