fix comments

pull/75/head
Minh Doan 6 years ago
parent ec2f1511e8
commit dc0e8a6e23
  1. 3
      blockchain/utxopool.go
  2. 13
      client/btctxiter/btctxiter.go

@ -119,7 +119,8 @@ func (utxoPool *UTXOPool) VerifyStateBlock(stateBlock *Block) bool {
// Add another sanity check function (e.g. spending the same utxo) called before this one.
func (utxoPool *UTXOPool) VerifyOneTransaction(tx *Transaction, spentTXOs *map[[20]byte]map[string]map[uint32]bool) (err error, crossShard bool) {
var nilPubKey [32]byte
if tx.PublicKey == nilPubKey { // TODO(ricl): remove. just for btc replay.
// TODO(ricl): remove. just for btc replay.
if tx.PublicKey == nilPubKey {
return nil, false
}
if len(tx.Proofs) > 1 {

@ -14,6 +14,7 @@ import (
"github.com/btcsuite/btcutil"
)
// BTCTXIterator is a btc transaction iterator.
type BTCTXIterator struct {
blockIndex int64
block *btcjson.GetBlockVerboseResult
@ -22,6 +23,7 @@ type BTCTXIterator struct {
client *rpcclient.Client
}
// Init is an init function of BTCTXIterator.
func (iter *BTCTXIterator) Init() {
btcdHomeDir := btcutil.AppDataDir("btcd", false)
certs, err := ioutil.ReadFile(filepath.Join(btcdHomeDir, "rpc.cert"))
@ -45,7 +47,7 @@ func (iter *BTCTXIterator) Init() {
// defer iter.client.Shutdown()
}
// Move to the next transaction
// NextTx is to move to the next transaction.
func (iter *BTCTXIterator) NextTx() *btcjson.TxRawResult {
iter.txIndex++
if iter.txIndex >= len(iter.block.RawTx) {
@ -57,22 +59,22 @@ func (iter *BTCTXIterator) NextTx() *btcjson.TxRawResult {
return iter.tx
}
// Gets the index/height of the current block
// GetBlockIndex gets the index/height of the current block
func (iter *BTCTXIterator) GetBlockIndex() int64 {
return iter.blockIndex
}
// Gets the current block
// GetBlock gets the current block
func (iter *BTCTXIterator) GetBlock() *btcjson.GetBlockVerboseResult {
return iter.block
}
// Gets the index of the current transaction
// GetTxIndex gets the index of the current transaction
func (iter *BTCTXIterator) GetTxIndex() int {
return iter.txIndex
}
// Gets the current transaction
// GetTx gets the current transaction
func (iter *BTCTXIterator) GetTx() *btcjson.TxRawResult {
return iter.tx
}
@ -98,6 +100,7 @@ func (iter *BTCTXIterator) nextBlock() *btcjson.GetBlockVerboseResult {
return iter.block
}
// IsCoinBaseTx returns true if tx is a coinbase tx.
func IsCoinBaseTx(tx *btcjson.TxRawResult) bool {
// A coin base must only have one transaction input.
if len(tx.Vin) != 1 {

Loading…
Cancel
Save