Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint after btcwire API change.

This commit is contained in:
Jonathan Gillham 2014-10-01 16:34:30 +01:00
parent 02647404fa
commit 1bbd1e9cba
4 changed files with 19 additions and 19 deletions

View File

@ -340,7 +340,7 @@ func checkInputsStandard(tx *btcutil.Tx, txStore btcchain.TxStore) error {
// It is safe to elide existence and index checks here since
// they have already been checked prior to calling this
// function.
prevOut := txIn.PreviousOutpoint
prevOut := txIn.PreviousOutPoint
originTx := txStore[prevOut.Hash].Tx.MsgTx()
originPkScript := originTx.TxOut[prevOut.Index].PkScript
@ -408,7 +408,7 @@ func (mp *txMemPool) removeOrphan(txHash *btcwire.ShaHash) {
// Remove the reference from the previous orphan index.
for _, txIn := range tx.MsgTx().TxIn {
originTxHash := txIn.PreviousOutpoint.Hash
originTxHash := txIn.PreviousOutPoint.Hash
if orphans, exists := mp.orphansByPrev[originTxHash]; exists {
for e := orphans.Front(); e != nil; e = e.Next() {
if e.Value.(*btcutil.Tx) == tx {
@ -485,7 +485,7 @@ func (mp *txMemPool) addOrphan(tx *btcutil.Tx) {
mp.orphans[*tx.Sha()] = tx
for _, txIn := range tx.MsgTx().TxIn {
originTxHash := txIn.PreviousOutpoint.Hash
originTxHash := txIn.PreviousOutPoint.Hash
if mp.orphansByPrev[originTxHash] == nil {
mp.orphansByPrev[originTxHash] = list.New()
}
@ -610,7 +610,7 @@ func (mp *txMemPool) removeTransaction(tx *btcutil.Tx) {
// by the pool.
if txDesc, exists := mp.pool[*txHash]; exists {
for _, txIn := range txDesc.Tx.MsgTx().TxIn {
delete(mp.outpoints, txIn.PreviousOutpoint)
delete(mp.outpoints, txIn.PreviousOutPoint)
}
delete(mp.pool, *txHash)
mp.lastUpdated = time.Now()
@ -642,7 +642,7 @@ func (mp *txMemPool) RemoveDoubleSpends(tx *btcutil.Tx) {
defer mp.Unlock()
for _, txIn := range tx.MsgTx().TxIn {
if txRedeemer, ok := mp.outpoints[txIn.PreviousOutpoint]; ok {
if txRedeemer, ok := mp.outpoints[txIn.PreviousOutPoint]; ok {
if !txRedeemer.Sha().IsEqual(tx.Sha()) {
mp.removeTransaction(txRedeemer)
}
@ -665,7 +665,7 @@ func (mp *txMemPool) addTransaction(tx *btcutil.Tx, height, fee int64) {
Fee: fee,
}
for _, txIn := range tx.MsgTx().TxIn {
mp.outpoints[txIn.PreviousOutpoint] = tx
mp.outpoints[txIn.PreviousOutPoint] = tx
}
mp.lastUpdated = time.Now()
}
@ -678,7 +678,7 @@ func (mp *txMemPool) addTransaction(tx *btcutil.Tx, height, fee int64) {
// This function MUST be called with the mempool lock held (for reads).
func (mp *txMemPool) checkPoolDoubleSpend(tx *btcutil.Tx) error {
for _, txIn := range tx.MsgTx().TxIn {
if txR, exists := mp.outpoints[txIn.PreviousOutpoint]; exists {
if txR, exists := mp.outpoints[txIn.PreviousOutPoint]; exists {
str := fmt.Sprintf("transaction %v in the pool "+
"already spends the same coins", txR.Sha())
return txRuleError(btcwire.RejectDuplicate, str)

View File

@ -231,7 +231,7 @@ func createCoinbaseTx(coinbaseScript []byte, nextBlockHeight int64, addr btcutil
tx.AddTxIn(&btcwire.TxIn{
// Coinbase transactions have no inputs, so previous outpoint is
// zero hash and max index.
PreviousOutpoint: *btcwire.NewOutPoint(&btcwire.ShaHash{},
PreviousOutPoint: *btcwire.NewOutPoint(&btcwire.ShaHash{},
btcwire.MaxPrevOutIndex),
SignatureScript: coinbaseScript,
Sequence: btcwire.MaxTxInSequenceNum,
@ -287,8 +287,8 @@ func calcPriority(tx *btcutil.Tx, serializedTxSize int, inputValueAge float64) f
// the store at the provided height.
func spendTransaction(txStore btcchain.TxStore, tx *btcutil.Tx, height int64) error {
for _, txIn := range tx.MsgTx().TxIn {
originHash := &txIn.PreviousOutpoint.Hash
originIndex := txIn.PreviousOutpoint.Index
originHash := &txIn.PreviousOutPoint.Hash
originIndex := txIn.PreviousOutPoint.Index
if originTx, exists := txStore[*originHash]; exists {
originTx.Spent[originIndex] = true
}
@ -523,8 +523,8 @@ mempoolLoop:
prioItem := &txPrioItem{tx: txDesc.Tx}
inputValueAge := float64(0.0)
for _, txIn := range tx.MsgTx().TxIn {
originHash := &txIn.PreviousOutpoint.Hash
originIndex := txIn.PreviousOutpoint.Index
originHash := &txIn.PreviousOutPoint.Hash
originIndex := txIn.PreviousOutPoint.Index
txData, exists := txStore[*originHash]
if !exists || txData.Err != nil || txData.Tx == nil {
if !mempool.HaveTransaction(originHash) {

View File

@ -833,8 +833,8 @@ func createVinList(mtx *btcwire.MsgTx) ([]btcjson.Vin, error) {
if btcchain.IsCoinBase(tx) {
vinList[i].Coinbase = hex.EncodeToString(v.SignatureScript)
} else {
vinList[i].Txid = v.PreviousOutpoint.Hash.String()
vinList[i].Vout = v.PreviousOutpoint.Index
vinList[i].Txid = v.PreviousOutPoint.Hash.String()
vinList[i].Vout = v.PreviousOutPoint.Index
disbuf, err := btcscript.DisasmString(v.SignatureScript)
if err != nil {
@ -1606,7 +1606,7 @@ func (state *gbtWorkState) blockTemplateResult(useCoinbaseValue bool, submitOld
// when mutiple inputs reference the same transaction.
dependsMap := make(map[int64]struct{})
for _, txIn := range tx.TxIn {
if idx, ok := txIndex[txIn.PreviousOutpoint.Hash]; ok {
if idx, ok := txIndex[txIn.PreviousOutPoint.Hash]; ok {
dependsMap[idx] = struct{}{}
}
}
@ -2306,7 +2306,7 @@ func handleGetRawMempool(s *rpcServer, cmd btcjson.Cmd, closeChan <-chan struct{
Depends: make([]string, 0),
}
for _, txIn := range desc.Tx.MsgTx().TxIn {
hash := &txIn.PreviousOutpoint.Hash
hash := &txIn.PreviousOutPoint.Hash
if s.server.txMemPool.HaveTransaction(hash) {
mpd.Depends = append(mpd.Depends,
hash.String())

View File

@ -688,7 +688,7 @@ func (m *wsNotificationManager) notifyForTxIns(ops map[btcwire.OutPoint]map[chan
txHex := ""
wscNotified := make(map[chan struct{}]struct{})
for _, txIn := range tx.MsgTx().TxIn {
prevOut := &txIn.PreviousOutpoint
prevOut := &txIn.PreviousOutPoint
if cmap, ok := ops[*prevOut]; ok {
if txHex == "" {
txHex = txHexString(tx)
@ -1484,8 +1484,8 @@ func rescanBlock(wsc *wsClient, lookups *rescanKeys, blk *btcutil.Block) {
recvNotified := false
for _, txin := range tx.MsgTx().TxIn {
if _, ok := lookups.unspent[txin.PreviousOutpoint]; ok {
delete(lookups.unspent, txin.PreviousOutpoint)
if _, ok := lookups.unspent[txin.PreviousOutPoint]; ok {
delete(lookups.unspent, txin.PreviousOutPoint)
if spentNotified {
continue