litecoin

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: AGPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MainnetMagic wire.BitcoinNet = 0xdbb6c0fb
	TestnetMagic wire.BitcoinNet = 0xf1c8d2fd
	RegtestMagic wire.BitcoinNet = 0xdab5bffa
)

magic numbers

Variables

View Source
var (
	MainNetParams chaincfg.Params
	TestNetParams chaincfg.Params
)

chain parameters

Functions

func GetChainParams

func GetChainParams(chain string) *chaincfg.Params

GetChainParams contains network parameters for the main Litecoin network, and the test Litecoin network

func NewLitecoinRPC

func NewLitecoinRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error)

NewLitecoinRPC returns new LitecoinRPC instance.

Types

type LitecoinParser

type LitecoinParser struct {
	*btc.BitcoinLikeParser
	// contains filtered or unexported fields
}

LitecoinParser handle

func NewLitecoinParser

func NewLitecoinParser(params *chaincfg.Params, c *btc.Configuration) *LitecoinParser

NewLitecoinParser returns new LitecoinParser instance

func (*LitecoinParser) PackTx added in v0.4.0

func (p *LitecoinParser) PackTx(tx *bchain.Tx, height uint32, blockTime int64) ([]byte, error)

PackTx packs transaction to byte array using protobuf

func (*LitecoinParser) ParseTxFromJson added in v0.4.0

func (p *LitecoinParser) ParseTxFromJson(msg json.RawMessage) (*bchain.Tx, error)

ParseTxFromJson parses JSON message containing transaction and returns Tx struct

func (*LitecoinParser) UnpackTx added in v0.4.0

func (p *LitecoinParser) UnpackTx(buf []byte) (*bchain.Tx, uint32, error)

UnpackTx unpacks transaction from protobuf byte array

type LitecoinRPC

type LitecoinRPC struct {
	*btc.BitcoinRPC
}

LitecoinRPC is an interface to JSON-RPC bitcoind service.

func (*LitecoinRPC) GetBlock added in v0.4.0

func (b *LitecoinRPC) GetBlock(hash string, height uint32) (*bchain.Block, error)

GetBlock returns block with given hash. Litecoin cannot use optimized BitcoinRPC.GetBlock since v 0.21.2, which introduced MWEB fields to the transaction data and made the serialized block incompatible with Bitcoin wire protocol

func (*LitecoinRPC) GetTransactionForMempool added in v0.4.0

func (b *LitecoinRPC) GetTransactionForMempool(txid string) (*bchain.Tx, error)

GetTransactionForMempool returns a transaction by the transaction ID Litecoin cannot use optimized BitcoinRPC.GetTransactionForMempool since v 0.21.2, which introduced MWEB fields to the transaction data and made the serialized transaction incompatible with Bitcoin wire protocol

func (*LitecoinRPC) Initialize

func (b *LitecoinRPC) Initialize() error

Initialize initializes LitecoinRPC instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL