Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddressGenerator ¶
type AddressGenerator struct {
// contains filtered or unexported fields
}
func NewAddressGenerator ¶
func NewAddressGenerator(masterPublicKeyString string, chainParams *chaincfg.Params) (*AddressGenerator, error)
type Listener ¶
type Listener struct { Enabled bool Client Client `inject:""` Storage Storage `inject:""` TransactionHandler TransactionHandler Testnet bool // contains filtered or unexported fields }
Listener listens for transactions using bitcoin-core RPC. It calls TransactionHandler for each new transactions. It will reprocess the block if TransactionHandler returns error. It will start from the block number returned from Storage.GetBitcoinBlockToProcess or the latest block if it returned 0. Transactions can be processed more than once, it's TransactionHandler responsibility to ignore duplicates. Listener tracks only P2PKH payments. You can run multiple Listeners if Storage is implemented correctly.
type Storage ¶
type Storage interface { // GetBitcoinBlockToProcess gets the number of Bitcoin block to process. `0` means the // processing should start from the current block. GetBitcoinBlockToProcess() (uint64, error) // SaveLastProcessedBitcoinBlock should update the number of the last processed Bitcoin // block. It should only update the block if block > current block in atomic transaction. SaveLastProcessedBitcoinBlock(block uint64) error }
Storage is an interface that must be implemented by an object using persistent storage.
type Transaction ¶
func (Transaction) ValueToHcNet ¶
func (t Transaction) ValueToHcNet() string
type TransactionHandler ¶
type TransactionHandler func(transaction Transaction) error
Click to show internal directories.
Click to hide internal directories.