Class FlashNode

class FlashNode
  : FlashControlAPI ;

Constructors

NameDescription
this (conf, db_path, genesis_hash, engine, taskman, postTransaction, getBlock, makeRegistryClient) Constructor

Fields

NameTypeDescription
channels Channel[geod24.bitblob.BitBlob!(64L)]All channels which we are the participants of (open / pending / closed)
conf FlashConfigFlash config which remains static after boot but may change after restart
engine EngineExecution engine
genesis_hash const(geod24.bitblob.BitBlob!(64L))Hash of the genesis block
getBlock @safe const(Block) delegate(ulong)Callback for fetching a block
known_peers FlashAPI[PublicKey]All known connected peers (used for gossiping)
listener FlashListenerAPIAny listener
log LoggerLogger instance
makeRegistryClient NameRegistryAPI delegate(Address)
monitor_timer ITimermonitor timer
network NetworkFlash network topology
pending_channels std.container.dlist.DList!(agora.flash.Node.FlashNode.PendingChannel)List of channels which are pending to be opened
periodic_timer ITimerPeriodic name registry timer
postTransaction TransactionResult delegate(in ref Transaction)Callback for sending transactions to the network
taskman ITaskManagerfor scheduling

Methods

NameDescription
beginCollaborativeClose (reg_pk, chan_id)
beginUnilateralClose (reg_pk, chan_id)
closeChannel (sender_pk, recv_pk, chan_id, seq_id, peer_nonce, fee) See FlashAPI.closeChannel
confirmChannelUpdate (sender_pk, recv_pk, chan_id, seq_id) See FlashAPI.confirmChannelUpdate
createNewInvoice (reg_pk, amount, expiry, description)
getChannelInfo (chan_ids) Get the list of managed channels.
getManagedChannels (keys) Get the list of managed channels.
getManagedKeys ()
gossipChannelsOpen (opens) See FlashAPI.gossipChannelsOpen
gossipChannelUpdates (chan_updates) See FlashAPI.gossipChannelUpdates
openChannel (chan_conf, peer_nonce, funder_address) See FlashAPI.openChannel
openNewChannel (funding_utxo, funding_utxo_hash, capacity, settle_time, recv_pk, is_private, peer_address)
payInvoice (reg_pk, invoice) Finds a payment path for the invoice and attempts to pay it
proposePayment (sender_pk, recv_pk, chan_id, seq_id, payment_hash, amount, lock_height, packet, peer_nonce, height) See FlashAPI.proposePayment
proposeUpdate (sender_pk, recv_pk, chan_id, seq_id, secrets, rev_htlcs, peer_nonce, height) See FlashAPI.proposeUpdate
pushBlock (block) Called by a FullNode once a block has been externalized
registerKey (kp) Register the given key-pair to be used with this Flash node.
reportPaymentError (recv_pk, chan_id, err) See FlashAPI.reportPaymentError
requestCloseSig (sender_pk, recv_pk, chan_id, seq_id) See FlashAPI.requestCloseSig
requestSettleSig (sender_pk, recv_pk, chan_id, seq_id) See FlashAPI.requestSettleSig
requestUpdateSig (sender_pk, recv_pk, chan_id, seq_id) See FlashAPI.requestUpdateSig
shutdown () Store all the node's and each channels' metadata to the DB, and shut down the gossiping timer.
start () Start the gossiping timer and connect to the listener
startControlInterface () Start listening for requests
waitChannelOpen (chan_id)
closeChannel (sender_pk, recv_pk, chan_id, seq_id, peer_nonce, fee) Requests collaboratively closing an existing channel with this peer.
confirmChannelUpdate (sender_pk, recv_pk, chan_id, seq_id) Called by the peer when it has finished collecting the settlement & update transactions. It signals to the called node that the peer is ready for any new payments / updates.
openChannel (chan_conf, peer_nonce, funder_address) Requests opening a channel with the provided peer, if it's managed by this Flash node.
proposePayment (sender_pk, recv_pk, chan_id, seq_id, payment_hash, amount, lock_height, packet, peer_nonce, height) Proposes a payment through this channel. This may be a direct payment, or an indirect routed payment. Both types of payments use this API.
proposeUpdate (sender_pk, recv_pk, chan_id, seq_id, secrets, rev_htlcs, peer_nonce, height) Proposes updating the channel by resolving all pending HTLCs with the secrets the counter-party offers.
requestCloseSig (sender_pk, recv_pk, chan_id, seq_id) Requests a closing signature for an established channel and a previously agreed-upon closeChannel request with the given sequence ID.
requestSettleSig (sender_pk, recv_pk, chan_id, seq_id) Requests a settlement signature for an established channel and a previously agreed-upon balance update's sequence ID as set through the proposePayment / proposeUpdate call.
requestUpdateSig (sender_pk, recv_pk, chan_id, seq_id) Requests an update signature for an established channel and a previously agreed-upon balance update's sequence ID as set through the proposePayment / proposeUpdate call.
start () Start the Flash node. This starts internal timers such as the periodic name registry timer.
getFeeUTXOs (tx_size)
getFlashClient (peer_pk, timeout, address) Get an instance of a Flash client for the given public key. The name registry is consulted to look up the IP for the given key.
getManagedDatabase (db_path) Overridable in tests to test restart behavior.
makeFlashClient (address, timeout) Get an instance of a Flash client for the given public key. The name registry is consulted to look up the IP for the given key.
makeFlashListenerClient (address, timeout) Make an instance of a FlashListenerAPI client for the given address.
monitorBlockchain () Monitors the blockchain for any new externalized blocks.
onPaymentComplete (reg_pk, chan_id, payment_hash, error) Called by a channel once a payment has been completed.
onUpdateComplete (reg_pk, secrets, rev_htlcs) Called by a channel once an update has been completed.
paymentRouter (reg_pk, chan_id, payment_hash, amount, lock_height, packet) Routes an onion-encrypted payment to the given channel ID.