nodelist

package module
Version: v0.0.0-...-d90bc59 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2020 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeout = errors.New("Request timeout")
)

Functions

func GetNodeList

func GetNodeList(addresses []string) (map[string]*struct{}, error)

Types

type ApiNode

type ApiNode struct {
	Address        string
	Version        string
	API            *api.API
	APICheckHealth *api.API
}

type ApiNodeList

type ApiNodeList struct {
	// contains filtered or unexported fields
}

func (*ApiNodeList) AttachToTangle

func (nl *ApiNodeList) AttachToTangle(trunkTxHash trinary.Hash, branchTxHash trinary.Hash, mwm uint64, trytes []trinary.Trytes) ([]trinary.Trytes, error)

AttachToTangle performs the Proof-of-Work required to attach a transaction to the Tangle by calling the attachToTangle IRI API command. Returns a list of transaction trytes and overwrites the following fields:

Hash, Nonce, AttachmentTimestamp, AttachmentTimestampLowerBound, AttachmentTimestampUpperBound

If a Proof-of-Work function is supplied when composing the API, then that function is used instead of using the connected node.

func (*ApiNodeList) BroadcastTransactions

func (nl *ApiNodeList) BroadcastTransactions(trytes ...trinary.Trytes) ([]trinary.Trytes, error)

BroadcastTransactions broadcasts a list of attached transaction trytes to the network. Tip-selection and Proof-of-Work must be done first by calling GetTransactionsToApprove and AttachToTangle or an equivalent attach method.

You may use this method to increase odds of effective transaction propagation.

Persist the transaction trytes in local storage before calling this command for first time, to ensure that reattachment is possible, until your bundle has been included.

func (*ApiNodeList) CheckConsistency

func (nl *ApiNodeList) CheckConsistency(hashes ...trinary.Hash) (bool, string, error)

CheckConsistency checks if a transaction is consistent or a set of transactions are co-consistent.

Co-consistent transactions and the transactions that they approve (directly or indirectly), are not conflicting with each other and the rest of the ledger.

As long as a transaction is consistent, it might be accepted by the network. In case a transaction is inconsistent, it will not be accepted and a reattachment is required by calling ReplayBundle().

func (*ApiNodeList) Close

func (nl *ApiNodeList) Close()

func (*ApiNodeList) ExecuteFunc

func (nl *ApiNodeList) ExecuteFunc(signalChanTimeout chan bool, signalChanQuit chan struct{}, fn func(*ApiNode) error, maxRetries int) error

func (*ApiNodeList) FindTransactions

func (nl *ApiNodeList) FindTransactions(query api.FindTransactionsQuery) (trinary.Hashes, error)

FindTransactions searches for transaction hashes. It allows to search for transactions by passing a query object with addresses, bundle hashes, tags and/or approvees fields. Multiple query fields are supported and FindTransactions returns the intersection of the results.

func (*ApiNodeList) GetBalances

func (nl *ApiNodeList) GetBalances(addresses trinary.Hashes) (*api.Balances, error)

GetBalances fetches confirmed balances of the given addresses at the latest solid milestone.

func (*ApiNodeList) GetHealthyNodeCount

func (nl *ApiNodeList) GetHealthyNodeCount() int

func (*ApiNodeList) GetInclusionStates

func (nl *ApiNodeList) GetInclusionStates(txHashes trinary.Hashes) ([]bool, error)

GetInclusionStates fetches inclusion states of a given list of transactions.

func (*ApiNodeList) GetLatestMilestone

func (nl *ApiNodeList) GetLatestMilestone() (milestone *Milestone)

GetLatestMilestone returns the latest milestone.

func (*ApiNodeList) GetLatestSolidMilestone

func (nl *ApiNodeList) GetLatestSolidMilestone() (milestone *Milestone)

GetLatestSolidMilestone returns the latest solid milestone.

func (*ApiNodeList) GetNodeInfo

func (nl *ApiNodeList) GetNodeInfo() (*api.GetNodeInfoResponse, error)

GetNodeInfo returns information about the connected node.

func (*ApiNodeList) GetTotalNodeCount

func (nl *ApiNodeList) GetTotalNodeCount() int

func (*ApiNodeList) GetTransactionsToApprove

func (nl *ApiNodeList) GetTransactionsToApprove(reference ...trinary.Hash) (*api.TransactionsToApprove, error)

GetTransactionsToApprove does the tip selection via the connected node.

Returns a pair of approved transactions which are chosen randomly after validating the transaction trytes, the signatures and cross-checking for conflicting transactions.

Tip selection is executed by a Random Walk (RW) starting at random point in the given depth, ending up to the pair of selected tips. For more information about tip selection please refer to the whitepaper (http://iotatoken.com/IOTA_Whitepaper.pdf).

The reference option allows to select tips in a way that the reference transaction is being approved too. This is useful for promoting transactions, for example with PromoteTransaction().

func (*ApiNodeList) GetTrytes

func (nl *ApiNodeList) GetTrytes(hashes ...trinary.Hash) ([]trinary.Trytes, error)

GetTrytes fetches the transaction trytes given a list of transaction hashes.

func (*ApiNodeList) HandleError

func (nl *ApiNodeList) HandleError(apiNode *ApiNode, err error) (quit bool)

func (*ApiNodeList) HandleRequests

func (nl *ApiNodeList) HandleRequests()

func (*ApiNodeList) HandleResponse

func (nl *ApiNodeList) HandleResponse(apiNode *ApiNode, pr *PendingApiRequest, resp interface{}, err error) (quit bool)

func (*ApiNodeList) Init

func (nl *ApiNodeList) Init(nodes []string, timeout time.Duration, validVersions []string, milestoneTolerance int64, startNodeWorkers bool) error

func (*ApiNodeList) StoreTransactions

func (nl *ApiNodeList) StoreTransactions(trytes ...trinary.Trytes) ([]trinary.Trytes, error)

StoreTransactions persists a list of attached transaction trytes in the store of the connected node. Tip-selection and Proof-of-Work must be done first by calling GetTransactionsToApprove and AttachToTangle or an equivalent attach method.

Persist the transaction trytes in local storage before calling this command, to ensure reattachment is possible, until your bundle has been included.

Any transactions stored with this command will eventually be erased as a result of a snapshot.

func (*ApiNodeList) WereAddressesSpentFrom

func (nl *ApiNodeList) WereAddressesSpentFrom(addresses ...trinary.Hash) ([]bool, error)

WereAddressesSpentFrom checks whether the given addresses were already spent from by calling the wereAddressesSpentFrom IRI API command.

type JSON_NodesIotaWorks

type JSON_NodesIotaWorks struct {
	Host string `json:"node"`
}

type Milestone

type Milestone struct {
	Hash      *trinary.Hash
	Index     int64
	Timestamp uint64
}

type PendingApiRequest

type PendingApiRequest struct {
	// contains filtered or unexported fields
}

PendingApiRequest contains the information about a request and the response channel for signaling

func (*PendingApiRequest) CheckTimeoutSignal

func (pr *PendingApiRequest) CheckTimeoutSignal() (timedOut bool)

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL