Skip to content
This repository was archived by the owner on Mar 15, 2019. It is now read-only.

Commit 48295e6

Browse files
committed
Docs and clean-up, export txhelpers.
1 parent b3ec96c commit 48295e6

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

email.go

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"time"
1111
)
1212

13+
// EmailConfig contains the email server address and credentials
1314
type EmailConfig struct {
1415
emailAddr string
1516
smtpUser, smtpPass, smtpServer string

txhelpers.go

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
// txhelpers.go contains helper functions for working with transactions and
2+
// blocks (e.g. checking for a transaction in a block).
3+
14
package main
25

36
import (
7+
"sort"
8+
49
"github.com/decred/dcrd/chaincfg/chainhash"
510
"github.com/decred/dcrd/txscript"
611
"github.com/decred/dcrrpcclient"
712
"github.com/decred/dcrutil"
8-
"sort"
913
)
1014

1115
// TxAction is what is happening to the transaction (mined or inserted into
@@ -19,7 +23,7 @@ const (
1923
// removed? invalidated?
2024
)
2125

22-
func txhashInSlice(txs []*dcrutil.Tx, txHash *chainhash.Hash) *dcrutil.Tx {
26+
func TxhashInSlice(txs []*dcrutil.Tx, txHash *chainhash.Hash) *dcrutil.Tx {
2327
if len(txs) < 1 {
2428
return nil
2529
}
@@ -33,21 +37,21 @@ func txhashInSlice(txs []*dcrutil.Tx, txHash *chainhash.Hash) *dcrutil.Tx {
3337
return nil
3438
}
3539

36-
// includesTx checks if a block contains a transaction hash
37-
func includesStakeTx(txHash *chainhash.Hash, block *dcrutil.Block) (int, int8) {
40+
// includesStakeTx checks if a block contains a stake transaction hash
41+
func IncludesStakeTx(txHash *chainhash.Hash, block *dcrutil.Block) (int, int8) {
3842
blockTxs := block.STransactions()
3943

40-
if tx := txhashInSlice(blockTxs, txHash); tx != nil {
44+
if tx := TxhashInSlice(blockTxs, txHash); tx != nil {
4145
return tx.Index(), tx.Tree()
4246
}
4347
return -1, -1
4448
}
4549

4650
// includesTx checks if a block contains a transaction hash
47-
func includesTx(txHash *chainhash.Hash, block *dcrutil.Block) (int, int8) {
51+
func IncludesTx(txHash *chainhash.Hash, block *dcrutil.Block) (int, int8) {
4852
blockTxs := block.Transactions()
4953

50-
if tx := txhashInSlice(blockTxs, txHash); tx != nil {
54+
if tx := TxhashInSlice(blockTxs, txHash); tx != nil {
5155
return tx.Index(), tx.Tree()
5256
}
5357
return -1, -1

0 commit comments

Comments
 (0)