Documentation
¶
Index ¶
- Constants
- Variables
- func CheckTransactionisBlock(txhash string, block *rpcclient.DogecoinMsgBlock) bool
- func EnoughAmount(reserve int64, items []*EntangleItem, keepInfo *KeepedAmount) bool
- func GetMaxHeight(items map[uint32]*EntangleTxInfo) uint64
- func IsEntangleTx(tx *wire.MsgTx) (map[uint32]*EntangleTxInfo, error)
- func MakeAddress(puk ecdsa.PublicKey) (error, czzutil.Address)
- func MakeEntangleTx(params *chaincfg.Params, inputs []*wire.TxIn, feeRate, inAmount czzutil.Amount, ...) (*wire.MsgTx, error)
- func MakeMergeCoinbaseTx(tx *wire.MsgTx, pool *PoolAddrItem, items []*EntangleItem, ...) error
- func OverEntangleAmount(tx *wire.MsgTx, pool *PoolAddrItem, items []*EntangleItem, ...) bool
- func PreCalcEntangleAmount(item *EntangleItem, keepInfo *KeepedAmount)
- func RecoverPublicFromBytes(pub []byte, t ExpandedTxType) (*ecdsa.PublicKey, error)
- func SignEntangleTx(tx *wire.MsgTx, inputAmount []czzutil.Amount, priv *czzec.PrivateKey) error
- func UnmarshalPubkey1(pub []byte) (*ecdsa.PublicKey, error)
- func VerifyTxsSequence(infos []*EtsInfo) error
- type CacheEntangleInfo
- type EntangleItem
- type EntangleTxInfo
- type EntangleVerify
- type EtsInfo
- type ExpandedTxType
- type KeepedAmount
- type KeepedItem
- type PoolAddrItem
- type TmpAddressPair
- type TuplePubIndex
Constants ¶
View Source
const ( // Entangle Transcation type ExpandedTxEntangle_Doge = 0xF0 ExpandedTxEntangle_Ltc = 0xF1 )
Variables ¶
View Source
var ( ErrInvalidMsgLen = errors.New("invalid message length, need 32 bytes") ErrInvalidSignatureLen = errors.New("invalid signature length") ErrInvalidRecoveryID = errors.New("invalid signature recovery id") ErrInvalidKey = errors.New("invalid private key") ErrInvalidPubkey = errors.New("invalid public key") ErrSignFailed = errors.New("signing failed") ErrRecoverFailed = errors.New("recovery failed") ErrCryptoType = errors.New("invalid crypto type") )
View Source
var (
BucketKey = []byte("entangle-tx")
)
View Source
var (
ErrHeightTooClose = errors.New("the block heigth to close for entangling")
)
View Source
var (
NoEntangle = errors.New("no entangle info in transcation")
)
Functions ¶
func CheckTransactionisBlock ¶
func CheckTransactionisBlock(txhash string, block *rpcclient.DogecoinMsgBlock) bool
func EnoughAmount ¶
func EnoughAmount(reserve int64, items []*EntangleItem, keepInfo *KeepedAmount) bool
func GetMaxHeight ¶
func GetMaxHeight(items map[uint32]*EntangleTxInfo) uint64
func IsEntangleTx ¶
func IsEntangleTx(tx *wire.MsgTx) (map[uint32]*EntangleTxInfo, error)
func MakeEntangleTx ¶
func MakeMergeCoinbaseTx ¶
func MakeMergeCoinbaseTx(tx *wire.MsgTx, pool *PoolAddrItem, items []*EntangleItem, lastScriptInfo []byte) error
MakeMegerTx
tx (coinbase tx): in: 1 empty hash of coinbase txin 2 pooladdr1 of txin 3 pooladdr2 of txin out: 1. coinbase txout 2. pooladdr1 txout 3. pooladdr2 txout ''''''''''''''' entangle txout1 . . . entangle txoutn '''''''''''''''
func OverEntangleAmount ¶
func OverEntangleAmount(tx *wire.MsgTx, pool *PoolAddrItem, items []*EntangleItem, lastScriptInfo []byte) bool
func PreCalcEntangleAmount ¶
func PreCalcEntangleAmount(item *EntangleItem, keepInfo *KeepedAmount)
func RecoverPublicFromBytes ¶
func RecoverPublicFromBytes(pub []byte, t ExpandedTxType) (*ecdsa.PublicKey, error)
RecoverPublic returns the public key of the marshal bytes.
func SignEntangleTx ¶
func UnmarshalPubkey1 ¶
UnmarshalPubkey converts bytes to a secp256k1 public key.
func VerifyTxsSequence ¶
Types ¶
type CacheEntangleInfo ¶
func (*CacheEntangleInfo) FetchEntangleUtxoView ¶
func (c *CacheEntangleInfo) FetchEntangleUtxoView(info *EntangleTxInfo) bool
type EntangleItem ¶
type EntangleItem struct {
EType ExpandedTxType
Value *big.Int
Addr czzutil.Address
}
func ToEntangleItems ¶
func ToEntangleItems(txs []*czzutil.Tx, addrs map[chainhash.Hash][]*TmpAddressPair) []*EntangleItem
func (*EntangleItem) Clone ¶
func (ii *EntangleItem) Clone() *EntangleItem
type EntangleTxInfo ¶
type EntangleTxInfo struct {
ExTxType ExpandedTxType
Index uint32
Height uint64
Amount *big.Int
ExtTxHash []byte
}
func EntangleTxFromScript ¶
func EntangleTxFromScript(script []byte) (*EntangleTxInfo, error)
func (*EntangleTxInfo) Parse ¶
func (info *EntangleTxInfo) Parse(data []byte) error
func (*EntangleTxInfo) Serialize ¶
func (info *EntangleTxInfo) Serialize() []byte
type EntangleVerify ¶
type EntangleVerify struct {
DogeCoinRPC []*rpcclient.Client
LtcCoinRPC []*rpcclient.Client
Cache *CacheEntangleInfo
}
func (*EntangleVerify) VerifyEntangleTx ¶
func (ev *EntangleVerify) VerifyEntangleTx(tx *wire.MsgTx) ([]*TuplePubIndex, error)
type ExpandedTxType ¶
type ExpandedTxType uint8
type KeepedAmount ¶
type KeepedAmount struct {
Count byte
Items []KeepedItem
}
func KeepedAmountFromScript ¶
func KeepedAmountFromScript(script []byte) (*KeepedAmount, error)
func (*KeepedAmount) Add ¶
func (info *KeepedAmount) Add(item KeepedItem)
func (*KeepedAmount) GetValue ¶
func (info *KeepedAmount) GetValue(t ExpandedTxType) *big.Int
func (*KeepedAmount) Parse ¶
func (info *KeepedAmount) Parse(data []byte) error
func (*KeepedAmount) Serialize ¶
func (info *KeepedAmount) Serialize() []byte
type KeepedItem ¶
type KeepedItem struct {
ExTxType ExpandedTxType
Amount *big.Int
}
type PoolAddrItem ¶
type TmpAddressPair ¶
type TmpAddressPair struct {
// contains filtered or unexported fields
}
the tool function for entangle tx
func ToAddressFromEntangle ¶
func ToAddressFromEntangle(tx *czzutil.Tx, ev *EntangleVerify) ([]*TmpAddressPair, error)
type TuplePubIndex ¶
type TuplePubIndex struct {
EType ExpandedTxType
Index uint32
Pub []byte
}
Click to show internal directories.
Click to hide internal directories.