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

This commit is contained in:
Jonathan Gillham 2014-10-01 13:53:47 +01:00
parent f5f03e8172
commit f60e503308
4 changed files with 22 additions and 22 deletions

View file

@ -53,7 +53,7 @@ out:
case txVI := <-v.validateChan:
// Ensure the referenced input transaction is available.
txIn := txVI.txIn
originTxHash := &txIn.PreviousOutpoint.Hash
originTxHash := &txIn.PreviousOutPoint.Hash
originTx, exists := v.txStore[*originTxHash]
if !exists || originTx.Err != nil || originTx.Tx == nil {
str := fmt.Sprintf("unable to find input "+
@ -68,7 +68,7 @@ out:
// Ensure the output index in the referenced transaction
// is available.
originTxIndex := txIn.PreviousOutpoint.Index
originTxIndex := txIn.PreviousOutPoint.Index
if originTxIndex >= uint32(len(originMsgTx.TxOut)) {
str := fmt.Sprintf("out of bounds "+
"input index %d in transaction %v "+
@ -198,7 +198,7 @@ func ValidateTransactionScripts(tx *btcutil.Tx, txStore TxStore, flags btcscript
txValItems := make([]*txValidateItem, 0, len(txIns))
for txInIdx, txIn := range txIns {
// Skip coinbases.
if txIn.PreviousOutpoint.Index == math.MaxUint32 {
if txIn.PreviousOutPoint.Index == math.MaxUint32 {
continue
}
@ -240,7 +240,7 @@ func checkBlockScripts(block *btcutil.Block, txStore TxStore) error {
for _, tx := range block.Transactions() {
for txInIdx, txIn := range tx.MsgTx().TxIn {
// Skip coinbases.
if txIn.PreviousOutpoint.Index == math.MaxUint32 {
if txIn.PreviousOutPoint.Index == math.MaxUint32 {
continue
}

View file

@ -47,8 +47,8 @@ func connectTransactions(txStore TxStore, block *btcutil.Block) error {
// Spend the origin transaction output.
for _, txIn := range msgTx.TxIn {
originHash := &txIn.PreviousOutpoint.Hash
originIndex := txIn.PreviousOutpoint.Index
originHash := &txIn.PreviousOutPoint.Hash
originIndex := txIn.PreviousOutPoint.Index
if originTx, exists := txStore[*originHash]; exists {
if originIndex > uint32(len(originTx.Spent)) {
continue
@ -82,8 +82,8 @@ func disconnectTransactions(txStore TxStore, block *btcutil.Block) error {
// Unspend the origin transaction output.
for _, txIn := range tx.MsgTx().TxIn {
originHash := &txIn.PreviousOutpoint.Hash
originIndex := txIn.PreviousOutpoint.Index
originHash := &txIn.PreviousOutPoint.Hash
originIndex := txIn.PreviousOutPoint.Index
originTx, exists := txStore[*originHash]
if exists && originTx.Tx != nil && originTx.Err == nil {
if originIndex > uint32(len(originTx.Spent)) {
@ -252,7 +252,7 @@ func (b *BlockChain) fetchInputTransactions(node *blockNode, block *btcutil.Bloc
for _, txIn := range tx.MsgTx().TxIn {
// Add an entry to the transaction store for the needed
// transaction with it set to missing by default.
originHash := &txIn.PreviousOutpoint.Hash
originHash := &txIn.PreviousOutPoint.Hash
txD := &TxData{Hash: originHash, Err: btcdb.ErrTxShaMissing}
txStore[*originHash] = txD
@ -306,7 +306,7 @@ func (b *BlockChain) FetchTransactionStore(tx *btcutil.Tx) (TxStore, error) {
txNeededSet := make(map[btcwire.ShaHash]struct{})
txNeededSet[*tx.Sha()] = struct{}{}
for _, txIn := range tx.MsgTx().TxIn {
txNeededSet[txIn.PreviousOutpoint.Hash] = struct{}{}
txNeededSet[txIn.PreviousOutPoint.Hash] = struct{}{}
}
// Request the input transactions from the point of view of the end of

View file

@ -104,7 +104,7 @@ func IsCoinBase(tx *btcutil.Tx) bool {
// The previous output of a coin base must have a max value index and
// a zero hash.
prevOut := msgTx.TxIn[0].PreviousOutpoint
prevOut := msgTx.TxIn[0].PreviousOutPoint
if prevOut.Index != math.MaxUint32 || !prevOut.Hash.IsEqual(zeroHash) {
return false
}
@ -246,11 +246,11 @@ func CheckTransactionSanity(tx *btcutil.Tx) error {
// Check for duplicate transaction inputs.
existingTxOut := make(map[btcwire.OutPoint]struct{})
for _, txIn := range msgTx.TxIn {
if _, exists := existingTxOut[txIn.PreviousOutpoint]; exists {
if _, exists := existingTxOut[txIn.PreviousOutPoint]; exists {
return ruleError(ErrDuplicateTxInputs, "transaction "+
"contains duplicate inputs")
}
existingTxOut[txIn.PreviousOutpoint] = struct{}{}
existingTxOut[txIn.PreviousOutPoint] = struct{}{}
}
// Coinbase script length must be between min and max length.
@ -266,7 +266,7 @@ func CheckTransactionSanity(tx *btcutil.Tx) error {
// Previous transaction outputs referenced by the inputs to this
// transaction must not be null.
for _, txIn := range msgTx.TxIn {
prevOut := &txIn.PreviousOutpoint
prevOut := &txIn.PreviousOutPoint
if isNullOutpoint(prevOut) {
return ruleError(ErrBadTxInput, "transaction "+
"input refers to previous output that "+
@ -369,7 +369,7 @@ func CountP2SHSigOps(tx *btcutil.Tx, isCoinBaseTx bool, txStore TxStore) (int, e
totalSigOps := 0
for _, txIn := range msgTx.TxIn {
// Ensure the referenced input transaction is available.
txInHash := &txIn.PreviousOutpoint.Hash
txInHash := &txIn.PreviousOutPoint.Hash
originTx, exists := txStore[*txInHash]
if !exists || originTx.Err != nil || originTx.Tx == nil {
str := fmt.Sprintf("unable to find input transaction "+
@ -381,7 +381,7 @@ func CountP2SHSigOps(tx *btcutil.Tx, isCoinBaseTx bool, txStore TxStore) (int, e
// Ensure the output index in the referenced transaction is
// available.
originTxIndex := txIn.PreviousOutpoint.Index
originTxIndex := txIn.PreviousOutPoint.Index
if originTxIndex >= uint32(len(originMsgTx.TxOut)) {
str := fmt.Sprintf("out of bounds input index %d in "+
"transaction %v referenced from transaction %v",
@ -667,7 +667,7 @@ func CheckTransactionInputs(tx *btcutil.Tx, txHeight int64, txStore TxStore) (in
var totalSatoshiIn int64
for _, txIn := range tx.MsgTx().TxIn {
// Ensure the input is available.
txInHash := &txIn.PreviousOutpoint.Hash
txInHash := &txIn.PreviousOutPoint.Hash
originTx, exists := txStore[*txInHash]
if !exists || originTx.Err != nil || originTx.Tx == nil {
str := fmt.Sprintf("unable to find input transaction "+
@ -691,7 +691,7 @@ func CheckTransactionInputs(tx *btcutil.Tx, txHeight int64, txStore TxStore) (in
}
// Ensure the transaction is not double spending coins.
originTxIndex := txIn.PreviousOutpoint.Index
originTxIndex := txIn.PreviousOutPoint.Index
if originTxIndex >= uint32(len(originTx.Spent)) {
str := fmt.Sprintf("out of bounds input index %d in "+
"transaction %v referenced from transaction %v",

View file

@ -152,7 +152,7 @@ var Block100000 = btcwire.MsgBlock{
Version: 1,
TxIn: []*btcwire.TxIn{
{
PreviousOutpoint: btcwire.OutPoint{
PreviousOutPoint: btcwire.OutPoint{
Hash: btcwire.ShaHash{},
Index: 0xffffffff,
},
@ -186,7 +186,7 @@ var Block100000 = btcwire.MsgBlock{
Version: 1,
TxIn: []*btcwire.TxIn{
{
PreviousOutpoint: btcwire.OutPoint{
PreviousOutPoint: btcwire.OutPoint{
Hash: btcwire.ShaHash([32]byte{ // Make go vet happy.
0x03, 0x2e, 0x38, 0xe9, 0xc0, 0xa8, 0x4c, 0x60,
0x46, 0xd6, 0x87, 0xd1, 0x05, 0x56, 0xdc, 0xac,
@ -255,7 +255,7 @@ var Block100000 = btcwire.MsgBlock{
Version: 1,
TxIn: []*btcwire.TxIn{
{
PreviousOutpoint: btcwire.OutPoint{
PreviousOutPoint: btcwire.OutPoint{
Hash: btcwire.ShaHash([32]byte{ // Make go vet happy.
0xc3, 0x3e, 0xbf, 0xf2, 0xa7, 0x09, 0xf1, 0x3d,
0x9f, 0x9a, 0x75, 0x69, 0xab, 0x16, 0xa3, 0x27,
@ -323,7 +323,7 @@ var Block100000 = btcwire.MsgBlock{
Version: 1,
TxIn: []*btcwire.TxIn{
{
PreviousOutpoint: btcwire.OutPoint{
PreviousOutPoint: btcwire.OutPoint{
Hash: btcwire.ShaHash([32]byte{ // Make go vet happy.
0x0b, 0x60, 0x72, 0xb3, 0x86, 0xd4, 0xa7, 0x73,
0x23, 0x52, 0x37, 0xf6, 0x4c, 0x11, 0x26, 0xac,