func txOutToSpendableOut(tx *provautil.Tx, outputNum uint32) spendableOutput {
	return spendableOutput{
		outPoint: wire.OutPoint{Hash: *tx.Hash(), Index: outputNum},
		amount:   provautil.Amount(tx.MsgTx().TxOut[outputNum].Value),
	}
}
txOutToSpendableOut returns a spendable output given a transaction and index
of the output to use.  This is useful as a convenience when creating test
transactions.
package mempool
import (
	"encoding/hex"
	"github.com/bitgo/prova/blockchain"
	"github.com/bitgo/prova/btcec"
	"github.com/bitgo/prova/chaincfg"
	"github.com/bitgo/prova/chaincfg/chainhash"
	"github.com/bitgo/prova/provautil"
	"github.com/bitgo/prova/txscript"
	"github.com/bitgo/prova/wire"
	"reflect"
	"runtime"
	"sync"
	"testing"
	"time"
)
type fakeChain struct {
	sync.RWMutex
	utxos          *blockchain.UtxoViewpoint
	currentHeight  uint32
	medianTimePast time.Time
}
func (s *fakeChain) FetchUtxoView(tx *provautil.Tx) (*blockchain.UtxoViewpoint, error) {
	s.RLock()
	defer s.RUnlock()
	viewpoint := blockchain.NewUtxoViewpoint()
	entry := s.utxos.LookupEntry(tx.Hash())
	viewpoint.Entries()[*tx.Hash()] = entry.Clone()
	for _, txIn := range tx.MsgTx().TxIn {
		originHash := &txIn.PreviousOutPoint.Hash
		entry := s.utxos.LookupEntry(originHash)
		viewpoint.Entries()[*originHash] = entry.Clone()
	}
	return viewpoint, nil
}
func hexToBytes(s string) []byte {
	b, err := hex.DecodeString(s)
	if err != nil {
		panic("invalid hex in source file: " + s)
	}
	return b
}
func (s *fakeChain) ThreadTips() map[provautil.ThreadID]*wire.OutPoint {
	return make(map[provautil.ThreadID]*wire.OutPoint)
}
func (s *fakeChain) LastKeyID() btcec.KeyID {
	return btcec.KeyID(0)
}
func (s *fakeChain) TotalSupply() uint64 {
	return uint64(0)
}
func (s *fakeChain) AdminKeySets() map[btcec.KeySetType]btcec.PublicKeySet {
	return make(map[btcec.KeySetType]btcec.PublicKeySet)
}
func (s *fakeChain) KeyIDs() btcec.KeyIdMap {
	keyId1 := btcec.KeyIDFromAddressBuffer([]byte{0, 0, 1, 0})
	pubKey1, _ := btcec.ParsePubKey(hexToBytes("025ceeba2ab4a635df2c0301a3d773da06ac5a18a7c3e0d09a795d7e57d233edf1"), btcec.S256())
	keyId2 := btcec.KeyIDFromAddressBuffer([]byte{1, 0, 0, 0})
	pubKey2, _ := btcec.ParsePubKey(hexToBytes("038ef4a121bcaf1b1f175557a12896f8bc93b095e84817f90e9a901cd2113a8202"), btcec.S256())
	return map[btcec.KeyID]*btcec.PublicKey{keyId1: pubKey1, keyId2: pubKey2}
}
func (s *fakeChain) BestHeight() uint32 {
	s.RLock()
	height := s.currentHeight
	s.RUnlock()
	return height
}
func (s *fakeChain) SetHeight(height uint32) {
	s.Lock()
	s.currentHeight = height
	s.Unlock()
}
func (s *fakeChain) MedianTimePast() time.Time {
	s.RLock()
	mtp := s.medianTimePast
	s.RUnlock()
	return mtp
}
func (s *fakeChain) SetMedianTimePast(mtp time.Time) {
	s.Lock()
	s.medianTimePast = mtp
	s.Unlock()
}
func (s *fakeChain) CalcSequenceLock(tx *provautil.Tx,
	view *blockchain.UtxoViewpoint) (*blockchain.SequenceLock, error) {
	return &blockchain.SequenceLock{
		Seconds:     -1,
		BlockHeight: -1,
	}, nil
}
type spendableOutput struct {
	outPoint wire.OutPoint
	amount   provautil.Amount
}